fix: 下界巷道方向只在首次取玩家朝向,转移后沿用旋转方向 (v2.2.5.1)

这个提交包含在:
lyizai
2026-09-03 19:57:36 +08:00
父节点 954d7ba545
当前提交 d5e893ccf9
@@ -118,6 +118,8 @@ public final class NetherMiner {
/** 当前巷道方向 */
private int dirX;
private int dirZ;
/** 是否已确定过本次任务的巷道方向(首次取玩家朝向,之后沿用旋转方向) */
private boolean tunnelStarted;
/** 上一次打印诊断日志的时间戳(节流) */
private long lastLog;
/** 上一次成功下发的目标点(避免同一目标反复重发) */
@@ -163,6 +165,9 @@ public final class NetherMiner {
this.fullTicks = 0;
this.plan.clear();
this.step = 0;
this.dirX = 0;
this.dirZ = 0;
this.tunnelStarted = false;
this.lastIssuedTarget = null;
this.lastProgress = System.currentTimeMillis();
this.bestDist = Double.MAX_VALUE;
@@ -370,13 +375,18 @@ public final class NetherMiner {
}
}
/** 建立一条直巷计划:以玩家水平坐标为起点,y = config.netherLevel,沿当前朝向推进。 */
/** 建立一条直巷计划:以玩家水平坐标为起点,y = config.netherLevel。
* 方向只在首次建巷道时取玩家朝向;之后(rotateAndRelocate 旋转后)沿用当前方向,
* 保证扫描路径是一条连续折线,不会因玩家朝向变化而重复挖同一片区域。 */
private void initTunnel(DigConfig config, PlayerEntity player) {
if (!this.tunnelStarted) {
Direction facing = player.getHorizontalFacing();
int axis = facing.getAxis() == Direction.Axis.X ? 0 : 1;
int sign = axis == 0 ? facing.getOffsetX() : facing.getOffsetZ();
this.dirX = axis == 0 ? sign : 0;
this.dirZ = axis == 0 ? 0 : sign;
this.tunnelStarted = true;
}
BlockPos start = new BlockPos(player.getBlockPos().getX(), config.netherLevel, player.getBlockPos().getZ());
this.plan = new ArrayList<>();
for (int t = 0; t <= config.netherTunnelLength; t++) {