Skip to content

Commit

Permalink
fix 10517 (#10521)
Browse files Browse the repository at this point in the history
Fix clearing trying to reach unreachable places
  • Loading branch information
Raycoms authored Dec 9, 2024
1 parent 30d6fd5 commit e187d0c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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)
Expand Down Expand Up @@ -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);

Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ protected IAIState structureStep()

if (result.getBlockResult().getResult() == BlockPlacementResult.Result.FINISHED)
{

building.nextStage();
if (!goToNextStage(result))
{
Expand Down Expand Up @@ -671,7 +670,7 @@ public IAIState doMining()
return getState();
}

if (!mineBlock(blockToMine, getCurrentWorkingPosition()))
if (!mineBlock(blockToMine, null))
{
worker.swing(InteractionHand.MAIN_HAND);
return getState();
Expand Down

0 comments on commit e187d0c

Please sign in to comment.