add force cancel
This commit is contained in:
parent
8d46c36269
commit
e705f9808b
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.pathing.calc;
|
||||
|
||||
import baritone.behavior.impl.PathingBehavior;
|
||||
import baritone.pathing.goals.Goal;
|
||||
import baritone.pathing.path.IPath;
|
||||
import baritone.utils.pathing.BetterBlockPos;
|
||||
@ -121,6 +122,11 @@ public abstract class AbstractNodeCostSearch implements IPathFinder {
|
||||
return node;
|
||||
}
|
||||
|
||||
public static void forceCancel() {
|
||||
PathingBehavior.INSTANCE.cancel();
|
||||
currentlyRunning = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<IPath> pathToMostRecentNodeConsidered() {
|
||||
return Optional.ofNullable(mostRecentConsidered).map(node -> new Path(startNode, node, 0));
|
||||
|
@ -28,6 +28,7 @@ import baritone.chunk.ChunkPacker;
|
||||
import baritone.chunk.Waypoint;
|
||||
import baritone.chunk.WorldProvider;
|
||||
import baritone.pathing.calc.AStarPathFinder;
|
||||
import baritone.pathing.calc.AbstractNodeCostSearch;
|
||||
import baritone.pathing.goals.*;
|
||||
import baritone.pathing.movement.ActionCosts;
|
||||
import baritone.pathing.movement.CalculationContext;
|
||||
@ -117,6 +118,12 @@ public class ExampleBaritoneControl extends Behavior {
|
||||
displayChatMessageRaw("ok canceled");
|
||||
return;
|
||||
}
|
||||
if (msg.toLowerCase().equals("forcecancel")) {
|
||||
AbstractNodeCostSearch.forceCancel();
|
||||
event.cancel();
|
||||
displayChatMessageRaw("ok force canceled");
|
||||
return;
|
||||
}
|
||||
if (msg.toLowerCase().equals("invert")) {
|
||||
Goal goal = PathingBehavior.INSTANCE.getGoal();
|
||||
BlockPos runAwayFrom;
|
||||
|
Loading…
Reference in New Issue
Block a user