diff --git a/src/api/java/baritone/api/utils/Rotation.java b/src/api/java/baritone/api/utils/Rotation.java index ea10c7ec6..28afbf658 100644 --- a/src/api/java/baritone/api/utils/Rotation.java +++ b/src/api/java/baritone/api/utils/Rotation.java @@ -110,6 +110,17 @@ public class Rotation { ); } + /** + * Is really close to + * + * @param other another rotation + * @return are they really close + */ + public boolean isReallyCloseTo(Rotation other) { + float yawDiff = Math.abs(this.yaw - other.yaw); // you cant fool me + return (yawDiff < 0.01 || yawDiff > 359.9) && Math.abs(this.pitch - other.pitch) < 0.01; + } + /** * Clamps the specified pitch value between -90 and 90. * diff --git a/src/main/java/baritone/pathing/movement/Movement.java b/src/main/java/baritone/pathing/movement/Movement.java index f0f206484..4105b5e70 100644 --- a/src/main/java/baritone/pathing/movement/Movement.java +++ b/src/main/java/baritone/pathing/movement/Movement.java @@ -151,9 +151,10 @@ public abstract class Movement implements IMovement, MovementHelper { somethingInTheWay = true; Optional reachable = RotationUtils.reachable(ctx.player(), blockPos, ctx.playerController().getBlockReachDistance()); if (reachable.isPresent()) { + Rotation rotTowardsBlock = reachable.get(); MovementHelper.switchToBestToolFor(ctx, BlockStateInterface.get(ctx, blockPos)); - state.setTarget(new MovementState.MovementTarget(reachable.get(), true)); - if (Objects.equals(ctx.getSelectedBlock().orElse(null), blockPos)) { + state.setTarget(new MovementState.MovementTarget(rotTowardsBlock, true)); + if (Objects.equals(ctx.getSelectedBlock().orElse(null), blockPos) || ctx.playerRotations().isReallyCloseTo(rotTowardsBlock)) { state.setInput(Input.CLICK_LEFT, true); } return false;