diff options
author | alemi <me@alemi.dev> | 2023-03-18 22:08:56 +0100 |
---|---|---|
committer | alemi <me@alemi.dev> | 2023-03-18 22:08:56 +0100 |
commit | ef1b212fd12e7260c9320259870f7233fd4eb931 (patch) | |
tree | 0c435414a7b2489cd78edcdd74c68448ce3f4730 /src/main | |
parent | a259fbcc33fd636a4ae416f2f17f7f0a6627f07a (diff) |
fix: make GuiMove work with AutoWalk
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/ftbsc/bscv/modules/motion/GuiMove.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/ftbsc/bscv/modules/motion/GuiMove.java b/src/main/java/ftbsc/bscv/modules/motion/GuiMove.java index 4d769a1..6f2da90 100644 --- a/src/main/java/ftbsc/bscv/modules/motion/GuiMove.java +++ b/src/main/java/ftbsc/bscv/modules/motion/GuiMove.java @@ -2,6 +2,7 @@ package ftbsc.bscv.modules.motion; import com.google.auto.service.AutoService; +import ftbsc.bscv.Boscovicino; import ftbsc.bscv.api.ILoadable; import ftbsc.bscv.modules.AbstractModule; import ftbsc.bscv.patches.BackgroundPatch.RenderBackgroundEvent; @@ -29,6 +30,8 @@ public class GuiMove extends AbstractModule { public final ForgeConfigSpec.ConfigValue<Boolean> background; + private AutoWalk autoWalk_mod; + public GuiMove() { super(); @@ -39,6 +42,12 @@ public class GuiMove extends AbstractModule { .build(this); } + @Override + public void enable() { + this.autoWalk_mod = (AutoWalk) Boscovicino.modManager.get(AutoWalk.class); + super.enable(); + } + private boolean isKeyDown(KeyBinding key) { return InputMappings.isKeyDown(MC.getWindow().getWindow(), key.getKey().getValue()); } @@ -63,7 +72,7 @@ public class GuiMove extends AbstractModule { private void forceMovementTick(MovementInput input) { // TODO can we patch to make this always happen instead of duplicating code? - input.up = this.isKeyDown(MC.options.keyUp); + input.up = this.autoWalk_mod.isEnabled() || this.isKeyDown(MC.options.keyUp); input.down = this.isKeyDown(MC.options.keyDown); input.left = this.isKeyDown(MC.options.keyLeft); input.right = this.isKeyDown(MC.options.keyRight); |