this can be moved i think
This commit is contained in:
parent
aac0d623fa
commit
a182c22d36
@ -24,10 +24,7 @@ import baritone.api.event.listener.IGameEventListener;
|
||||
import baritone.cache.WorldProvider;
|
||||
import baritone.utils.BlockStateInterface;
|
||||
import baritone.utils.Helper;
|
||||
import baritone.utils.InputOverrideHandler;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -57,21 +54,6 @@ public final class GameEventHandler implements IGameEventListener, Helper {
|
||||
|
||||
@Override
|
||||
public final void onProcessKeyBinds() {
|
||||
InputOverrideHandler inputHandler = baritone.getInputOverrideHandler();
|
||||
|
||||
// Simulate the key being held down this tick
|
||||
for (InputOverrideHandler.Input input : InputOverrideHandler.Input.values()) {
|
||||
KeyBinding keyBinding = input.getKeyBinding();
|
||||
|
||||
if (inputHandler.isInputForcedDown(keyBinding) && !keyBinding.isKeyDown()) {
|
||||
int keyCode = keyBinding.getKeyCode();
|
||||
|
||||
if (keyCode < Keyboard.KEYBOARD_SIZE) {
|
||||
KeyBinding.onTick(keyCode < 0 ? keyCode + 100 : keyCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
listeners.forEach(l -> l.onProcessKeyBinds());
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ package baritone.utils;
|
||||
import baritone.Baritone;
|
||||
import baritone.behavior.Behavior;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -67,6 +68,22 @@ public final class InputOverrideHandler extends Behavior implements Helper {
|
||||
inputForceStateMap.put(input.getKeyBinding(), forced);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onProcessKeyBinds() {
|
||||
// Simulate the key being held down this tick
|
||||
for (InputOverrideHandler.Input input : Input.values()) {
|
||||
KeyBinding keyBinding = input.getKeyBinding();
|
||||
|
||||
if (isInputForcedDown(keyBinding) && !keyBinding.isKeyDown()) {
|
||||
int keyCode = keyBinding.getKeyCode();
|
||||
|
||||
if (keyCode < Keyboard.KEYBOARD_SIZE) {
|
||||
KeyBinding.onTick(keyCode < 0 ? keyCode + 100 : keyCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An {@link Enum} representing the possible inputs that we may want to force.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user