From 30408384c6d3eb131ecc9b2b900a8cfdd05f967d Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 5 Nov 2018 14:37:05 -0800 Subject: [PATCH] fix --- src/api/java/baritone/api/behavior/IPathingBehavior.java | 4 +++- src/main/java/baritone/behavior/PathingBehavior.java | 9 +++++++-- src/main/java/baritone/process/GetToBlockProcess.java | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/api/java/baritone/api/behavior/IPathingBehavior.java b/src/api/java/baritone/api/behavior/IPathingBehavior.java index ced3d861..622c453a 100644 --- a/src/api/java/baritone/api/behavior/IPathingBehavior.java +++ b/src/api/java/baritone/api/behavior/IPathingBehavior.java @@ -53,8 +53,10 @@ public interface IPathingBehavior extends IBehavior { * Cancels the pathing behavior or the current path calculation. Also cancels all processes that could be controlling path. *

* Basically, "MAKE IT STOP". + * + * @return whether or not the pathing behavior was canceled. All processes are guaranteed to be canceled, but the PathingBehavior might be in the middle of an uncancelable action like a parkour jump */ - void cancelEverything(); + boolean cancelEverything(); /** * Returns the current path, from the current path executor, if there is one. diff --git a/src/main/java/baritone/behavior/PathingBehavior.java b/src/main/java/baritone/behavior/PathingBehavior.java index 03641ac5..9582f3c5 100644 --- a/src/main/java/baritone/behavior/PathingBehavior.java +++ b/src/main/java/baritone/behavior/PathingBehavior.java @@ -254,9 +254,13 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior, } @Override - public void cancelEverything() { - secretInternalSegmentCancel(); + public boolean cancelEverything() { + boolean doIt = isSafeToCancel(); + if (doIt) { + secretInternalSegmentCancel(); + } baritone.getPathingControlManager().cancelEverything(); + return doIt; } public boolean calcFailedLastTick() { // NOT exposed on public api @@ -275,6 +279,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior, public void forceCancel() { // NOT exposed on public api cancelEverything(); + secretInternalSegmentCancel(); isPathCalcInProgress = false; } diff --git a/src/main/java/baritone/process/GetToBlockProcess.java b/src/main/java/baritone/process/GetToBlockProcess.java index 8dd07560..7f5340ed 100644 --- a/src/main/java/baritone/process/GetToBlockProcess.java +++ b/src/main/java/baritone/process/GetToBlockProcess.java @@ -79,7 +79,7 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl if (goal.isInGoal(playerFeet())) { onLostControl(); } - return new PathingCommand(goal, PathingCommandType.SET_GOAL_AND_PATH); + return new PathingCommand(goal, PathingCommandType.REVALIDATE_GOAL_AND_PATH); } @Override