diff options
author | alemi <me@alemi.dev> | 2023-03-08 19:37:50 +0100 |
---|---|---|
committer | alemi <me@alemi.dev> | 2023-03-08 19:37:50 +0100 |
commit | 0184889798abdc0e93fa5310958540e3d47fe37a (patch) | |
tree | 158f95c46a09a5ff7c501d078a074a315c8dfa54 | |
parent | fbee15327253169d2545e6c364c8d9a8267b7a5e (diff) |
feat: initial work on GuiMove
-rw-r--r-- | src/main/java/ftbsc/bscv/modules/motion/GuiMove.java | 49 | ||||
-rw-r--r-- | src/main/java/ftbsc/bscv/modules/self/FastInteract.java | 2 |
2 files changed, 50 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 new file mode 100644 index 0000000..9d3bf1c --- /dev/null +++ b/src/main/java/ftbsc/bscv/modules/motion/GuiMove.java @@ -0,0 +1,49 @@ +package ftbsc.bscv.modules.motion; + +import com.google.auto.service.AutoService; + +import ftbsc.bscv.ICommons; +import ftbsc.bscv.api.ILoadable; +import ftbsc.bscv.modules.AbstractModule; +import net.minecraft.client.gui.screen.IngameMenuScreen; +import net.minecraft.client.gui.screen.OptionsScreen; +import net.minecraft.client.gui.screen.OptionsSoundsScreen; +import net.minecraft.client.gui.screen.VideoSettingsScreen; +import net.minecraft.client.gui.screen.inventory.ContainerScreen; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.client.util.InputMappings; +import net.minecraftforge.event.entity.living.LivingEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; + +@AutoService(ILoadable.class) +public class GuiMove extends AbstractModule implements ICommons { + + @SubscribeEvent + public void onPlayerUpdate(LivingEvent.LivingUpdateEvent event) { + if (MC.player == null) return; + if (event.getEntityLiving() != MC.player) return; + + KeyBinding[] keys = { + MC.options.keyUp, + MC.options.keyDown, + MC.options.keyLeft, + MC.options.keyRight, + MC.options.keyJump, + }; + + if ( + MC.screen instanceof ContainerScreen + || MC.screen instanceof OptionsScreen + || MC.screen instanceof VideoSettingsScreen + || MC.screen instanceof OptionsSoundsScreen + || MC.screen instanceof IngameMenuScreen + ) { + for (KeyBinding key : keys) { + boolean state = InputMappings.isKeyDown(MC.getWindow().getWindow(), key.getKey().getValue()); + KeyBinding.set(key.getKey(), state); + key.setDown(state); + } + } + } + +} diff --git a/src/main/java/ftbsc/bscv/modules/self/FastInteract.java b/src/main/java/ftbsc/bscv/modules/self/FastInteract.java index c256e00..9f82b20 100644 --- a/src/main/java/ftbsc/bscv/modules/self/FastInteract.java +++ b/src/main/java/ftbsc/bscv/modules/self/FastInteract.java @@ -20,6 +20,6 @@ public class FastInteract extends QuickModule implements ICommons { public void onTick(TickEvent.ClientTickEvent event) { if (MC == null) return; - MC.rightClickDelay = 0; + MC.rightClickDelay = 0; // ACCESSTRANSFORMER } } |