From 3142387e455c2d8e8c41841d36be9105bc286fb7 Mon Sep 17 00:00:00 2001 From: Harry Date: Wed, 23 Jun 2021 06:25:10 +1000 Subject: [PATCH] Fix collision early return not tested yet - fixes early returns --- .../movement/movements/MovementParkour.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index 55930a04..162c20cc 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -108,10 +108,12 @@ public class MovementParkour extends Movement { int destX = x + xDiff * i; int destZ = z + zDiff * i; if (!MovementHelper.fullyPassable(context, destX, y + 1, destZ)) { - return; + maxJump = i - 1; + break; } if (!MovementHelper.fullyPassable(context, destX, y + 2, destZ)) { - return; + maxJump = i - 1; + break; } IBlockState destInto = context.bsi.get0(destX, y, destZ); if (!MovementHelper.fullyPassable(context.bsi.access, context.bsi.isPassableBlockPos.setPos(destX, y, destZ), destInto)) { @@ -120,8 +122,10 @@ public class MovementParkour extends Movement { res.y = y + 1; res.z = destZ; res.cost = i * SPRINT_ONE_BLOCK_COST + context.jumpPenalty; + return; } - return; + maxJump = i - 1; + break; } IBlockState landingOn = context.bsi.get0(destX, y - 1, destZ); // farmland needs to be canWalkOn otherwise farm can never work at all, but we want to specifically disallow ending a jump on farmland haha @@ -131,11 +135,14 @@ public class MovementParkour extends Movement { res.y = y; res.z = destZ; res.cost = costFromJumpDistance(i) + context.jumpPenalty; + return; } - return; + maxJump = i - 1; + break; } if (!MovementHelper.fullyPassable(context, destX, y + 3, destZ)) { - return; + maxJump = i - 1; + break; } } // parkour place starts here