chore: 加调试日志定位instantFall/落沙替换未生效问题
This commit is contained in:
1 parent
0649034969
commit
a32a784f87
2 files changed
+8
-7
No files matched your search
+6
-7
@@ -1,6 +1,7 @@
|
||||
package com.github.zly2006.carpetslsaddition.mixin.legacy;
|
||||
|
||||
import com.github.zly2006.carpetslsaddition.SLSCarpetSettings;
|
||||
import com.github.zly2006.carpetslsaddition.ServerMain;
|
||||
import com.github.zly2006.carpetslsaddition.util.LegacyBlockChangeRecorder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
@@ -11,13 +12,8 @@ import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
/**
|
||||
* [旧版] 落沙替换的核心注入点——重建 1.12 的"替换窗口"(记录+回放版)。
|
||||
*
|
||||
* <p>1.12:{@code BlockFalling} 创建实体时【重读世界】,异步线程在"检查→读取"间改块即可替换。
|
||||
* 26.1.2 单线程下该窗口物理不存在(tick 内同步 fall,无让出)。
|
||||
*
|
||||
* <p>本 mixin 改用 {@link LegacyBlockChangeRecorder}:
|
||||
* 当 {@code legacyFallingBlockReplace} 开启时,若该位置在最近 {@code WINDOW_TICKS} 内被改动过,
|
||||
* 就用记录的新方块作为下落实体的内容。这样玩家搭建的装置(改变世界方块)会决定下落实体的内容,
|
||||
* 与 1.12 的"装置驱动"玩法一致。
|
||||
* <p>当 {@code legacyFallingBlockReplace} 开启时,若该位置在最近 {@code WINDOW_TICKS} 内被改动过,
|
||||
* 就用记录的新方块作为下落实体的内容。这样玩家搭建的装置(改变世界方块)会决定下落实体的内容。
|
||||
*/
|
||||
@Mixin(net.minecraft.world.entity.item.FallingBlockEntity.class)
|
||||
public class FallingBlockEntityMixin {
|
||||
@@ -32,10 +28,13 @@ public class FallingBlockEntityMixin {
|
||||
if (!SLSCarpetSettings.legacyExploitMode || !SLSCarpetSettings.legacyFallingBlockReplace) {
|
||||
return original;
|
||||
}
|
||||
ServerMain.LOGGER.info("[SLSA-DEBUG] fall() pos={} original={}", pos, original.getBlock());
|
||||
BlockState recent = LegacyBlockChangeRecorder.getRecentChange(pos);
|
||||
if (recent != null && !recent.isAir()) {
|
||||
ServerMain.LOGGER.info("[SLSA-DEBUG] >>> REPLACE at {}: {} -> {}", pos, original.getBlock(), recent.getBlock());
|
||||
return recent;
|
||||
}
|
||||
ServerMain.LOGGER.info("[SLSA-DEBUG] no recent change at {}, recent={}", pos, recent);
|
||||
return original;
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ public abstract class FallingBlockMixin {
|
||||
@Inject(method = "getDelayAfterPlace", at = @At("HEAD"), cancellable = true)
|
||||
private void legacyDelayAfterPlace(CallbackInfoReturnable<Integer> cir) {
|
||||
if (SLSCarpetSettings.legacyExploitMode && SLSCarpetSettings.legacyInstantFall) {
|
||||
com.github.zly2006.carpetslsaddition.ServerMain.LOGGER.info("[SLSA-DEBUG] getDelayAfterPlace called -> 0");
|
||||
cir.setReturnValue(0);
|
||||
}
|
||||
}
|
||||
@@ -72,6 +73,7 @@ public abstract class FallingBlockMixin {
|
||||
@Inject(method = "tick", at = @At("HEAD"))
|
||||
private void legacyTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource rand, CallbackInfo ci) {
|
||||
if (SLSCarpetSettings.legacyExploitMode && SLSCarpetSettings.legacyInstantFall) {
|
||||
com.github.zly2006.carpetslsaddition.ServerMain.LOGGER.info("[SLSA-DEBUG] FallingBlock.tick pos={}", pos);
|
||||
LegacyExploitState.markInstantFall(pos);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user