diff --git a/src/main/java/baritone/behavior/PathingBehavior.java b/src/main/java/baritone/behavior/PathingBehavior.java index e91769b8..e2b21579 100644 --- a/src/main/java/baritone/behavior/PathingBehavior.java +++ b/src/main/java/baritone/behavior/PathingBehavior.java @@ -23,15 +23,15 @@ import baritone.api.event.events.PathEvent; import baritone.api.event.events.PlayerUpdateEvent; import baritone.api.event.events.RenderEvent; import baritone.api.event.events.TickEvent; +import baritone.api.pathing.calc.IPath; +import baritone.api.pathing.calc.IPathFinder; import baritone.api.pathing.goals.Goal; import baritone.api.pathing.goals.GoalXZ; -import baritone.pathing.calc.CutoffPath; -import baritone.api.pathing.calc.IPath; import baritone.api.utils.BetterBlockPos; import baritone.api.utils.interfaces.IGoalRenderPos; import baritone.pathing.calc.AStarPathFinder; import baritone.pathing.calc.AbstractNodeCostSearch; -import baritone.api.pathing.calc.IPathFinder; +import baritone.pathing.calc.CutoffPath; import baritone.pathing.movement.MovementHelper; import baritone.pathing.path.PathExecutor; import baritone.utils.BlockBreakHelper; @@ -123,12 +123,13 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior, if (safe) { // a movement just ended if (next != null) { - if (next.getPath().positions().contains(playerFeet())) { + if (next.snipsnapifpossible()) { // jump directly onto the next path logDebug("Splicing into planned next path early..."); dispatchPathEvent(PathEvent.SPLICING_ONTO_NEXT_EARLY); current = next; next = null; + current.onTick(event); return; } } diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index 6f531857..5cc2c1dd 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -339,6 +339,19 @@ public class PathExecutor implements IPathExecutor, Helper { } } + /** + * Regardless of current path position, snap to the current player feet if possible + */ + public boolean snipsnapifpossible() { + int index = path.positions().indexOf(playerFeet()); + if (index == -1) { + return false; + } + pathPosition = index; + clearKeys(); + return true; + } + private void sprintIfRequested() { // first and foremost, if allowSprint is off, or if we don't have enough hunger, don't try and sprint