From d854750ee8a088a540caffca5819f2c2c18a2428 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 23 Nov 2018 10:52:56 -0800 Subject: [PATCH] improve accuracy of GoalGetToBlock heuristic --- .../java/baritone/api/pathing/goals/GoalGetToBlock.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/api/java/baritone/api/pathing/goals/GoalGetToBlock.java b/src/api/java/baritone/api/pathing/goals/GoalGetToBlock.java index 959b6fcc6..c4856cdd6 100644 --- a/src/api/java/baritone/api/pathing/goals/GoalGetToBlock.java +++ b/src/api/java/baritone/api/pathing/goals/GoalGetToBlock.java @@ -48,10 +48,7 @@ public class GoalGetToBlock implements Goal, IGoalRenderPos { int xDiff = x - this.x; int yDiff = y - this.y; int zDiff = z - this.z; - if (yDiff < 0) { - yDiff++; - } - return Math.abs(xDiff) + Math.abs(yDiff) + Math.abs(zDiff) <= 1; + return Math.abs(xDiff) + Math.abs(yDiff < 0 ? yDiff + 1 : yDiff) + Math.abs(zDiff) <= 1; } @Override @@ -59,7 +56,7 @@ public class GoalGetToBlock implements Goal, IGoalRenderPos { int xDiff = x - this.x; int yDiff = y - this.y; int zDiff = z - this.z; - return GoalBlock.calculate(xDiff, yDiff, zDiff); + return GoalBlock.calculate(xDiff, yDiff < 0 ? yDiff + 1 : yDiff, zDiff); } @Override