From 2df84b7cf8ad6f6b53f078c40b321fb01e30185a Mon Sep 17 00:00:00 2001 From: cvs0 Date: Sun, 4 Aug 2024 01:48:28 -0600 Subject: [PATCH] Some new modules --- .../net/aoba/interfaces/IHorseBaseEntity.java | 5 +++ .../net/aoba/mixin/HorseBaseEntityMixin.java | 17 +++++++ .../java/net/aoba/module/ModuleManager.java | 4 ++ .../modules/movement/EntityControl.java | 44 +++++++++++++++++++ .../module/modules/movement/ReverseStep.java | 42 ++++++++++++++++++ src/main/resources/aoba.mixins.json | 3 +- 6 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 src/main/java/net/aoba/interfaces/IHorseBaseEntity.java create mode 100644 src/main/java/net/aoba/mixin/HorseBaseEntityMixin.java create mode 100644 src/main/java/net/aoba/module/modules/movement/EntityControl.java create mode 100644 src/main/java/net/aoba/module/modules/movement/ReverseStep.java diff --git a/src/main/java/net/aoba/interfaces/IHorseBaseEntity.java b/src/main/java/net/aoba/interfaces/IHorseBaseEntity.java new file mode 100644 index 00000000..ff99ec8d --- /dev/null +++ b/src/main/java/net/aoba/interfaces/IHorseBaseEntity.java @@ -0,0 +1,5 @@ +package net.aoba.interfaces; + +public interface IHorseBaseEntity { + void setSaddled(boolean saddled); +} \ No newline at end of file diff --git a/src/main/java/net/aoba/mixin/HorseBaseEntityMixin.java b/src/main/java/net/aoba/mixin/HorseBaseEntityMixin.java new file mode 100644 index 00000000..35074def --- /dev/null +++ b/src/main/java/net/aoba/mixin/HorseBaseEntityMixin.java @@ -0,0 +1,17 @@ +package net.aoba.mixin; + +import net.aoba.interfaces.IHorseBaseEntity; +import net.minecraft.entity.passive.AbstractHorseEntity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +@Mixin(AbstractHorseEntity.class) +public abstract class HorseBaseEntityMixin implements IHorseBaseEntity { + @Shadow + protected abstract void setHorseFlag(int bitmask, boolean flag); + + @Override + public void setSaddled(boolean saddled) { + setHorseFlag(4, saddled); + } +} \ No newline at end of file diff --git a/src/main/java/net/aoba/module/ModuleManager.java b/src/main/java/net/aoba/module/ModuleManager.java index c0cbda3b..dcfb7b4c 100644 --- a/src/main/java/net/aoba/module/ModuleManager.java +++ b/src/main/java/net/aoba/module/ModuleManager.java @@ -88,6 +88,7 @@ public class ModuleManager implements KeyDownListener { public Module noclip = new Noclip(); public Module nofall = new NoFall(); public Module nojumpdelay = new NoJumpDelay(); + public Module reverseStep = new ReverseStep(); public Module nooverlay = new NoOverlay(); public Module noslowdown = new NoSlowdown(); public Module nuker = new Nuker(); @@ -102,6 +103,7 @@ public class ModuleManager implements KeyDownListener { public Module sprint = new Sprint(); public Module step = new Step(); public Module strafe = new Strafe(); + public Module entityControl = new EntityControl(); public Module surround = new Surround(); public Module tilebreaker = new TileBreaker(); public Module timer = new Timer(); @@ -154,6 +156,7 @@ public ModuleManager(List addons) { addModule(noclip); addModule(nofall); addModule(nojumpdelay); + addModule(reverseStep); addModule(nooverlay); addModule(noslowdown); addModule(nuker); @@ -168,6 +171,7 @@ public ModuleManager(List addons) { addModule(sprint); addModule(step); addModule(strafe); + addModule(entityControl); addModule(surround); addModule(tilebreaker); addModule(timer); diff --git a/src/main/java/net/aoba/module/modules/movement/EntityControl.java b/src/main/java/net/aoba/module/modules/movement/EntityControl.java new file mode 100644 index 00000000..c97d2eb7 --- /dev/null +++ b/src/main/java/net/aoba/module/modules/movement/EntityControl.java @@ -0,0 +1,44 @@ +package net.aoba.module.modules.movement; + +import net.aoba.Aoba; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; +import net.aoba.interfaces.IHorseBaseEntity; +import net.aoba.module.Category; +import net.aoba.module.Module; +import net.minecraft.entity.Entity; +import net.minecraft.entity.passive.AbstractHorseEntity; + +public class EntityControl extends Module implements TickListener { + public EntityControl() { + this.setName("EntityControl"); + this.setDescription("Allows you to control entities without needing a saddle."); + this.setCategory(Category.of("Movement")); + } + + @Override + public void onDisable() { + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); + + for (Entity entity : MC.world.getEntities()) { + if (entity instanceof AbstractHorseEntity) ((IHorseBaseEntity) entity).setSaddled(false); + } + } + + @Override + public void onEnable() { + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); + } + + @Override + public void onToggle() { + + } + + @Override + public void OnUpdate(TickEvent event) { + for (Entity entity : MC.world.getEntities()) { + if (entity instanceof AbstractHorseEntity) ((IHorseBaseEntity) entity).setSaddled(true); + } + } +} diff --git a/src/main/java/net/aoba/module/modules/movement/ReverseStep.java b/src/main/java/net/aoba/module/modules/movement/ReverseStep.java new file mode 100644 index 00000000..45da2467 --- /dev/null +++ b/src/main/java/net/aoba/module/modules/movement/ReverseStep.java @@ -0,0 +1,42 @@ +package net.aoba.module.modules.movement; + +import net.aoba.Aoba; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; +import net.aoba.module.Category; +import net.aoba.module.Module; +import net.aoba.settings.types.KeybindSetting; +import net.minecraft.client.util.InputUtil; +import org.lwjgl.glfw.GLFW; + +public class ReverseStep extends Module implements TickListener { + public ReverseStep() { + super(new KeybindSetting("key.reversestep", "ReverseStep Key", InputUtil.fromKeyCode(GLFW.GLFW_KEY_UNKNOWN, 0))); + + this.setName("ReverseStep"); + this.setCategory(Category.of("Movement")); + this.setDescription("Steps. But in reverse..."); + } + + @Override + public void onDisable() { + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); + } + + @Override + public void onEnable() { + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); + } + + @Override + public void onToggle() { + + } + + @Override + public void OnUpdate(TickEvent event) { + if (MC.player.isOnGround()) { + MC.player.setVelocity(MC.player.getVelocity().x, MC.player.getVelocity().y - 1.0, MC.player.getVelocity().z); + } + } +} diff --git a/src/main/resources/aoba.mixins.json b/src/main/resources/aoba.mixins.json index 636e3556..3b8a0784 100644 --- a/src/main/resources/aoba.mixins.json +++ b/src/main/resources/aoba.mixins.json @@ -57,7 +57,8 @@ "WorldChunkMixin", "WorldRendererMixin", "ShulkerBoxBlockMixin", - "HandledScreenMixin" + "HandledScreenMixin", + "HorseBaseEntityMixin" ], "injectors": { "defaultRequire": 1