Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
coltonk9043 committed Aug 5, 2024
2 parents 977c016 + 2df84b7 commit 1b914b5
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/main/java/net/aoba/interfaces/IHorseBaseEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package net.aoba.interfaces;

public interface IHorseBaseEntity {
void setSaddled(boolean saddled);
}
17 changes: 17 additions & 0 deletions src/main/java/net/aoba/mixin/HorseBaseEntityMixin.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
4 changes: 4 additions & 0 deletions src/main/java/net/aoba/module/ModuleManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -154,6 +156,7 @@ public ModuleManager(List<IAddon> addons) {
addModule(noclip);
addModule(nofall);
addModule(nojumpdelay);
addModule(reverseStep);
addModule(nooverlay);
addModule(noslowdown);
addModule(nuker);
Expand All @@ -168,6 +171,7 @@ public ModuleManager(List<IAddon> addons) {
addModule(sprint);
addModule(step);
addModule(strafe);
addModule(entityControl);
addModule(surround);
addModule(tilebreaker);
addModule(timer);
Expand Down
44 changes: 44 additions & 0 deletions src/main/java/net/aoba/module/modules/movement/EntityControl.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
42 changes: 42 additions & 0 deletions src/main/java/net/aoba/module/modules/movement/ReverseStep.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
3 changes: 2 additions & 1 deletion src/main/resources/aoba.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
"WorldChunkMixin",
"WorldRendererMixin",
"ShulkerBoxBlockMixin",
"HandledScreenMixin"
"HandledScreenMixin",
"HorseBaseEntityMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 1b914b5

Please sign in to comment.