diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 9306e9b05..a4d352832 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -204,6 +204,11 @@ public final class Settings { */ public final Setting sprintAscends = new Setting<>(true); + /** + * When breaking blocks for a movement, wait until all falling blocks have settled before continuing + */ + public final Setting pauseMiningForFallingBlocks = new Setting<>(true); + /** * How many ticks between right clicks are allowed. Default in game is 4 */ diff --git a/src/main/java/baritone/pathing/movement/Movement.java b/src/main/java/baritone/pathing/movement/Movement.java index 8c0ba2f87..4bdd4f953 100644 --- a/src/main/java/baritone/pathing/movement/Movement.java +++ b/src/main/java/baritone/pathing/movement/Movement.java @@ -17,6 +17,7 @@ package baritone.pathing.movement; +import baritone.Baritone; import baritone.api.IBaritone; import baritone.api.pathing.movement.IMovement; import baritone.api.pathing.movement.MovementStatus; @@ -24,7 +25,9 @@ import baritone.api.utils.*; import baritone.api.utils.input.Input; import baritone.utils.BlockStateInterface; import net.minecraft.block.BlockLiquid; +import net.minecraft.entity.item.EntityFallingBlock; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import java.util.ArrayList; @@ -140,6 +143,9 @@ public abstract class Movement implements IMovement, MovementHelper { } boolean somethingInTheWay = false; for (BetterBlockPos blockPos : positionsToBreak) { + if (!ctx.world().getEntitiesWithinAABB(EntityFallingBlock.class, new AxisAlignedBB(0, 0, 0, 1, 1.1, 1).offset(blockPos)).isEmpty() && Baritone.settings().pauseMiningForFallingBlocks.value) { + return false; + } if (!MovementHelper.canWalkThrough(ctx, blockPos) && !(BlockStateInterface.getBlock(ctx, blockPos) instanceof BlockLiquid)) { // can't break liquid, so don't try somethingInTheWay = true; Optional reachable = RotationUtils.reachable(ctx.player(), blockPos, ctx.playerController().getBlockReachDistance());