From 9bd205f1905b028bedc495bd2372a4bec00c7d2f Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 10 Oct 2018 21:07:59 -0700 Subject: [PATCH] center pillar regardless of timing --- .../movement/movements/MovementPillar.java | 28 ++++++------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementPillar.java b/src/main/java/baritone/pathing/movement/movements/MovementPillar.java index 60803a3c..a43fbe59 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementPillar.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementPillar.java @@ -35,18 +35,11 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; public class MovementPillar extends Movement { - private int numTicks = 0; public MovementPillar(BetterBlockPos start, BetterBlockPos end) { super(start, end, new BetterBlockPos[]{start.up(2)}, start); } - @Override - public void reset() { - super.reset(); - numTicks = 0; - } - @Override protected double calculateCost(CalculationContext context) { return cost(context, src.x, src.y, src.z); @@ -202,24 +195,21 @@ public class MovementPillar extends Movement { return state.setStatus(MovementStatus.UNREACHABLE); } - numTicks++; // If our Y coordinate is above our goal, stop jumping state.setInput(InputOverrideHandler.Input.JUMP, player().posY < dest.getY()); state.setInput(InputOverrideHandler.Input.SNEAK, true); - // Otherwise jump - if (numTicks > 20) { - double diffX = player().posX - (dest.getX() + 0.5); - double diffZ = player().posZ - (dest.getZ() + 0.5); - double dist = Math.sqrt(diffX * diffX + diffZ * diffZ); - if (dist > 0.17) {//why 0.17? because it seemed like a good number, that's why - //[explanation added after baritone port lol] also because it needs to be less than 0.2 because of the 0.3 sneak limit - //and 0.17 is reasonably less than 0.2 + double diffX = player().posX - (dest.getX() + 0.5); + double diffZ = player().posZ - (dest.getZ() + 0.5); + double dist = Math.sqrt(diffX * diffX + diffZ * diffZ); + if (dist > 0.17) {//why 0.17? because it seemed like a good number, that's why + //[explanation added after baritone port lol] also because it needs to be less than 0.2 because of the 0.3 sneak limit + //and 0.17 is reasonably less than 0.2 - // If it's been more than forty ticks of trying to jump and we aren't done yet, go forward, maybe we are stuck - state.setInput(InputOverrideHandler.Input.MOVE_FORWARD, true); - } + // If it's been more than forty ticks of trying to jump and we aren't done yet, go forward, maybe we are stuck + state.setInput(InputOverrideHandler.Input.MOVE_FORWARD, true); } + if (!blockIsThere) { Block fr = BlockStateInterface.get(src).getBlock();