From 76c4ca9ba6ef0089e038f77bdbfac641d3d1391a Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 19 Feb 2019 12:55:58 -0800 Subject: [PATCH] fix path reliability after lateral movement --- .../movement/movements/MovementAscend.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementAscend.java b/src/main/java/baritone/pathing/movement/movements/MovementAscend.java index f2697016..5bb6281f 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementAscend.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementAscend.java @@ -181,14 +181,21 @@ public class MovementAscend extends Movement { return state; } - if (headBonkClear()) { - return state.setInput(Input.JUMP, true); - } - int xAxis = Math.abs(src.getX() - dest.getX()); // either 0 or 1 int zAxis = Math.abs(src.getZ() - dest.getZ()); // either 0 or 1 double flatDistToNext = xAxis * Math.abs((dest.getX() + 0.5D) - ctx.player().posX) + zAxis * Math.abs((dest.getZ() + 0.5D) - ctx.player().posZ); double sideDist = zAxis * Math.abs((dest.getX() + 0.5D) - ctx.player().posX) + xAxis * Math.abs((dest.getZ() + 0.5D) - ctx.player().posZ); + + double lateralMotion = xAxis * ctx.player().motionZ + zAxis * ctx.player().motionX; + if (Math.abs(lateralMotion) > 0.1) { + return state; + } + + if (headBonkClear()) { + return state.setInput(Input.JUMP, true); + } + + // System.out.println(flatDistToNext + " " + sideDist); if (flatDistToNext > 1.2 || sideDist > 0.2) { return state;