From d8790e1dc6e996a2d92b8a05c29454dd7a95d453 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 10 Sep 2018 14:48:18 -0700 Subject: [PATCH] misc cleanup --- .../pathing/calc/AStarPathFinder.java | 29 ++++++++++++------- .../pathing/calc/AbstractNodeCostSearch.java | 6 ++-- .../movement/movements/MovementParkour.java | 2 +- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/main/java/baritone/pathing/calc/AStarPathFinder.java b/src/main/java/baritone/pathing/calc/AStarPathFinder.java index d03e52f8..bf553e18 100644 --- a/src/main/java/baritone/pathing/calc/AStarPathFinder.java +++ b/src/main/java/baritone/pathing/calc/AStarPathFinder.java @@ -210,36 +210,43 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { public static Movement[] getConnectedPositions(BetterBlockPos pos, CalculationContext calcContext) { - int x = pos.getX(); - int y = pos.getY(); - int z = pos.getZ(); + int x = pos.x; + int y = pos.y; + int z = pos.z; BetterBlockPos east = new BetterBlockPos(x + 1, y, z); BetterBlockPos west = new BetterBlockPos(x - 1, y, z); BetterBlockPos south = new BetterBlockPos(x, y, z + 1); BetterBlockPos north = new BetterBlockPos(x, y, z - 1); return new Movement[]{ + new MovementDownward(pos, new BetterBlockPos(x, y - 1, z)), + + new MovementPillar(pos, new BetterBlockPos(x, y + 1, z)), + new MovementTraverse(pos, east), new MovementTraverse(pos, west), new MovementTraverse(pos, north), new MovementTraverse(pos, south), + new MovementAscend(pos, new BetterBlockPos(x + 1, y + 1, z)), new MovementAscend(pos, new BetterBlockPos(x - 1, y + 1, z)), new MovementAscend(pos, new BetterBlockPos(x, y + 1, z + 1)), new MovementAscend(pos, new BetterBlockPos(x, y + 1, z - 1)), + MovementHelper.generateMovementFallOrDescend(pos, east, calcContext), MovementHelper.generateMovementFallOrDescend(pos, west, calcContext), MovementHelper.generateMovementFallOrDescend(pos, north, calcContext), MovementHelper.generateMovementFallOrDescend(pos, south, calcContext), - new MovementDownward(pos, new BetterBlockPos(x, y - 1, z)), - new MovementDiagonal(pos, EnumFacing.NORTH, EnumFacing.WEST), + new MovementDiagonal(pos, EnumFacing.NORTH, EnumFacing.EAST), - new MovementDiagonal(pos, EnumFacing.SOUTH, EnumFacing.WEST), + new MovementDiagonal(pos, EnumFacing.NORTH, EnumFacing.WEST), new MovementDiagonal(pos, EnumFacing.SOUTH, EnumFacing.EAST), - new MovementPillar(pos, new BetterBlockPos(x, y + 1, z)), - MovementParkour.calculate(pos, EnumFacing.NORTH), - MovementParkour.calculate(pos, EnumFacing.SOUTH), - MovementParkour.calculate(pos, EnumFacing.EAST), - MovementParkour.calculate(pos, EnumFacing.WEST), + + new MovementDiagonal(pos, EnumFacing.SOUTH, EnumFacing.WEST), + + MovementParkour.generate(pos, EnumFacing.EAST), + MovementParkour.generate(pos, EnumFacing.WEST), + MovementParkour.generate(pos, EnumFacing.NORTH), + MovementParkour.generate(pos, EnumFacing.SOUTH), }; } diff --git a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java index 5804cb1a..92c85b1d 100644 --- a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java +++ b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java @@ -107,9 +107,9 @@ public abstract class AbstractNodeCostSearch implements IPathFinder { * @return The distance, squared */ protected double getDistFromStartSq(PathNode n) { - int xDiff = n.pos.getX() - start.getX(); - int yDiff = n.pos.getY() - start.getY(); - int zDiff = n.pos.getZ() - start.getZ(); + int xDiff = n.pos.x - start.x; + int yDiff = n.pos.y - start.y; + int zDiff = n.pos.z - start.z; return xDiff * xDiff + yDiff * yDiff + zDiff * zDiff; } diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index 8cd37c73..b14abbca 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -42,7 +42,7 @@ public class MovementParkour extends Movement { super.override(costFromJumpDistance(dist)); } - public static MovementParkour calculate(BetterBlockPos src, EnumFacing dir) { + public static MovementParkour generate(BetterBlockPos src, EnumFacing dir) { if (!Baritone.settings().allowParkour.get()) { return null; }