From 1b957dc336e73216a04a5b8045f0d275d18d05b6 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 19 Aug 2018 14:08:16 -0700 Subject: [PATCH] GoalBlock heuristic fix --- .../baritone/bot/pathing/goals/GoalBlock.java | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/main/java/baritone/bot/pathing/goals/GoalBlock.java b/src/main/java/baritone/bot/pathing/goals/GoalBlock.java index 120486814..1efb7aabc 100644 --- a/src/main/java/baritone/bot/pathing/goals/GoalBlock.java +++ b/src/main/java/baritone/bot/pathing/goals/GoalBlock.java @@ -87,23 +87,12 @@ public class GoalBlock implements Goal { } public static double calculate(double xDiff, int yDiff, double zDiff) { - double pythaDist = Math.sqrt(xDiff * xDiff + zDiff * zDiff); double heuristic = 0; - if (pythaDist < MAX) {//if we are more than MAX away, ignore the Y coordinate. It really doesn't matter how far away your Y coordinate is if you X coordinate is 1000 blocks away. - //as we get closer, slowly reintroduce the Y coordinate as a heuristic cost - double multiplier; - if (pythaDist < MIN) { - multiplier = 1; - } else { - multiplier = 1 - (pythaDist - MIN) / (MAX - MIN); - } - // if yDiff is 1 that means that pos.getY()-this.y==1 which means that we're 1 block below where we should be - // therefore going from 0,0,0 to a GoalYLevel of pos.getY()-this.y is accurate - heuristic += new GoalYLevel(yDiff).heuristic(new BlockPos(0, 0, 0)); + // if yDiff is 1 that means that pos.getY()-this.y==1 which means that we're 1 block below where we should be + // therefore going from 0,0,0 to a GoalYLevel of pos.getY()-this.y is accurate + heuristic += new GoalYLevel(yDiff).heuristic(new BlockPos(0, 0, 0)); - heuristic *= multiplier; - } //use the pythagorean and manhattan mixture from GoalXZ heuristic += GoalXZ.calculate(xDiff, zDiff); return heuristic;