diff --git a/src/api/java/baritone/api/utils/input/Input.java b/src/api/java/baritone/api/utils/input/Input.java index 1e8d44b5..c44f3352 100644 --- a/src/api/java/baritone/api/utils/input/Input.java +++ b/src/api/java/baritone/api/utils/input/Input.java @@ -17,15 +17,6 @@ package baritone.api.utils.input; -import net.minecraft.client.Minecraft; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.client.settings.KeyBinding; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.function.Function; - /** * An {@link Enum} representing the inputs that control the player's * behavior. This includes moving, interacting with blocks, jumping, @@ -36,84 +27,45 @@ public enum Input { /** * The move forward input */ - MOVE_FORWARD(s -> s.keyBindForward), + MOVE_FORWARD, /** * The move back input */ - MOVE_BACK(s -> s.keyBindBack), + MOVE_BACK, /** * The move left input */ - MOVE_LEFT(s -> s.keyBindLeft), + MOVE_LEFT, /** * The move right input */ - MOVE_RIGHT(s -> s.keyBindRight), + MOVE_RIGHT, /** * The attack input */ - CLICK_LEFT(s -> s.keyBindAttack), + CLICK_LEFT, /** * The use item input */ - CLICK_RIGHT(s -> s.keyBindUseItem), + CLICK_RIGHT, /** * The jump input */ - JUMP(s -> s.keyBindJump), + JUMP, /** * The sneak input */ - SNEAK(s -> s.keyBindSneak), + SNEAK, /** * The sprint input */ - SPRINT(s -> s.keyBindSprint); - - /** - * Map of {@link KeyBinding} to {@link Input}. Values should be queried through {@link #getInputForBind(KeyBinding)} - */ - private static final Map bindToInputMap = new HashMap<>(); - - /** - * The actual game {@link KeyBinding} being forced. - */ - private final KeyBinding keyBinding; - - Input(Function keyBindingMapper) { - /* - - Here, a Function is used because referring to a static field in this enum for the game instance, - as it was before, wouldn't be possible in an Enum constructor unless the static field was in an - interface that this class implemented. (Helper acted as this interface) I didn't feel like making - an interface with a game instance field just to not have to do this. - - */ - this.keyBinding = keyBindingMapper.apply(Minecraft.getMinecraft().gameSettings); - } - - /** - * @return The actual game {@link KeyBinding} being forced. - */ - public final KeyBinding getKeyBinding() { - return this.keyBinding; - } - - /** - * Finds the {@link Input} constant that is associated with the specified {@link KeyBinding}. - * - * @param binding The {@link KeyBinding} to find the associated {@link Input} for - * @return The {@link Input} associated with the specified {@link KeyBinding} - */ - public static Input getInputForBind(KeyBinding binding) { - return bindToInputMap.computeIfAbsent(binding, b -> Arrays.stream(values()).filter(input -> input.keyBinding == b).findFirst().orElse(null)); - } + SPRINT }