From c5f5445f4bb780a02cb984bd8c41202c2c4278ba Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 12 Oct 2018 14:19:11 -0700 Subject: [PATCH] fix exception when calculating descend from starting position above 256 --- src/main/java/baritone/pathing/calc/AStarPathFinder.java | 3 +++ src/main/java/baritone/pathing/movement/Moves.java | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/baritone/pathing/calc/AStarPathFinder.java b/src/main/java/baritone/pathing/calc/AStarPathFinder.java index a0deae58..9fbb3979 100644 --- a/src/main/java/baritone/pathing/calc/AStarPathFinder.java +++ b/src/main/java/baritone/pathing/calc/AStarPathFinder.java @@ -111,6 +111,9 @@ public final class AStarPathFinder extends AbstractNodeCostSearch implements Hel if (!moves.dynamicXZ && !worldBorder.entirelyContains(newX, newZ)) { continue; } + if ((currentNode.y == 256 && moves.yOffset > 0) || (currentNode.y == 0 && moves.yOffset < 0)) { + continue; + } res.reset(); moves.apply(calcContext, currentNode.x, currentNode.y, currentNode.z, res); numMovementsConsidered++; diff --git a/src/main/java/baritone/pathing/movement/Moves.java b/src/main/java/baritone/pathing/movement/Moves.java index 3d53ff5b..80a6c4d5 100644 --- a/src/main/java/baritone/pathing/movement/Moves.java +++ b/src/main/java/baritone/pathing/movement/Moves.java @@ -148,7 +148,7 @@ public enum Moves { } }, - DESCEND_EAST(+1, 0, 0, false, true) { + DESCEND_EAST(+1, -1, 0, false, true) { @Override public Movement apply0(BetterBlockPos src) { MutableMoveResult res = new MutableMoveResult(); @@ -166,7 +166,7 @@ public enum Moves { } }, - DESCEND_WEST(-1, 0, 0, false, true) { + DESCEND_WEST(-1, -1, 0, false, true) { @Override public Movement apply0(BetterBlockPos src) { MutableMoveResult res = new MutableMoveResult(); @@ -184,7 +184,7 @@ public enum Moves { } }, - DESCEND_NORTH(0, 0, -1, false, true) { + DESCEND_NORTH(0, -1, -1, false, true) { @Override public Movement apply0(BetterBlockPos src) { MutableMoveResult res = new MutableMoveResult(); @@ -202,7 +202,7 @@ public enum Moves { } }, - DESCEND_SOUTH(0, 0, +1, false, true) { + DESCEND_SOUTH(0, -1, +1, false, true) { @Override public Movement apply0(BetterBlockPos src) { MutableMoveResult res = new MutableMoveResult();