From d5e893ccf9d6e46c8a0961e350ec8ced8e8a4164 Mon Sep 17 00:00:00 2001 From: lyizai <3945107889@qq.com> Date: Thu, 3 Sep 2026 19:57:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=8B=E7=95=8C=E5=B7=B7=E9=81=93?= =?UTF-8?q?=E6=96=B9=E5=90=91=E5=8F=AA=E5=9C=A8=E9=A6=96=E6=AC=A1=E5=8F=96?= =?UTF-8?q?=E7=8E=A9=E5=AE=B6=E6=9C=9D=E5=90=91=EF=BC=8C=E8=BD=AC=E7=A7=BB?= =?UTF-8?q?=E5=90=8E=E6=B2=BF=E7=94=A8=E6=97=8B=E8=BD=AC=E6=96=B9=E5=90=91?= =?UTF-8?q?=20(v2.2.5.1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../autodig/client/miner/NetherMiner.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/main/java/autodig/client/miner/NetherMiner.java b/src/main/java/autodig/client/miner/NetherMiner.java index af3df09..93c7223 100644 --- a/src/main/java/autodig/client/miner/NetherMiner.java +++ b/src/main/java/autodig/client/miner/NetherMiner.java @@ -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) { - 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; + 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++) {