From e187d0c4a2f907cc0f35d1d2adf533c5c94da98f Mon Sep 17 00:00:00 2001 From: Raycoms Date: Mon, 9 Dec 2024 18:13:01 +0100 Subject: [PATCH] fix 10517 (#10521) Fix clearing trying to reach unreachable places --- .../core/entity/ai/workers/AbstractEntityAIInteract.java | 8 ++++---- .../core/entity/ai/workers/AbstractEntityAIStructure.java | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/minecolonies/core/entity/ai/workers/AbstractEntityAIInteract.java b/src/main/java/com/minecolonies/core/entity/ai/workers/AbstractEntityAIInteract.java index 957ed54662c..b41d475743e 100755 --- a/src/main/java/com/minecolonies/core/entity/ai/workers/AbstractEntityAIInteract.java +++ b/src/main/java/com/minecolonies/core/entity/ai/workers/AbstractEntityAIInteract.java @@ -140,7 +140,7 @@ protected final boolean mineBlock(@NotNull final BlockPos blockToMine) * @param safeStand the block we want to stand on to do that * @return true once we're done */ - protected boolean mineBlock(@NotNull final BlockPos blockToMine, @NotNull final BlockPos safeStand) + protected boolean mineBlock(@NotNull final BlockPos blockToMine, @Nullable final BlockPos safeStand) { return mineBlock(blockToMine, safeStand, true, true, null); } @@ -158,7 +158,7 @@ protected boolean mineBlock(@NotNull final BlockPos blockToMine, @NotNull final */ protected final boolean mineBlock( @NotNull final BlockPos blockToMine, - @NotNull final BlockPos safeStand, + @Nullable final BlockPos safeStand, final boolean damageTool, final boolean getDrops, final Runnable blockBreakAction) @@ -287,7 +287,7 @@ protected void triggerMinedBlock(@NotNull final BlockPos position, @NotNull fina * @param safeStand a safe stand to mine from (empty Block!) * @return true if you should wait */ - private boolean checkMiningLocation(@NotNull final BlockPos blockToMine, @NotNull final BlockPos safeStand) + private boolean checkMiningLocation(@NotNull final BlockPos blockToMine, @Nullable final BlockPos safeStand) { final BlockState curBlock = world.getBlockState(blockToMine); @@ -297,7 +297,7 @@ private boolean checkMiningLocation(@NotNull final BlockPos blockToMine, @NotNul return true; } - if (walkToBlock(safeStand) && MathUtils.twoDimDistance(worker.blockPosition(), safeStand) > MIN_WORKING_RANGE) + if (safeStand != null && walkToBlock(safeStand) && MathUtils.twoDimDistance(worker.blockPosition(), safeStand) > MIN_WORKING_RANGE) { return true; } diff --git a/src/main/java/com/minecolonies/core/entity/ai/workers/AbstractEntityAIStructure.java b/src/main/java/com/minecolonies/core/entity/ai/workers/AbstractEntityAIStructure.java index aba1aed1ea4..e7655f8f098 100755 --- a/src/main/java/com/minecolonies/core/entity/ai/workers/AbstractEntityAIStructure.java +++ b/src/main/java/com/minecolonies/core/entity/ai/workers/AbstractEntityAIStructure.java @@ -460,7 +460,6 @@ protected IAIState structureStep() if (result.getBlockResult().getResult() == BlockPlacementResult.Result.FINISHED) { - building.nextStage(); if (!goToNextStage(result)) { @@ -671,7 +670,7 @@ public IAIState doMining() return getState(); } - if (!mineBlock(blockToMine, getCurrentWorkingPosition())) + if (!mineBlock(blockToMine, null)) { worker.swing(InteractionHand.MAIN_HAND); return getState();