From 36858ca219ceafb45b14f6b95e65e0def80194d6 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 25 Apr 2019 11:22:11 -0700 Subject: [PATCH] small cleanup --- src/api/java/baritone/api/utils/RotationUtils.java | 2 +- src/main/java/baritone/pathing/movement/Movement.java | 2 +- .../baritone/pathing/movement/movements/MovementTraverse.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api/java/baritone/api/utils/RotationUtils.java b/src/api/java/baritone/api/utils/RotationUtils.java index 3010d283..e19f531d 100644 --- a/src/api/java/baritone/api/utils/RotationUtils.java +++ b/src/api/java/baritone/api/utils/RotationUtils.java @@ -154,7 +154,7 @@ public final class RotationUtils { */ public static Optional reachable(EntityPlayerSP entity, BlockPos pos, double blockReachDistance) { IBaritone baritone = BaritoneAPI.getProvider().getBaritoneForPlayer(entity); - if (pos.equals(baritone.getPlayerContext().getSelectedBlock().orElse(null))) { + if (baritone.getPlayerContext().isLookingAt(pos)) { /* * why add 0.0001? * to indicate that we actually have a desired pitch diff --git a/src/main/java/baritone/pathing/movement/Movement.java b/src/main/java/baritone/pathing/movement/Movement.java index 4bdd4f95..c9849cab 100644 --- a/src/main/java/baritone/pathing/movement/Movement.java +++ b/src/main/java/baritone/pathing/movement/Movement.java @@ -153,7 +153,7 @@ public abstract class Movement implements IMovement, MovementHelper { Rotation rotTowardsBlock = reachable.get(); MovementHelper.switchToBestToolFor(ctx, BlockStateInterface.get(ctx, blockPos)); state.setTarget(new MovementState.MovementTarget(rotTowardsBlock, true)); - if (Objects.equals(ctx.getSelectedBlock().orElse(null), blockPos) || ctx.playerRotations().isReallyCloseTo(rotTowardsBlock)) { + if (ctx.isLookingAt(blockPos) || ctx.playerRotations().isReallyCloseTo(rotTowardsBlock)) { state.setInput(Input.CLICK_LEFT, true); } return false; diff --git a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java index 881571bc..4f7ae713 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java @@ -313,7 +313,7 @@ public class MovementTraverse extends Movement { } else { state.setTarget(new MovementState.MovementTarget(backToFace, true)); } - if (Objects.equals(ctx.getSelectedBlock().orElse(null), goalLook)) { + if (ctx.isLookingAt(goalLook)) { return state.setInput(Input.CLICK_RIGHT, true); // wait to right click until we are able to place } // Out.log("Trying to look at " + goalLook + ", actually looking at" + Baritone.whatAreYouLookingAt());