make InputOverrideHandler a Behavior

This commit is contained in:
Leijurv 2018-11-05 14:47:40 -08:00
parent cb153e039b
commit 4d0bfce712
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 16 additions and 6 deletions

View File

@ -65,7 +65,6 @@ public enum Baritone implements IBaritone {
private boolean initialized; private boolean initialized;
private GameEventHandler gameEventHandler; private GameEventHandler gameEventHandler;
private InputOverrideHandler inputOverrideHandler;
private Settings settings; private Settings settings;
private File dir; private File dir;
private ThreadPoolExecutor threadPool; private ThreadPoolExecutor threadPool;
@ -74,6 +73,7 @@ public enum Baritone implements IBaritone {
private PathingBehavior pathingBehavior; private PathingBehavior pathingBehavior;
private LookBehavior lookBehavior; private LookBehavior lookBehavior;
private MemoryBehavior memoryBehavior; private MemoryBehavior memoryBehavior;
private InputOverrideHandler inputOverrideHandler;
private FollowProcess followProcess; private FollowProcess followProcess;
private MineProcess mineProcess; private MineProcess mineProcess;
@ -91,26 +91,30 @@ public enum Baritone implements IBaritone {
return; return;
} }
this.threadPool = new ThreadPoolExecutor(4, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<>()); this.threadPool = new ThreadPoolExecutor(4, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<>());
this.inputOverrideHandler = new InputOverrideHandler();
// Acquire the "singleton" instance of the settings directly from the API // Acquire the "singleton" instance of the settings directly from the API
// We might want to change this... // We might want to change this...
this.settings = BaritoneAPI.getSettings(); this.settings = BaritoneAPI.getSettings();
this.pathingControlManager = new PathingControlManager(this);
this.behaviors = new ArrayList<>(); this.behaviors = new ArrayList<>();
{ {
// the Behavior constructor calls baritone.registerBehavior(this) so this populates the behaviors arraylist // the Behavior constructor calls baritone.registerBehavior(this) so this populates the behaviors arraylist
pathingBehavior = new PathingBehavior(this); pathingBehavior = new PathingBehavior(this);
lookBehavior = new LookBehavior(this); lookBehavior = new LookBehavior(this);
memoryBehavior = new MemoryBehavior(this); memoryBehavior = new MemoryBehavior(this);
inputOverrideHandler = new InputOverrideHandler(this);
new ExampleBaritoneControl(this);
}
this.pathingControlManager = new PathingControlManager(this);
{
followProcess = new FollowProcess(this); followProcess = new FollowProcess(this);
mineProcess = new MineProcess(this); mineProcess = new MineProcess(this);
new ExampleBaritoneControl(this);
customGoalProcess = new CustomGoalProcess(this); // very high iq customGoalProcess = new CustomGoalProcess(this); // very high iq
getToBlockProcess = new GetToBlockProcess(this); getToBlockProcess = new GetToBlockProcess(this);
} }
if (BaritoneAutoTest.ENABLE_AUTO_TEST) { if (BaritoneAutoTest.ENABLE_AUTO_TEST) {
registerEventListener(BaritoneAutoTest.INSTANCE); registerEventListener(BaritoneAutoTest.INSTANCE);
} }

View File

@ -17,6 +17,8 @@
package baritone.utils; package baritone.utils;
import baritone.Baritone;
import baritone.behavior.Behavior;
import net.minecraft.client.settings.KeyBinding; import net.minecraft.client.settings.KeyBinding;
import java.util.HashMap; import java.util.HashMap;
@ -30,7 +32,11 @@ import java.util.Map;
* @author Brady * @author Brady
* @since 7/31/2018 11:20 PM * @since 7/31/2018 11:20 PM
*/ */
public final class InputOverrideHandler implements Helper { public final class InputOverrideHandler extends Behavior implements Helper {
public InputOverrideHandler(Baritone baritone) {
super(baritone);
}
/** /**
* Maps keybinds to whether or not we are forcing their state down. * Maps keybinds to whether or not we are forcing their state down.