pause mining for falling blocks, fixes #157

This commit is contained in:
Leijurv 2019-04-25 11:10:18 -07:00
parent 79c433b14d
commit 30469e2de2
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 11 additions and 0 deletions

View File

@ -204,6 +204,11 @@ public final class Settings {
*/
public final Setting<Boolean> sprintAscends = new Setting<>(true);
/**
* When breaking blocks for a movement, wait until all falling blocks have settled before continuing
*/
public final Setting<Boolean> pauseMiningForFallingBlocks = new Setting<>(true);
/**
* How many ticks between right clicks are allowed. Default in game is 4
*/

View File

@ -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<Rotation> reachable = RotationUtils.reachable(ctx.player(), blockPos, ctx.playerController().getBlockReachDistance());