continuous pathfinding and clearing

This commit is contained in:
Leijurv 2018-08-06 21:07:15 -07:00
parent 6e0df6e9fd
commit 5cdacb4939
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 15 additions and 0 deletions

View File

@ -29,6 +29,11 @@ public final class InputOverrideHandler implements Helper {
*/
private final Map<Integer, Boolean> keyCodeForceStateMap = new HashMap<>();
public final void clearAllKeys() {
inputForceStateMap.clear();
keyCodeForceStateMap.clear();
}
/**
* Returns whether or not we are forcing down the specified {@link KeyBinding}.
*

View File

@ -1,5 +1,6 @@
package baritone.bot.behavior.impl;
import baritone.bot.Baritone;
import baritone.bot.behavior.Behavior;
import baritone.bot.event.events.ChatEvent;
import baritone.bot.event.events.RenderEvent;
@ -49,6 +50,8 @@ public class PathingBehavior extends Behavior {
current.onTick(event);
if (current.failed() || current.finished()) {
current = null;
if (!goal.isInGoal(playerFeet()))
findPathInNewThread(playerFeet(), true);
}
}
@ -79,6 +82,13 @@ public class PathingBehavior extends Behavior {
event.cancel();
return;
}
if (msg.toLowerCase().equals("cancel")) {
current = null;
Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys();
event.cancel();
displayChatMessageRaw("ok canceled");
return;
}
}