aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/ftbsc
diff options
context:
space:
mode:
author alemi <me@alemi.dev>2023-03-18 22:08:34 +0100
committer alemi <me@alemi.dev>2023-03-18 22:08:34 +0100
commita259fbcc33fd636a4ae416f2f17f7f0a6627f07a (patch)
tree738917bbf3ed62ac618047628586b988a4a40ea5 /src/main/java/ftbsc
parent20e953f15fad4168369316b588db3f510cf6df9e (diff)
feat: crude autowalk mod
Diffstat (limited to 'src/main/java/ftbsc')
-rw-r--r--src/main/java/ftbsc/bscv/modules/motion/AutoWalk.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/main/java/ftbsc/bscv/modules/motion/AutoWalk.java b/src/main/java/ftbsc/bscv/modules/motion/AutoWalk.java
new file mode 100644
index 0000000..d83d3c1
--- /dev/null
+++ b/src/main/java/ftbsc/bscv/modules/motion/AutoWalk.java
@@ -0,0 +1,44 @@
+package ftbsc.bscv.modules.motion;
+
+import com.google.auto.service.AutoService;
+
+import ftbsc.bscv.api.ILoadable;
+import ftbsc.bscv.modules.QuickModule;
+import net.minecraft.client.util.InputMappings;
+import net.minecraftforge.client.settings.IKeyConflictContext;
+import net.minecraftforge.client.settings.KeyConflictContext;
+import net.minecraftforge.event.TickEvent;
+import net.minecraftforge.event.TickEvent.Phase;
+import net.minecraftforge.eventbus.api.SubscribeEvent;
+
+@AutoService(ILoadable.class)
+public class AutoWalk extends QuickModule {
+
+ private IKeyConflictContext previous_ctx;
+
+
+ @Override
+ public void enable() {
+ this.previous_ctx = MC.options.keyUp.getKeyConflictContext();
+ MC.options.keyUp.setKeyConflictContext(KeyConflictContext.UNIVERSAL);
+
+ super.enable();
+ }
+
+ @Override
+ public void disable() {
+ super.disable();
+ if (!InputMappings.isKeyDown(MC.getWindow().getWindow(), MC.options.keyUp.getKey().getValue())) {
+ MC.options.keyUp.setDown(false);
+ }
+ MC.options.keyUp.setKeyConflictContext(this.previous_ctx);
+ }
+
+ @SubscribeEvent
+ public void onTick(TickEvent.ClientTickEvent event) {
+ if (event.phase == Phase.END) return;
+
+ MC.options.keyUp.setDown(true);
+ }
+
+}