fix exception when calculating descend from starting position above 256

This commit is contained in:
Leijurv 2018-10-12 14:19:11 -07:00
parent 8a65f43a0b
commit c5f5445f4b
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 7 additions and 4 deletions

View File

@ -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++;

View File

@ -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();