Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix 10517 #10521

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading