From eb7e926c4416efef521a019b9e774c33d1a70ce8 Mon Sep 17 00:00:00 2001 From: Colton Kennedy Date: Sat, 26 Aug 2023 19:54:42 -0400 Subject: [PATCH] Implemented event system to simplify module classes and creation. The system is not perfect, but it has worked well so far. --- src/main/java/net/aoba/AobaClient.java | 10 +- .../java/net/aoba/core/settings/Setting.java | 5 - .../aoba/core/settings/SettingManager.java | 5 +- .../java/net/aoba/event/EventManager.java | 55 +++++++++++ .../net/aoba/event/events/AbstractEvent.java | 20 ++++ .../aoba/event/events/MouseScrollEvent.java | 39 ++++++++ .../aoba/event/events/ReceivePacketEvent.java | 33 +++++++ .../net/aoba/event/events/RenderEvent.java | 38 ++++++++ .../aoba/event/events/SendPacketEvent.java | 34 +++++++ .../java/net/aoba/event/events/TickEvent.java | 22 +++++ .../event/listeners/AbstractListener.java | 4 + .../event/listeners/MouseScrollListener.java | 7 ++ .../listeners/ReceivePacketListener.java | 7 ++ .../aoba/event/listeners/RenderListener.java | 7 ++ .../event/listeners/SendPacketListener.java | 7 ++ .../aoba/event/listeners/TickListener.java | 7 ++ .../net/aoba/gui/tabs/AuthCrackerTab.java | 5 + .../java/net/aoba/gui/tabs/OptionsTab.java | 68 +++++++------ .../net/aoba/mixin/ClientConnectionMixin.java | 21 +++- .../net/aoba/mixin/EntityRendererMixin.java | 3 +- .../net/aoba/mixin/MinecraftClientMixin.java | 4 + src/main/java/net/aoba/mixin/MouseMixin.java | 1 - .../net/aoba/mixin/WorldRendererMixin.java | 6 ++ src/main/java/net/aoba/module/Module.java | 11 +-- .../java/net/aoba/module/ModuleManager.java | 33 ++----- .../aoba/module/modules/combat/Aimbot.java | 41 ++++---- .../aoba/module/modules/combat/AntiInvis.java | 22 ----- .../module/modules/combat/AntiKnockback.java | 22 ----- .../module/modules/combat/AutoRespawn.java | 28 ++---- .../aoba/module/modules/combat/AutoSoup.java | 97 ++++++++----------- .../aoba/module/modules/combat/AutoTotem.java | 22 ----- .../aoba/module/modules/combat/Criticals.java | 42 ++------ .../module/modules/combat/CrystalAura.java | 29 ++---- .../aoba/module/modules/combat/KillAura.java | 31 ++---- .../aoba/module/modules/combat/Nametags.java | 24 ----- .../aoba/module/modules/combat/NoOverlay.java | 22 ----- .../net/aoba/module/modules/combat/Reach.java | 24 ----- .../module/modules/combat/TriggerBot.java | 46 ++++----- .../aoba/module/modules/misc/AntiCactus.java | 18 ---- .../net/aoba/module/modules/misc/AutoEat.java | 38 +++----- .../aoba/module/modules/misc/AutoFish.java | 37 +++---- .../aoba/module/modules/misc/AutoWalk.java | 29 ++---- .../aoba/module/modules/misc/FastBreak.java | 19 ---- .../aoba/module/modules/misc/FastPlace.java | 28 ++---- .../net/aoba/module/modules/misc/Timer.java | 20 +--- .../net/aoba/module/modules/movement/Fly.java | 29 ++---- .../aoba/module/modules/movement/Freecam.java | 37 +++---- .../aoba/module/modules/movement/Glide.java | 27 ++---- .../aoba/module/modules/movement/Jesus.java | 38 +++----- .../aoba/module/modules/movement/NoFall.java | 29 ++---- .../module/modules/movement/NoSlowdown.java | 29 ++---- .../aoba/module/modules/movement/Noclip.java | 27 ++---- .../module/modules/movement/Safewalk.java | 28 ++---- .../aoba/module/modules/movement/Sneak.java | 28 ++---- .../aoba/module/modules/movement/Spider.java | 27 ++---- .../aoba/module/modules/movement/Sprint.java | 29 ++---- .../aoba/module/modules/movement/Step.java | 24 ----- .../module/modules/render/Breadcrumbs.java | 43 ++++---- .../aoba/module/modules/render/ChestESP.java | 50 ++++------ .../aoba/module/modules/render/EntityESP.java | 49 ++++------ .../module/modules/render/Fullbright.java | 25 ----- .../aoba/module/modules/render/ItemESP.java | 32 ++---- .../net/aoba/module/modules/render/POV.java | 62 +++++------- .../aoba/module/modules/render/PlayerESP.java | 35 ++----- .../module/modules/render/SpawnerESP.java | 32 ++---- .../aoba/module/modules/render/Tracer.java | 32 ++---- .../module/modules/render/Trajectory.java | 40 +++----- .../net/aoba/module/modules/render/XRay.java | 24 ----- .../aoba/module/modules/world/AutoFarm.java | 26 ++--- .../aoba/module/modules/world/AutoSign.java | 23 ----- .../net/aoba/module/modules/world/Nuker.java | 31 +++--- .../module/modules/world/TileBreaker.java | 92 ++++++++---------- 72 files changed, 801 insertions(+), 1238 deletions(-) create mode 100644 src/main/java/net/aoba/event/EventManager.java create mode 100644 src/main/java/net/aoba/event/events/AbstractEvent.java create mode 100644 src/main/java/net/aoba/event/events/MouseScrollEvent.java create mode 100644 src/main/java/net/aoba/event/events/ReceivePacketEvent.java create mode 100644 src/main/java/net/aoba/event/events/RenderEvent.java create mode 100644 src/main/java/net/aoba/event/events/SendPacketEvent.java create mode 100644 src/main/java/net/aoba/event/events/TickEvent.java create mode 100644 src/main/java/net/aoba/event/listeners/AbstractListener.java create mode 100644 src/main/java/net/aoba/event/listeners/MouseScrollListener.java create mode 100644 src/main/java/net/aoba/event/listeners/ReceivePacketListener.java create mode 100644 src/main/java/net/aoba/event/listeners/RenderListener.java create mode 100644 src/main/java/net/aoba/event/listeners/SendPacketListener.java create mode 100644 src/main/java/net/aoba/event/listeners/TickListener.java diff --git a/src/main/java/net/aoba/AobaClient.java b/src/main/java/net/aoba/AobaClient.java index 647bdb94..33ca0d41 100644 --- a/src/main/java/net/aoba/AobaClient.java +++ b/src/main/java/net/aoba/AobaClient.java @@ -21,9 +21,12 @@ */ package net.aoba; +import java.util.EventListener; + import net.aoba.altmanager.AltManager; import net.aoba.cmd.CommandManager; import net.aoba.core.settings.SettingManager; +import net.aoba.event.EventManager; import net.aoba.gui.HudManager; import net.aoba.interfaces.IMinecraftClient; import net.aoba.misc.RenderUtils; @@ -48,6 +51,8 @@ public class AobaClient { public SettingManager settingManager; public RenderUtils renderUtils; + public EventManager eventManager; + private boolean ghostMode; /** @@ -73,7 +78,10 @@ public void Initialize() { System.out.println("[Aoba] Loading Alts"); altManager = new AltManager(); System.out.println("[Aoba] Aoba-chan initialized and ready to play!"); - + + eventManager = new EventManager(); + + SettingManager.loadSettings("config_category", settingManager.config_category); SettingManager.loadSettings("modules_category", settingManager.modules_category); SettingManager.loadSettings("hidden_category", settingManager.hidden_category); diff --git a/src/main/java/net/aoba/core/settings/Setting.java b/src/main/java/net/aoba/core/settings/Setting.java index 31d75284..ac2218f2 100644 --- a/src/main/java/net/aoba/core/settings/Setting.java +++ b/src/main/java/net/aoba/core/settings/Setting.java @@ -1,8 +1,3 @@ -/* -Starts with an O as to not be confused with the legacy setting -Partially skidded from balkan hack -*/ - package net.aoba.core.settings; import java.util.function.Consumer; diff --git a/src/main/java/net/aoba/core/settings/SettingManager.java b/src/main/java/net/aoba/core/settings/SettingManager.java index 640f1335..822bd7c0 100644 --- a/src/main/java/net/aoba/core/settings/SettingManager.java +++ b/src/main/java/net/aoba/core/settings/SettingManager.java @@ -38,7 +38,7 @@ public static Setting get_setting_in_category (String p_setting_id, List setting_list) { String value_x = config.getProperty(setting.ID + "_x", null); String value_y = config.getProperty(setting.ID + "_y", null); if (value_x == null || value_y == null) break; - /* if (DEBUG_STUFF) */ System.out.println(setting.displayName + " " + ((Vector2)setting.value).x + " " + ((Vector2)setting.value).y + " " + value_x + " " + value_y); setting.setValue(new Vector2(Float.parseFloat(value_x), Float.parseFloat(value_y))); } } @@ -113,7 +112,7 @@ public static void loadSettings(String name, List setting_list) { } public enum SettingCategories { - CONFGI, + CONFIG, MODULES, HIDDEN } diff --git a/src/main/java/net/aoba/event/EventManager.java b/src/main/java/net/aoba/event/EventManager.java new file mode 100644 index 00000000..7f5d912d --- /dev/null +++ b/src/main/java/net/aoba/event/EventManager.java @@ -0,0 +1,55 @@ +package net.aoba.event; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import net.aoba.event.events.AbstractEvent; +import net.aoba.event.listeners.AbstractListener; + +public class EventManager { + + private final HashMap, ArrayList> listeners; + + public EventManager() { + listeners = new HashMap, ArrayList>(); + } + + @SuppressWarnings("unchecked") + public void AddListener(Class object, AbstractListener listener) { + try { + ArrayList listOfListeners = listeners.get(object); + if(listOfListeners == null) + { + listOfListeners = new ArrayList<>(Arrays.asList(listener)); + listeners.put((Class) object, listOfListeners); + } + listOfListeners.add(listener); + }catch(Exception e) { + System.out.println("Issue adding listener: " + object.getTypeName() + "..."); + e.printStackTrace(); + } + } + + public void RemoveListener(Class object, AbstractListener listener) { + try { + ArrayList listOfListeners = listeners.get(object); + if(listOfListeners != null) + { + listOfListeners.remove(listener); + } + }catch(Exception e) { + System.out.println("Issue removing listener: " + object.getTypeName() + "..."); + e.printStackTrace(); + } + } + + public void Fire(AbstractEvent event) { + ArrayList listOfListeners = listeners.get(event.GetListenerClassType()); + + if(listOfListeners == null) { + return; + } + + event.Fire(listOfListeners); + } +} diff --git a/src/main/java/net/aoba/event/events/AbstractEvent.java b/src/main/java/net/aoba/event/events/AbstractEvent.java new file mode 100644 index 00000000..151da5da --- /dev/null +++ b/src/main/java/net/aoba/event/events/AbstractEvent.java @@ -0,0 +1,20 @@ +package net.aoba.event.events; + +import java.util.ArrayList; + +import net.aoba.event.listeners.AbstractListener; + +public abstract class AbstractEvent { + boolean isCancelled; + + public AbstractEvent() { + isCancelled = false; + } + + public boolean IsCancelled() { + return isCancelled; + } + + public abstract void Fire(ArrayList listeners); + public abstract Class GetListenerClassType(); +} diff --git a/src/main/java/net/aoba/event/events/MouseScrollEvent.java b/src/main/java/net/aoba/event/events/MouseScrollEvent.java new file mode 100644 index 00000000..d97ef678 --- /dev/null +++ b/src/main/java/net/aoba/event/events/MouseScrollEvent.java @@ -0,0 +1,39 @@ +package net.aoba.event.events; + +import java.util.ArrayList; + +import net.aoba.event.listeners.AbstractListener; +import net.aoba.event.listeners.MouseScrollListener; + +public class MouseScrollEvent extends AbstractEvent{ + private float horizontal; + private float vertical; + + public MouseScrollEvent(float horizontal, float vertical) { + super(); + this.horizontal = horizontal; + this.vertical = vertical; + } + + public float GetVertical() { + return vertical; + } + + public float GetHorizontal() { + return horizontal; + } + + @Override + public void Fire(ArrayList listeners) { + for(AbstractListener listener : listeners) { + MouseScrollListener mouseScrollListener = (MouseScrollListener) listener; + mouseScrollListener.OnMouseScroll(this); + } + } + + @SuppressWarnings("unchecked") + @Override + public Class GetListenerClassType() { + return MouseScrollListener.class; + } +} \ No newline at end of file diff --git a/src/main/java/net/aoba/event/events/ReceivePacketEvent.java b/src/main/java/net/aoba/event/events/ReceivePacketEvent.java new file mode 100644 index 00000000..2c131933 --- /dev/null +++ b/src/main/java/net/aoba/event/events/ReceivePacketEvent.java @@ -0,0 +1,33 @@ +package net.aoba.event.events; + +import java.util.ArrayList; +import net.aoba.event.listeners.AbstractListener; +import net.aoba.event.listeners.ReceivePacketListener; +import net.minecraft.network.packet.Packet; + +public class ReceivePacketEvent extends AbstractEvent { + + private Packet packet; + + public Packet GetPacket(){ + return packet; + } + + public ReceivePacketEvent(Packet packet) { + this.packet = packet; + } + + @Override + public void Fire(ArrayList listeners) { + for(AbstractListener listener : listeners) { + ReceivePacketListener readPacketListener = (ReceivePacketListener) listener; + readPacketListener.OnReceivePacket(this); + } + } + + @SuppressWarnings("unchecked") + @Override + public Class GetListenerClassType() { + return ReceivePacketListener.class; + } +} diff --git a/src/main/java/net/aoba/event/events/RenderEvent.java b/src/main/java/net/aoba/event/events/RenderEvent.java new file mode 100644 index 00000000..85ed018c --- /dev/null +++ b/src/main/java/net/aoba/event/events/RenderEvent.java @@ -0,0 +1,38 @@ +package net.aoba.event.events; + +import java.util.ArrayList; + +import net.aoba.event.listeners.AbstractListener; +import net.aoba.event.listeners.RenderListener; +import net.minecraft.client.util.math.MatrixStack; + +public class RenderEvent extends AbstractEvent { + MatrixStack matrixStack; + float partialTicks; + + public MatrixStack GetMatrixStack() { + return matrixStack; + } + public float GetPartialTicks() { + return partialTicks; + } + + public RenderEvent(MatrixStack matrixStack, float partialTicks) { + this.matrixStack = matrixStack; + this.partialTicks = partialTicks; + } + + @Override + public void Fire(ArrayList listeners) { + for(AbstractListener listener : listeners) { + RenderListener renderListener = (RenderListener) listener; + renderListener.OnRender(this); + } + } + + @SuppressWarnings("unchecked") + @Override + public Class GetListenerClassType() { + return RenderListener.class; + } +} diff --git a/src/main/java/net/aoba/event/events/SendPacketEvent.java b/src/main/java/net/aoba/event/events/SendPacketEvent.java new file mode 100644 index 00000000..fff84064 --- /dev/null +++ b/src/main/java/net/aoba/event/events/SendPacketEvent.java @@ -0,0 +1,34 @@ +package net.aoba.event.events; + +import java.util.ArrayList; + +import net.aoba.event.listeners.AbstractListener; +import net.aoba.event.listeners.SendPacketListener; +import net.minecraft.network.packet.Packet; + +public class SendPacketEvent extends AbstractEvent { + + private Packet packet; + + public SendPacketEvent(Packet packet) { + this.packet = packet; + } + + public Packet GetPacket(){ + return packet; + } + + @Override + public void Fire(ArrayList listeners) { + for(AbstractListener listener : listeners) { + SendPacketListener sendPacketListener = (SendPacketListener) listener; + sendPacketListener.OnSendPacket(this); + } + } + + @SuppressWarnings("unchecked") + @Override + public Class GetListenerClassType() { + return SendPacketListener.class; + } +} diff --git a/src/main/java/net/aoba/event/events/TickEvent.java b/src/main/java/net/aoba/event/events/TickEvent.java new file mode 100644 index 00000000..8192e787 --- /dev/null +++ b/src/main/java/net/aoba/event/events/TickEvent.java @@ -0,0 +1,22 @@ +package net.aoba.event.events; + +import java.util.ArrayList; + +import net.aoba.event.listeners.AbstractListener; +import net.aoba.event.listeners.TickListener; + +public class TickEvent extends AbstractEvent { + @Override + public void Fire(ArrayList listeners) { + for(AbstractListener listener : listeners) { + TickListener tickListener = (TickListener) listener; + tickListener.OnUpdate(this); + } + } + + @SuppressWarnings("unchecked") + @Override + public Class GetListenerClassType() { + return TickListener.class; + } +} \ No newline at end of file diff --git a/src/main/java/net/aoba/event/listeners/AbstractListener.java b/src/main/java/net/aoba/event/listeners/AbstractListener.java new file mode 100644 index 00000000..ae53ed22 --- /dev/null +++ b/src/main/java/net/aoba/event/listeners/AbstractListener.java @@ -0,0 +1,4 @@ +package net.aoba.event.listeners; + +public interface AbstractListener {} + diff --git a/src/main/java/net/aoba/event/listeners/MouseScrollListener.java b/src/main/java/net/aoba/event/listeners/MouseScrollListener.java new file mode 100644 index 00000000..bed7f35e --- /dev/null +++ b/src/main/java/net/aoba/event/listeners/MouseScrollListener.java @@ -0,0 +1,7 @@ +package net.aoba.event.listeners; + +import net.aoba.event.events.MouseScrollEvent; + +public interface MouseScrollListener extends AbstractListener { + public abstract void OnMouseScroll(MouseScrollEvent event); +} diff --git a/src/main/java/net/aoba/event/listeners/ReceivePacketListener.java b/src/main/java/net/aoba/event/listeners/ReceivePacketListener.java new file mode 100644 index 00000000..94a97ca7 --- /dev/null +++ b/src/main/java/net/aoba/event/listeners/ReceivePacketListener.java @@ -0,0 +1,7 @@ +package net.aoba.event.listeners; + +import net.aoba.event.events.ReceivePacketEvent; + +public interface ReceivePacketListener extends AbstractListener { + public abstract void OnReceivePacket(ReceivePacketEvent readPacketEvent); +} diff --git a/src/main/java/net/aoba/event/listeners/RenderListener.java b/src/main/java/net/aoba/event/listeners/RenderListener.java new file mode 100644 index 00000000..dbfa1f48 --- /dev/null +++ b/src/main/java/net/aoba/event/listeners/RenderListener.java @@ -0,0 +1,7 @@ +package net.aoba.event.listeners; + +import net.aoba.event.events.RenderEvent; + +public interface RenderListener extends AbstractListener { + public abstract void OnRender(RenderEvent event); +} diff --git a/src/main/java/net/aoba/event/listeners/SendPacketListener.java b/src/main/java/net/aoba/event/listeners/SendPacketListener.java new file mode 100644 index 00000000..a20ec44d --- /dev/null +++ b/src/main/java/net/aoba/event/listeners/SendPacketListener.java @@ -0,0 +1,7 @@ +package net.aoba.event.listeners; + +import net.aoba.event.events.SendPacketEvent; + +public interface SendPacketListener extends AbstractListener { + public abstract void OnSendPacket(SendPacketEvent event); +} diff --git a/src/main/java/net/aoba/event/listeners/TickListener.java b/src/main/java/net/aoba/event/listeners/TickListener.java new file mode 100644 index 00000000..794c20c8 --- /dev/null +++ b/src/main/java/net/aoba/event/listeners/TickListener.java @@ -0,0 +1,7 @@ +package net.aoba.event.listeners; + +import net.aoba.event.events.TickEvent; + +public interface TickListener extends AbstractListener { + public abstract void OnUpdate(TickEvent event); +} \ No newline at end of file diff --git a/src/main/java/net/aoba/gui/tabs/AuthCrackerTab.java b/src/main/java/net/aoba/gui/tabs/AuthCrackerTab.java index 7e7514de..36e71dd2 100644 --- a/src/main/java/net/aoba/gui/tabs/AuthCrackerTab.java +++ b/src/main/java/net/aoba/gui/tabs/AuthCrackerTab.java @@ -26,10 +26,15 @@ public class AuthCrackerTab extends ClickGuiTab { public AuthCrackerTab(String title, int x, int y){ super(title, x, y, false); + this.width = 360.0f; + + this.information = new StringComponent("This panel can be used to break Auth passwords used in cracked servers.", this); this.addChild(information); + + this.delaySlider = new SliderComponent(this, delay); this.addChild(delaySlider); diff --git a/src/main/java/net/aoba/gui/tabs/OptionsTab.java b/src/main/java/net/aoba/gui/tabs/OptionsTab.java index 6a76b60b..342c7949 100644 --- a/src/main/java/net/aoba/gui/tabs/OptionsTab.java +++ b/src/main/java/net/aoba/gui/tabs/OptionsTab.java @@ -1,38 +1,52 @@ package net.aoba.gui.tabs; -import net.aoba.core.settings.types.BooleanSetting; -import net.aoba.core.settings.types.DoubleSetting; -import net.aoba.gui.tabs.components.CheckboxComponent; -import net.aoba.gui.tabs.components.SliderComponent; -import net.aoba.gui.tabs.components.StringComponent; +import java.util.ArrayList; +import net.aoba.Aoba; +import net.aoba.gui.Color; +import net.aoba.gui.hud.AbstractHud; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.util.Window; +import net.minecraft.client.util.math.MatrixStack; +import net.aoba.module.Module; -public class OptionsTab extends ClickGuiTab { +public class OptionsTab extends AbstractHud { - private StringComponent uiSettingsString = new StringComponent("UI Settings", this, true); - private SliderComponent hueSlider; - private CheckboxComponent rainbowBox; - private SliderComponent effectSpeed; - private CheckboxComponent armorHud; - - public OptionsTab(String title, int x, int y, DoubleSetting hue, BooleanSetting rainbow, BooleanSetting ah, DoubleSetting es) { - super(title, x, y, false); - this.setWidth(180); - this.addChild(uiSettingsString); - this.hueSlider = new SliderComponent( this, hue); - this.addChild(hueSlider); - this.rainbowBox = new CheckboxComponent(this, rainbow); - this.addChild(rainbowBox); - this.effectSpeed = new SliderComponent(this, es); - this.addChild(effectSpeed); - this.armorHud = new CheckboxComponent(this, ah); - this.addChild(armorHud); + int visibleScrollElements; + int currentScroll; + + public OptionsTab() { + super("Options", 40, 220, 100, 100); + + } @Override - public void preupdate() { + public void update(double mouseX, double mouseY, boolean mouseClicked) { + Window window = mc.getWindow(); + this.setWidth(window.getWidth() - 240); + this.setHeight(window.getHeight() - 240); + + visibleScrollElements = (int) ((this.height - 30) / 30); } - public void setHueSliderPosition(float position) { - this.hueSlider.setSliderPosition(position); + @Override + public void draw(DrawContext drawContext, float partialTicks, Color color) { + MatrixStack matrixStack = drawContext.getMatrices(); + + System.out.println("X: " + this.x + ", Y: " + this.y); + + renderUtils.drawRoundedBox(matrixStack, x, y, width, height, 6, new Color(30,30,30), 0.4f); + renderUtils.drawRoundedOutline(matrixStack, x, y, width, height, 6, new Color(0,0,0), 0.8f); + + renderUtils.drawLine(matrixStack, x + 480, y, x + 480, y + height, new Color(0,0,0), 0.8f); + + ArrayList modules = Aoba.getInstance().moduleManager.modules; + + int yHeight = 30; + for(int i = currentScroll; i < Math.min(modules.size(), visibleScrollElements); i++) { + Module module = modules.get(i); + renderUtils.drawString(drawContext, module.getName(), this.x + 10, this.y + yHeight, color); + yHeight += 30; + } } } diff --git a/src/main/java/net/aoba/mixin/ClientConnectionMixin.java b/src/main/java/net/aoba/mixin/ClientConnectionMixin.java index 64484d1d..d0e970aa 100644 --- a/src/main/java/net/aoba/mixin/ClientConnectionMixin.java +++ b/src/main/java/net/aoba/mixin/ClientConnectionMixin.java @@ -1,14 +1,18 @@ package net.aoba.mixin; +import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import io.netty.channel.ChannelHandlerContext; import net.aoba.Aoba; +import net.aoba.event.events.ReceivePacketEvent; +import net.aoba.event.events.SendPacketEvent; import net.aoba.misc.FakePlayerEntity; import net.aoba.module.modules.movement.Freecam; import net.minecraft.network.ClientConnection; +import net.minecraft.network.PacketCallbacks; import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket; @@ -17,7 +21,11 @@ public class ClientConnectionMixin { @Inject(at = { @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;handlePacket(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;)V", ordinal = 0) }, method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/packet/Packet;)V", cancellable = true) protected void onChannelRead(ChannelHandlerContext channelHandlerContext, Packet packet, CallbackInfo ci) { - Aoba.getInstance().moduleManager.recievePacket(packet); + + ReceivePacketEvent event = new ReceivePacketEvent(packet); + Aoba.getInstance().eventManager.Fire(event); + + //Aoba.getInstance().moduleManager.recievePacket(packet); if(Aoba.getInstance().moduleManager.freecam.getState()){ if(packet instanceof PlayerPositionLookS2CPacket) { PlayerPositionLookS2CPacket convertedPacket = (PlayerPositionLookS2CPacket)packet; @@ -30,4 +38,15 @@ protected void onChannelRead(ChannelHandlerContext channelHandlerContext, Packet } } } + + @Inject(at = @At("HEAD"), method = "send(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/PacketCallbacks;)V", cancellable = true) + private void onSend(Packet packet, @Nullable PacketCallbacks callback, CallbackInfo ci) + { + SendPacketEvent event = new SendPacketEvent(packet); + Aoba.getInstance().eventManager.Fire(event); + + if(event.IsCancelled()) { + ci.cancel(); + } + } } diff --git a/src/main/java/net/aoba/mixin/EntityRendererMixin.java b/src/main/java/net/aoba/mixin/EntityRendererMixin.java index 0544a3cc..6f0cdbd8 100644 --- a/src/main/java/net/aoba/mixin/EntityRendererMixin.java +++ b/src/main/java/net/aoba/mixin/EntityRendererMixin.java @@ -23,13 +23,12 @@ @Mixin(EntityRenderer.class) public abstract class EntityRendererMixin { - @Shadow @Final protected EntityRenderDispatcher dispatcher; @Inject(at = @At(value = "HEAD"), - method = "renderLabelIfPresent(Lnet/minecraft/entity/Entity;Lnet/minecraft/text/Text;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILorg/spongepowered/asm/mixin/injection/callback/CallbackInfo;)V ", + method = "renderLabelIfPresent(Lnet/minecraft/entity/Entity;Lnet/minecraft/text/Text;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", cancellable=true) protected void onRenderLabelIfPresent(T entity, Text text, diff --git a/src/main/java/net/aoba/mixin/MinecraftClientMixin.java b/src/main/java/net/aoba/mixin/MinecraftClientMixin.java index 9974a9a3..e3946062 100644 --- a/src/main/java/net/aoba/mixin/MinecraftClientMixin.java +++ b/src/main/java/net/aoba/mixin/MinecraftClientMixin.java @@ -1,6 +1,7 @@ package net.aoba.mixin; import net.aoba.Aoba; +import net.aoba.event.events.TickEvent; import net.aoba.interfaces.IMinecraftClient; import net.minecraft.client.MinecraftClient; import net.minecraft.client.util.Session; @@ -41,6 +42,9 @@ public void setSession(Session session) { @Inject(at = @At("TAIL"), method = "tick()V") public void tick(CallbackInfo info) { if (this.world != null) { + TickEvent updateEvent = new TickEvent(); + Aoba.getInstance().eventManager.Fire(updateEvent); + Aoba.getInstance().update(); } } diff --git a/src/main/java/net/aoba/mixin/MouseMixin.java b/src/main/java/net/aoba/mixin/MouseMixin.java index f12efb5d..c091b91e 100644 --- a/src/main/java/net/aoba/mixin/MouseMixin.java +++ b/src/main/java/net/aoba/mixin/MouseMixin.java @@ -15,5 +15,4 @@ private void onLockCursor(CallbackInfo ci) { if(Aoba.getInstance().hudManager.isClickGuiOpen()) ci.cancel(); } - } \ No newline at end of file diff --git a/src/main/java/net/aoba/mixin/WorldRendererMixin.java b/src/main/java/net/aoba/mixin/WorldRendererMixin.java index 1710134d..e511886a 100644 --- a/src/main/java/net/aoba/mixin/WorldRendererMixin.java +++ b/src/main/java/net/aoba/mixin/WorldRendererMixin.java @@ -7,6 +7,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import net.aoba.Aoba; +import net.aoba.event.events.RenderEvent; import net.minecraft.client.render.Camera; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.LightmapTextureManager; @@ -20,6 +21,11 @@ public class WorldRendererMixin { private void onRenderWorld(MatrixStack matrixStack, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, CallbackInfo info) { + + // TODO: Per Module rendering. + //RenderEvent event = new RenderEvent(matrixStack, tickDelta); + //Aoba.getInstance().eventManager.Fire(event); + Aoba.getInstance().moduleManager.render(matrixStack); } diff --git a/src/main/java/net/aoba/module/Module.java b/src/main/java/net/aoba/module/Module.java index 58fe4323..78f7e444 100644 --- a/src/main/java/net/aoba/module/Module.java +++ b/src/main/java/net/aoba/module/Module.java @@ -45,8 +45,8 @@ public abstract class Module { private List settings = new ArrayList(); - protected static final MinecraftClient MC = AobaClient.MC; - protected static final IMinecraftClient IMC = AobaClient.IMC; + protected final MinecraftClient MC = AobaClient.MC; + protected final IMinecraftClient IMC = AobaClient.IMC; public String getName() { return this.name; @@ -124,13 +124,6 @@ public boolean hasSettings() { public abstract void onEnable(); public abstract void onToggle(); - - public abstract void onUpdate(); - - public abstract void onRender(MatrixStack matrixStack, float partialTicks); - - public abstract void onSendPacket(Packet packet); - public abstract void onReceivePacket(Packet packet); public void toggle() { if(this.state) { diff --git a/src/main/java/net/aoba/module/ModuleManager.java b/src/main/java/net/aoba/module/ModuleManager.java index c6d4d4fc..f077ecbf 100644 --- a/src/main/java/net/aoba/module/ModuleManager.java +++ b/src/main/java/net/aoba/module/ModuleManager.java @@ -26,8 +26,8 @@ import net.aoba.Aoba; import net.aoba.core.settings.Setting; import net.aoba.core.settings.SettingManager; +import net.aoba.event.events.RenderEvent; import org.lwjgl.opengl.GL11; - import net.aoba.misc.RenderUtils; import net.aoba.module.modules.combat.*; import net.aoba.module.modules.misc.*; @@ -36,7 +36,6 @@ import net.aoba.module.modules.world.*; import net.minecraft.client.MinecraftClient; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; public class ModuleManager { public ArrayList modules = new ArrayList(); @@ -146,14 +145,13 @@ public ModuleManager() { } public void update() { + + for(Module module : modules) { if(module.getBind().wasPressed()) { module.toggle(); module.getBind().setPressed(false); } - if(module.getState()) { - module.onUpdate(); - } } } @@ -168,33 +166,16 @@ public void render(MatrixStack matrixStack) { matrixStack.push(); RenderUtils.applyRenderOffset(matrixStack); - for(Module module : modules) { - if(module.getState()) { - module.onRender(matrixStack, MinecraftClient.getInstance().getTickDelta()); - } - } + + RenderEvent renderEvent = new RenderEvent(matrixStack, MinecraftClient.getInstance().getTickDelta()); + Aoba.getInstance().eventManager.Fire(renderEvent); + matrixStack.pop(); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); } - public void sendPacket(Packet packet) { - for(Module module : modules) { - if(module.getState()) { - module.onSendPacket(packet); - } - } - } - - public void recievePacket(Packet packet) { - for(Module module : modules) { - if(module.getState()) { - module.onReceivePacket(packet); - } - } - } - public void addModule(Module module) { modules.add(module); } diff --git a/src/main/java/net/aoba/module/modules/combat/Aimbot.java b/src/main/java/net/aoba/module/modules/combat/Aimbot.java index 05d233fe..2d798787 100644 --- a/src/main/java/net/aoba/module/modules/combat/Aimbot.java +++ b/src/main/java/net/aoba/module/modules/combat/Aimbot.java @@ -23,17 +23,20 @@ import org.lwjgl.glfw.GLFW; +import net.aoba.Aoba; import net.aoba.core.settings.types.BooleanSetting; +import net.aoba.event.events.RenderEvent; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.RenderListener; +import net.aoba.event.listeners.TickListener; import net.aoba.module.Module; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.command.argument.EntityAnchorArgumentType.EntityAnchor; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; -import net.minecraft.network.packet.Packet; -public class Aimbot extends Module { +public class Aimbot extends Module implements RenderListener, TickListener { private LivingEntity temp = null; @@ -56,22 +59,29 @@ public Aimbot() { @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(RenderListener.class, this); + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(RenderListener.class, this); + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override public void onToggle() { } - @Override - public void onUpdate() { + public void OnRender(RenderEvent event) { + if (temp != null) { + MC.player.lookAt(EntityAnchor.EYES, temp.getEyePos()); + } + } + @Override + public void OnUpdate(TickEvent event) { if (this.targetPlayers.getValue()) { if (MC.world.getPlayers().size() == 2) { temp = MC.world.getPlayers().get(1); @@ -104,21 +114,4 @@ public void onUpdate() { temp = tempEntity; } } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - if (temp != null) { - MC.player.lookAt(EntityAnchor.EYES, temp.getEyePos()); - } - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - } } \ No newline at end of file diff --git a/src/main/java/net/aoba/module/modules/combat/AntiInvis.java b/src/main/java/net/aoba/module/modules/combat/AntiInvis.java index 16fa0a57..22e75c92 100644 --- a/src/main/java/net/aoba/module/modules/combat/AntiInvis.java +++ b/src/main/java/net/aoba/module/modules/combat/AntiInvis.java @@ -24,8 +24,6 @@ import org.lwjgl.glfw.GLFW; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; public class AntiInvis extends Module { @@ -51,24 +49,4 @@ public void onEnable() { public void onToggle() { } - - @Override - public void onUpdate() { - - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - } } \ No newline at end of file diff --git a/src/main/java/net/aoba/module/modules/combat/AntiKnockback.java b/src/main/java/net/aoba/module/modules/combat/AntiKnockback.java index 3e452dfe..332d040d 100644 --- a/src/main/java/net/aoba/module/modules/combat/AntiKnockback.java +++ b/src/main/java/net/aoba/module/modules/combat/AntiKnockback.java @@ -24,8 +24,6 @@ import org.lwjgl.glfw.GLFW; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; public class AntiKnockback extends Module { @@ -50,24 +48,4 @@ public void onEnable() { public void onToggle() { } - - @Override - public void onUpdate() { - - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - } } \ No newline at end of file diff --git a/src/main/java/net/aoba/module/modules/combat/AutoRespawn.java b/src/main/java/net/aoba/module/modules/combat/AutoRespawn.java index 90656fa2..0b821b65 100644 --- a/src/main/java/net/aoba/module/modules/combat/AutoRespawn.java +++ b/src/main/java/net/aoba/module/modules/combat/AutoRespawn.java @@ -22,14 +22,16 @@ package net.aoba.module.modules.combat; import org.lwjgl.glfw.GLFW; +import net.aoba.Aoba; +import net.aoba.event.events.ReceivePacketEvent; +import net.aoba.event.listeners.ReceivePacketListener; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.c2s.play.ClientStatusC2SPacket; import net.minecraft.network.packet.s2c.play.HealthUpdateS2CPacket; -public class AutoRespawn extends Module{ +public class AutoRespawn extends Module implements ReceivePacketListener { public AutoRespawn() { this.setName("AutoRespawn"); @@ -40,36 +42,22 @@ public AutoRespawn() { @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(ReceivePacketListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(ReceivePacketListener.class, this); } @Override public void onToggle() { - } - - @Override - public void onUpdate() { - - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - } @Override - public void onReceivePacket(Packet packet) { + public void OnReceivePacket(ReceivePacketEvent readPacketEvent) { + Packet packet = readPacketEvent.GetPacket(); if(packet instanceof HealthUpdateS2CPacket) { HealthUpdateS2CPacket healthPacket = (HealthUpdateS2CPacket)packet; if (healthPacket.getHealth() > 0.0F) diff --git a/src/main/java/net/aoba/module/modules/combat/AutoSoup.java b/src/main/java/net/aoba/module/modules/combat/AutoSoup.java index d454bd16..bcfd6017 100644 --- a/src/main/java/net/aoba/module/modules/combat/AutoSoup.java +++ b/src/main/java/net/aoba/module/modules/combat/AutoSoup.java @@ -22,21 +22,21 @@ package net.aoba.module.modules.combat; import org.lwjgl.glfw.GLFW; - +import net.aoba.Aoba; import net.aoba.core.settings.types.FloatSetting; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.item.StewItem; -import net.minecraft.network.packet.Packet; import net.minecraft.screen.slot.SlotActionType; import net.minecraft.util.Hand; -public class AutoSoup extends Module { +public class AutoSoup extends Module implements TickListener { private FloatSetting health; @@ -54,12 +54,12 @@ public AutoSoup() { @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override @@ -67,43 +67,6 @@ public void onToggle() { } - @Override - public void onUpdate() { - // If the players HP is below the given threshold. - if(MC.player.getHealth() < health.getValue()) { - - // Find the first item in the hotbar that is a Stew item. - int foodSlot= -1; - for(int i = 0; i< PlayerInventory.getHotbarSize(); i++) { - Item item = MC.player.getInventory().getStack(i).getItem(); - - if(item instanceof StewItem) { - foodSlot = i; - break; - } - } - - // If a Stew item was found, switch to it and use it. - if(foodSlot >= 0) { - previousSlot = MC.player.getInventory().selectedSlot; - - MC.player.getInventory().selectedSlot = foodSlot; - MC.options.useKey.setPressed(true); - MC.interactionManager.interactItem(MC.player, Hand.MAIN_HAND); - - // Return the player's selected slot back to the previous slot. - if(previousSlot != -1) { - MC.options.useKey.setPressed(false); - MC.player.getInventory().selectedSlot = previousSlot; - previousSlot = -1; - } - }else { - // Otherwise, sort the inventory to try and find some. - sortInventory(); - } - } - } - public void sortInventory() { for(int i = 0; i < PlayerInventory.getHotbarSize(); i++) { ItemStack stack = MC.player.getInventory().getStack(i); @@ -128,22 +91,44 @@ public int findSoup() { return -1; } - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { + public void setHunger(int hunger) { } @Override - public void onReceivePacket(Packet packet) { - - } - - public void setHunger(int hunger) { - + public void OnUpdate(TickEvent event) { + // If the players HP is below the given threshold. + if(MC.player.getHealth() < health.getValue()) { + + // Find the first item in the hotbar that is a Stew item. + int foodSlot= -1; + for(int i = 0; i< PlayerInventory.getHotbarSize(); i++) { + Item item = MC.player.getInventory().getStack(i).getItem(); + + if(item instanceof StewItem) { + foodSlot = i; + break; + } + } + + // If a Stew item was found, switch to it and use it. + if(foodSlot >= 0) { + previousSlot = MC.player.getInventory().selectedSlot; + + MC.player.getInventory().selectedSlot = foodSlot; + MC.options.useKey.setPressed(true); + MC.interactionManager.interactItem(MC.player, Hand.MAIN_HAND); + + // Return the player's selected slot back to the previous slot. + if(previousSlot != -1) { + MC.options.useKey.setPressed(false); + MC.player.getInventory().selectedSlot = previousSlot; + previousSlot = -1; + } + }else { + // Otherwise, sort the inventory to try and find some. + sortInventory(); + } + } } } \ No newline at end of file diff --git a/src/main/java/net/aoba/module/modules/combat/AutoTotem.java b/src/main/java/net/aoba/module/modules/combat/AutoTotem.java index 2a31d00e..3101823c 100644 --- a/src/main/java/net/aoba/module/modules/combat/AutoTotem.java +++ b/src/main/java/net/aoba/module/modules/combat/AutoTotem.java @@ -24,8 +24,6 @@ import org.lwjgl.glfw.GLFW; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; public class AutoTotem extends Module{ @@ -50,24 +48,4 @@ public void onEnable() { public void onToggle() { } - - @Override - public void onUpdate() { - - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - } } diff --git a/src/main/java/net/aoba/module/modules/combat/Criticals.java b/src/main/java/net/aoba/module/modules/combat/Criticals.java index 87254e0f..2b6295fc 100644 --- a/src/main/java/net/aoba/module/modules/combat/Criticals.java +++ b/src/main/java/net/aoba/module/modules/combat/Criticals.java @@ -22,12 +22,13 @@ package net.aoba.module.modules.combat; import org.lwjgl.glfw.GLFW; +import net.aoba.Aoba; +import net.aoba.event.events.SendPacketEvent; +import net.aoba.event.listeners.SendPacketListener; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; -public class Criticals extends Module { +public class Criticals extends Module implements SendPacketListener { public Criticals() { this.setName("Criticals"); @@ -38,48 +39,21 @@ public Criticals() { @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(SendPacketListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(SendPacketListener.class, this); } @Override public void onToggle() { } - - @Override - public void onUpdate() { - - } - + @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { + public void OnSendPacket(SendPacketEvent event) { - } - - @Override - public void onSendPacket(Packet packet) { -// if (packet instanceof UseEntityC2SPacket) { -// CUseEntityPacket packetUseEntity = (CUseEntityPacket) packet; -// if (packetUseEntity.getAction() == CUseEntityPacket.Action.ATTACK) { -// if(mc.player.isOnGround()) { -// boolean preGround = mc.player.isOnGround(); -// mc.player.setOnGround(false); -// mc.player.jump(); -// mc.player.setOnGround(preGround); -// } -// -// } -// } - } - - @Override - public void onReceivePacket(Packet packet) { - - } } diff --git a/src/main/java/net/aoba/module/modules/combat/CrystalAura.java b/src/main/java/net/aoba/module/modules/combat/CrystalAura.java index 962015e6..1c9354a2 100644 --- a/src/main/java/net/aoba/module/modules/combat/CrystalAura.java +++ b/src/main/java/net/aoba/module/modules/combat/CrystalAura.java @@ -23,18 +23,19 @@ import org.lwjgl.glfw.GLFW; +import net.aoba.Aoba; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; import net.aoba.module.Module; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.decoration.EndCrystalEntity; import net.minecraft.item.Item; import net.minecraft.item.Items; -import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.c2s.play.PlayerInteractItemC2SPacket; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; @@ -42,7 +43,7 @@ import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; -public class CrystalAura extends Module { +public class CrystalAura extends Module implements TickListener { private float radius = 10.0f; public CrystalAura() { @@ -54,12 +55,12 @@ public CrystalAura() { @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override @@ -68,7 +69,7 @@ public void onToggle() { } @Override - public void onUpdate() { + public void OnUpdate(TickEvent event) { for (PlayerEntity player : MC.world.getPlayers()) { if (player == MC.player || MC.player.distanceTo(player) > this.radius) { continue; @@ -100,21 +101,5 @@ public void onUpdate() { } } } - - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - } } \ No newline at end of file diff --git a/src/main/java/net/aoba/module/modules/combat/KillAura.java b/src/main/java/net/aoba/module/modules/combat/KillAura.java index fd34ec37..a24eb0a3 100644 --- a/src/main/java/net/aoba/module/modules/combat/KillAura.java +++ b/src/main/java/net/aoba/module/modules/combat/KillAura.java @@ -22,23 +22,22 @@ package net.aoba.module.modules.combat; import java.util.ArrayList; - import org.lwjgl.glfw.GLFW; - +import net.aoba.Aoba; import net.aoba.core.settings.types.BooleanSetting; import net.aoba.core.settings.types.FloatSetting; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.mob.Monster; import net.minecraft.entity.passive.AnimalEntity; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.network.packet.Packet; import net.minecraft.util.Hand; -public class KillAura extends Module { +public class KillAura extends Module implements TickListener { private enum Priority { LOWESTHP, CLOSEST } @@ -67,12 +66,12 @@ public KillAura() { @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override @@ -81,7 +80,7 @@ public void onToggle() { } @Override - public void onUpdate() { + public void OnUpdate(TickEvent event) { if(MC.player.getAttackCooldownProgress(0) == 1) { ArrayList hitList = new ArrayList(); LivingEntity entityToAttack = null; @@ -132,20 +131,4 @@ public void onUpdate() { } } } - - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - } } diff --git a/src/main/java/net/aoba/module/modules/combat/Nametags.java b/src/main/java/net/aoba/module/modules/combat/Nametags.java index 4633e498..e9de08f0 100644 --- a/src/main/java/net/aoba/module/modules/combat/Nametags.java +++ b/src/main/java/net/aoba/module/modules/combat/Nametags.java @@ -22,13 +22,10 @@ package net.aoba.module.modules.combat; import org.lwjgl.glfw.GLFW; - import net.aoba.core.settings.types.BooleanSetting; import net.aoba.core.settings.types.FloatSetting; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; public class Nametags extends Module { @@ -64,27 +61,6 @@ public void onEnable() { public void onToggle() { } - - @Override - public void onUpdate() { - - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - } - public double getNametagScale() { return this.scale.getValue(); diff --git a/src/main/java/net/aoba/module/modules/combat/NoOverlay.java b/src/main/java/net/aoba/module/modules/combat/NoOverlay.java index 35fe266d..9217e3f9 100644 --- a/src/main/java/net/aoba/module/modules/combat/NoOverlay.java +++ b/src/main/java/net/aoba/module/modules/combat/NoOverlay.java @@ -24,8 +24,6 @@ import org.lwjgl.glfw.GLFW; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; public class NoOverlay extends Module { @@ -50,24 +48,4 @@ public void onEnable() { public void onToggle() { } - - @Override - public void onUpdate() { - - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - } } \ No newline at end of file diff --git a/src/main/java/net/aoba/module/modules/combat/Reach.java b/src/main/java/net/aoba/module/modules/combat/Reach.java index 209a7f76..2e607610 100644 --- a/src/main/java/net/aoba/module/modules/combat/Reach.java +++ b/src/main/java/net/aoba/module/modules/combat/Reach.java @@ -22,12 +22,9 @@ package net.aoba.module.modules.combat; import org.lwjgl.glfw.GLFW; - import net.aoba.core.settings.types.FloatSetting; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; public class Reach extends Module { @@ -60,27 +57,6 @@ public void onEnable() { @Override public void onToggle() { - } - - @Override - public void onUpdate() { - - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - } public void setReachLength(float reach) { diff --git a/src/main/java/net/aoba/module/modules/combat/TriggerBot.java b/src/main/java/net/aoba/module/modules/combat/TriggerBot.java index 7dde8ffc..7d7022b7 100644 --- a/src/main/java/net/aoba/module/modules/combat/TriggerBot.java +++ b/src/main/java/net/aoba/module/modules/combat/TriggerBot.java @@ -2,27 +2,27 @@ import org.lwjgl.glfw.GLFW; +import net.aoba.Aoba; import net.aoba.core.settings.types.BooleanSetting; import net.aoba.core.settings.types.FloatSetting; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; import net.minecraft.entity.mob.Monster; import net.minecraft.entity.passive.AnimalEntity; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.network.packet.Packet; import net.minecraft.util.Hand; import net.minecraft.util.hit.EntityHitResult; import net.minecraft.util.hit.HitResult; -public class TriggerBot extends Module { +public class TriggerBot extends Module implements TickListener { private FloatSetting radius; private BooleanSetting targetAnimals; private BooleanSetting targetMonsters; private BooleanSetting targetPlayers; - public TriggerBot() { this.setName("Triggerbot"); this.setBind(new KeyBinding("key.triggerbot", GLFW.GLFW_KEY_UNKNOWN, "key.categories.aoba")); @@ -41,12 +41,12 @@ public TriggerBot() { @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override @@ -55,37 +55,25 @@ public void onToggle() { } @Override - public void onUpdate() { + public void OnUpdate(TickEvent event) { // Get the current target that the player is looking at. HitResult ray = MC.crosshairTarget; - + // If the target is an Entity, attack it. - if(ray != null && ray.getType()==HitResult.Type.ENTITY) { + if (ray != null && ray.getType() == HitResult.Type.ENTITY) { EntityHitResult entityResult = (EntityHitResult) ray; Entity ent = entityResult.getEntity(); - if(ent instanceof AnimalEntity && !this.targetAnimals.getValue()) return; - if(ent instanceof PlayerEntity && !this.targetPlayers.getValue()) return; - if(ent instanceof Monster && !this.targetMonsters.getValue()) return; - - if(MC.player.getAttackCooldownProgress(0) == 1) { + if (ent instanceof AnimalEntity && !this.targetAnimals.getValue()) + return; + if (ent instanceof PlayerEntity && !this.targetPlayers.getValue()) + return; + if (ent instanceof Monster && !this.targetMonsters.getValue()) + return; + + if (MC.player.getAttackCooldownProgress(0) == 1) { MC.interactionManager.attackEntity(MC.player, entityResult.getEntity()); MC.player.swingHand(Hand.MAIN_HAND); } } } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - } } diff --git a/src/main/java/net/aoba/module/modules/misc/AntiCactus.java b/src/main/java/net/aoba/module/modules/misc/AntiCactus.java index 93764684..9298db62 100644 --- a/src/main/java/net/aoba/module/modules/misc/AntiCactus.java +++ b/src/main/java/net/aoba/module/modules/misc/AntiCactus.java @@ -24,8 +24,6 @@ import org.lwjgl.glfw.GLFW; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; public class AntiCactus extends Module { @@ -47,20 +45,4 @@ public void onEnable() { @Override public void onToggle() { } - - @Override - public void onUpdate() { - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - } - - @Override - public void onSendPacket(Packet packet) { - } - - @Override - public void onReceivePacket(Packet packet) { - } } \ No newline at end of file diff --git a/src/main/java/net/aoba/module/modules/misc/AutoEat.java b/src/main/java/net/aoba/module/modules/misc/AutoEat.java index 42429a85..3e54b940 100644 --- a/src/main/java/net/aoba/module/modules/misc/AutoEat.java +++ b/src/main/java/net/aoba/module/modules/misc/AutoEat.java @@ -22,16 +22,17 @@ package net.aoba.module.modules.misc; import org.lwjgl.glfw.GLFW; +import net.aoba.Aoba; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.FoodComponent; import net.minecraft.item.Item; -import net.minecraft.network.packet.Packet; - -public class AutoEat extends Module { +public class AutoEat extends Module implements TickListener { private int hunger = 6; + public AutoEat() { this.setName("AutoEat"); this.setBind(new KeyBinding("key.autoeat", GLFW.GLFW_KEY_N, "key.categories.aoba")); @@ -41,21 +42,25 @@ public AutoEat() { @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() { + } + + public void setHunger(int hunger) { + } @Override - public void onUpdate() { + public void OnUpdate(TickEvent event) { if(MC.player.getHungerManager().getFoodLevel() <= hunger) { int foodSlot= -1; FoodComponent bestFood = null; @@ -84,23 +89,4 @@ public void onUpdate() { } } } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - } - - public void setHunger(int hunger) { - - } } diff --git a/src/main/java/net/aoba/module/modules/misc/AutoFish.java b/src/main/java/net/aoba/module/modules/misc/AutoFish.java index 809a48e5..d924435a 100644 --- a/src/main/java/net/aoba/module/modules/misc/AutoFish.java +++ b/src/main/java/net/aoba/module/modules/misc/AutoFish.java @@ -22,16 +22,18 @@ package net.aoba.module.modules.misc; import org.lwjgl.glfw.GLFW; +import net.aoba.Aoba; +import net.aoba.event.events.ReceivePacketEvent; +import net.aoba.event.listeners.ReceivePacketListener; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.c2s.play.PlayerInteractItemC2SPacket; import net.minecraft.network.packet.s2c.play.PlaySoundS2CPacket; import net.minecraft.sound.SoundEvents; import net.minecraft.util.Hand; -public class AutoFish extends Module { +public class AutoFish extends Module implements ReceivePacketListener { public AutoFish() { this.setName("AutoFish"); this.setBind(new KeyBinding("key.autofish", GLFW.GLFW_KEY_UNKNOWN, "key.categories.aoba")); @@ -41,36 +43,30 @@ public AutoFish() { @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(ReceivePacketListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(ReceivePacketListener.class, this); } @Override public void onToggle() { } - - @Override - public void onUpdate() { - - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { + + private void recastRod() { + PlayerInteractItemC2SPacket packetTryUse = new PlayerInteractItemC2SPacket(Hand.MAIN_HAND, 0); + MC.player.networkHandler.sendPacket(packetTryUse); + MC.player.networkHandler.sendPacket(packetTryUse); } @Override - public void onSendPacket(Packet packet) { + public void OnReceivePacket(ReceivePacketEvent readPacketEvent) { + Packet packet = readPacketEvent.GetPacket(); - } - - @Override - public void onReceivePacket(Packet packet) { if(packet instanceof PlaySoundS2CPacket ) { PlaySoundS2CPacket soundPacket = (PlaySoundS2CPacket)packet; if(soundPacket.getSound().value().equals(SoundEvents.ENTITY_FISHING_BOBBER_SPLASH)) { @@ -78,12 +74,5 @@ public void onReceivePacket(Packet packet) { } } } - - private void recastRod() { - - PlayerInteractItemC2SPacket packetTryUse = new PlayerInteractItemC2SPacket(Hand.MAIN_HAND, 0); - MC.player.networkHandler.sendPacket(packetTryUse); - MC.player.networkHandler.sendPacket(packetTryUse); - } } diff --git a/src/main/java/net/aoba/module/modules/misc/AutoWalk.java b/src/main/java/net/aoba/module/modules/misc/AutoWalk.java index 8832eae0..57799e3f 100644 --- a/src/main/java/net/aoba/module/modules/misc/AutoWalk.java +++ b/src/main/java/net/aoba/module/modules/misc/AutoWalk.java @@ -22,12 +22,13 @@ package net.aoba.module.modules.misc; import org.lwjgl.glfw.GLFW; +import net.aoba.Aoba; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; -public class AutoWalk extends Module { +public class AutoWalk extends Module implements TickListener { public AutoWalk() { this.setName("AutoWalk"); this.setBind(new KeyBinding("key.autowalk", GLFW.GLFW_KEY_UNKNOWN, "key.categories.aoba")); @@ -38,35 +39,21 @@ public AutoWalk() { @Override public void onDisable() { MC.options.forwardKey.setPressed(false); + 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() { - MC.options.forwardKey.setPressed(true); - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - } @Override - public void onReceivePacket(Packet packet) { - + public void OnUpdate(TickEvent event) { + MC.options.forwardKey.setPressed(true); } } diff --git a/src/main/java/net/aoba/module/modules/misc/FastBreak.java b/src/main/java/net/aoba/module/modules/misc/FastBreak.java index f80bb0ac..5e4a9f1d 100644 --- a/src/main/java/net/aoba/module/modules/misc/FastBreak.java +++ b/src/main/java/net/aoba/module/modules/misc/FastBreak.java @@ -22,12 +22,9 @@ package net.aoba.module.modules.misc; import org.lwjgl.glfw.GLFW; - import net.aoba.core.settings.types.FloatSetting; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; public class FastBreak extends Module { @@ -61,20 +58,4 @@ public void onEnable() { public void onToggle() { } - - @Override - public void onUpdate() { - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - } - - @Override - public void onSendPacket(Packet packet) { - } - - @Override - public void onReceivePacket(Packet packet) { - } } diff --git a/src/main/java/net/aoba/module/modules/misc/FastPlace.java b/src/main/java/net/aoba/module/modules/misc/FastPlace.java index 0f76745b..ce1ece7a 100644 --- a/src/main/java/net/aoba/module/modules/misc/FastPlace.java +++ b/src/main/java/net/aoba/module/modules/misc/FastPlace.java @@ -22,13 +22,14 @@ package net.aoba.module.modules.misc; import org.lwjgl.glfw.GLFW; +import net.aoba.Aoba; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; import net.aoba.interfaces.IMinecraftClient; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; -public class FastPlace extends Module { +public class FastPlace extends Module implements TickListener{ IMinecraftClient iMC; public FastPlace() { @@ -41,11 +42,12 @@ public FastPlace() { @Override public void onDisable() { IMC.setItemUseCooldown(4); + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override @@ -54,23 +56,7 @@ public void onToggle() { } @Override - public void onUpdate() { + public void OnUpdate(TickEvent event) { IMC.setItemUseCooldown(0); } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - - } } diff --git a/src/main/java/net/aoba/module/modules/misc/Timer.java b/src/main/java/net/aoba/module/modules/misc/Timer.java index 685083cb..1e360029 100644 --- a/src/main/java/net/aoba/module/modules/misc/Timer.java +++ b/src/main/java/net/aoba/module/modules/misc/Timer.java @@ -22,12 +22,10 @@ package net.aoba.module.modules.misc; import org.lwjgl.glfw.GLFW; - import net.aoba.core.settings.types.FloatSetting; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; + public class Timer extends Module { private FloatSetting multiplier; @@ -59,20 +57,4 @@ public void onEnable() { @Override public void onToggle() { } - - @Override - public void onUpdate() { - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - } - - @Override - public void onSendPacket(Packet packet) { - } - - @Override - public void onReceivePacket(Packet packet) { - } } \ No newline at end of file diff --git a/src/main/java/net/aoba/module/modules/movement/Fly.java b/src/main/java/net/aoba/module/modules/movement/Fly.java index 6355f9b2..cd15dc88 100644 --- a/src/main/java/net/aoba/module/modules/movement/Fly.java +++ b/src/main/java/net/aoba/module/modules/movement/Fly.java @@ -22,17 +22,17 @@ package net.aoba.module.modules.movement; import org.lwjgl.glfw.GLFW; - +import net.aoba.Aoba; import net.aoba.core.settings.types.FloatSetting; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; import net.aoba.module.Module; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; -import net.minecraft.network.packet.Packet; import net.minecraft.util.math.Vec3d; -public class Fly extends Module { +public class Fly extends Module implements TickListener { private FloatSetting flySpeed; @@ -57,12 +57,12 @@ public double getSpeed() { @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override @@ -71,7 +71,7 @@ public void onToggle() { } @Override - public void onUpdate() { + public void OnUpdate(TickEvent event) { ClientPlayerEntity player = MC.player; float speed = this.flySpeed.getValue().floatValue(); if(MC.player.isRiding()) { @@ -96,19 +96,4 @@ public void onUpdate() { player.setVelocity(vec); } } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - } } diff --git a/src/main/java/net/aoba/module/modules/movement/Freecam.java b/src/main/java/net/aoba/module/modules/movement/Freecam.java index 5bbd0262..867f6931 100644 --- a/src/main/java/net/aoba/module/modules/movement/Freecam.java +++ b/src/main/java/net/aoba/module/modules/movement/Freecam.java @@ -22,21 +22,19 @@ package net.aoba.module.modules.movement; import java.util.UUID; - import org.lwjgl.glfw.GLFW; - import net.aoba.Aoba; import net.aoba.core.settings.types.FloatSetting; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; import net.aoba.misc.FakePlayerEntity; import net.aoba.module.Module; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity.RemovalReason; -import net.minecraft.network.packet.Packet; import net.minecraft.util.math.Vec3d; -public class Freecam extends Module { +public class Freecam extends Module implements TickListener { private FakePlayerEntity fakePlayer; private FloatSetting flySpeed; @@ -66,6 +64,8 @@ public void onDisable() { player.copyFrom(fakePlayer); fakePlayer.despawn(); MC.world.removeEntity(-3, RemovalReason.DISCARDED); + + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override @@ -79,15 +79,21 @@ public void onEnable() { Aoba.getInstance().moduleManager.fly.setState(false); Aoba.getInstance().moduleManager.noclip.setState(false); + + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override public void onToggle() { } + + public FakePlayerEntity getFakePlayer() { + return this.fakePlayer; + } @Override - public void onUpdate() { + public void OnUpdate(TickEvent event) { ClientPlayerEntity player = MC.player; player.noClip = true; player.setOnGround(false); @@ -108,23 +114,4 @@ public void onUpdate() { player.setVelocity(vec); } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - } - - public FakePlayerEntity getFakePlayer() { - return this.fakePlayer; - } } diff --git a/src/main/java/net/aoba/module/modules/movement/Glide.java b/src/main/java/net/aoba/module/modules/movement/Glide.java index c9520fa4..9a04350b 100644 --- a/src/main/java/net/aoba/module/modules/movement/Glide.java +++ b/src/main/java/net/aoba/module/modules/movement/Glide.java @@ -22,13 +22,14 @@ package net.aoba.module.modules.movement; import org.lwjgl.glfw.GLFW; +import net.aoba.Aoba; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; import net.aoba.module.Module; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; -public class Glide extends Module { +public class Glide extends Module implements TickListener { private float fallSpeed = .25f; public Glide() { this.setName("Glide"); @@ -39,11 +40,12 @@ public Glide() { @Override public void onDisable() { + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override @@ -52,25 +54,10 @@ public void onToggle() { } @Override - public void onUpdate() { + public void OnUpdate(TickEvent event) { ClientPlayerEntity player = MC.player; if(player.getVelocity().y < 0 && (!player.isOnGround() || !player.isInLava() || !player.isSubmergedInWater() || !player.isHoldingOntoLadder())) { player.setVelocity(player.getVelocity().x, Math.max(player.getVelocity().y, -this.fallSpeed), player.getVelocity().z); } } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - } } diff --git a/src/main/java/net/aoba/module/modules/movement/Jesus.java b/src/main/java/net/aoba/module/modules/movement/Jesus.java index 8bb3bcaf..c4a34aae 100644 --- a/src/main/java/net/aoba/module/modules/movement/Jesus.java +++ b/src/main/java/net/aoba/module/modules/movement/Jesus.java @@ -22,23 +22,23 @@ package net.aoba.module.modules.movement; import org.lwjgl.glfw.GLFW; - +import net.aoba.Aoba; import net.aoba.core.settings.types.BooleanSetting; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; -public class Jesus extends Module { - +public class Jesus extends Module implements TickListener { + public BooleanSetting legit; - + public Jesus() { this.setName("Jesus"); this.setBind(new KeyBinding("key.jesus", GLFW.GLFW_KEY_UNKNOWN, "key.categories.aoba")); this.setCategory(Category.Movement); this.setDescription("Allows the player to walk on water."); - + // Add Settings legit = new BooleanSetting("jesus_legit", "Legit", true, null); this.addSetting(legit); @@ -46,11 +46,12 @@ public Jesus() { @Override public void onDisable() { + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override @@ -59,27 +60,12 @@ public void onToggle() { } @Override - public void onUpdate() { + public void OnUpdate(TickEvent event) { // If Legit is enabled, simply swim. - if(this.legit.getValue()) { - if(MC.player.isInLava() || MC.player.isTouchingWater()){ + if (this.legit.getValue()) { + if (MC.player.isInLava() || MC.player.isTouchingWater()) { MC.options.jumpKey.setPressed(true); } } } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - } } diff --git a/src/main/java/net/aoba/module/modules/movement/NoFall.java b/src/main/java/net/aoba/module/modules/movement/NoFall.java index 83396e75..f34e3291 100644 --- a/src/main/java/net/aoba/module/modules/movement/NoFall.java +++ b/src/main/java/net/aoba/module/modules/movement/NoFall.java @@ -22,13 +22,14 @@ package net.aoba.module.modules.movement; import org.lwjgl.glfw.GLFW; +import net.aoba.Aoba; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket.OnGroundOnly; -public class NoFall extends Module { +public class NoFall extends Module implements TickListener { public NoFall() { this.setName("No-Fall"); @@ -39,12 +40,12 @@ public NoFall() { @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override @@ -53,25 +54,9 @@ public void onToggle() { } @Override - public void onUpdate() { + public void OnUpdate(TickEvent event) { if(MC.player.fallDistance > 2f) { MC.player.networkHandler.sendPacket(new OnGroundOnly(true)); } } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - - } } diff --git a/src/main/java/net/aoba/module/modules/movement/NoSlowdown.java b/src/main/java/net/aoba/module/modules/movement/NoSlowdown.java index 374d04fe..f650b4b5 100644 --- a/src/main/java/net/aoba/module/modules/movement/NoSlowdown.java +++ b/src/main/java/net/aoba/module/modules/movement/NoSlowdown.java @@ -22,12 +22,13 @@ package net.aoba.module.modules.movement; import org.lwjgl.glfw.GLFW; +import net.aoba.Aoba; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; -public class NoSlowdown extends Module { +public class NoSlowdown extends Module implements TickListener { public NoSlowdown() { this.setName("NoSlowdown"); @@ -38,12 +39,12 @@ public NoSlowdown() { @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override @@ -52,23 +53,7 @@ public void onToggle() { } @Override - public void onUpdate() { + public void OnUpdate(TickEvent event) { //mc.player.setMotionMultiplier(null, Vec3d.ZERO); } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - - } } diff --git a/src/main/java/net/aoba/module/modules/movement/Noclip.java b/src/main/java/net/aoba/module/modules/movement/Noclip.java index 02b93531..20721de3 100644 --- a/src/main/java/net/aoba/module/modules/movement/Noclip.java +++ b/src/main/java/net/aoba/module/modules/movement/Noclip.java @@ -22,14 +22,15 @@ package net.aoba.module.modules.movement; import org.lwjgl.glfw.GLFW; +import net.aoba.Aoba; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; import net.aoba.module.Module; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; import net.minecraft.util.math.Vec3d; -public class Noclip extends Module { +public class Noclip extends Module implements TickListener { private float flySpeed = 5; public Noclip() { @@ -46,10 +47,12 @@ public void setSpeed(float speed) { @Override public void onDisable() { MC.player.noClip = false; + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override @@ -58,7 +61,7 @@ public void onToggle() { } @Override - public void onUpdate() { + public void OnUpdate(TickEvent event) { ClientPlayerEntity player = MC.player; player.noClip = true; if (MC.options.sprintKey.isPressed()) { @@ -78,20 +81,4 @@ public void onUpdate() { } player.setVelocity(vec); } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - - } } diff --git a/src/main/java/net/aoba/module/modules/movement/Safewalk.java b/src/main/java/net/aoba/module/modules/movement/Safewalk.java index aaf19c3d..25bb67c4 100644 --- a/src/main/java/net/aoba/module/modules/movement/Safewalk.java +++ b/src/main/java/net/aoba/module/modules/movement/Safewalk.java @@ -22,13 +22,14 @@ package net.aoba.module.modules.movement; import org.lwjgl.glfw.GLFW; +import net.aoba.Aoba; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; import net.minecraft.util.math.Vec3d; -public class Safewalk extends Module { +public class Safewalk extends Module implements TickListener { public Safewalk() { this.setName("Safewalk"); @@ -39,12 +40,12 @@ public Safewalk() { @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override @@ -53,7 +54,7 @@ public void onToggle() { } @Override - public void onUpdate() { + public void OnUpdate(TickEvent event) { double x = MC.player.getVelocity().x; double y = MC.player.getVelocity().y; double z = MC.player.getVelocity().z; @@ -95,21 +96,6 @@ public void onUpdate() { } } MC.player.setVelocity(new Vec3d(x,y,z)); - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - } } diff --git a/src/main/java/net/aoba/module/modules/movement/Sneak.java b/src/main/java/net/aoba/module/modules/movement/Sneak.java index 5e9bf2a0..2f5d61eb 100644 --- a/src/main/java/net/aoba/module/modules/movement/Sneak.java +++ b/src/main/java/net/aoba/module/modules/movement/Sneak.java @@ -22,15 +22,16 @@ package net.aoba.module.modules.movement; import org.lwjgl.glfw.GLFW; +import net.aoba.Aoba; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; import net.aoba.module.Module; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket; import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket.Mode; -public class Sneak extends Module { +public class Sneak extends Module implements TickListener { public Sneak() { this.setName("Sneak"); @@ -43,11 +44,12 @@ public Sneak() { public void onDisable() { ClientPlayerEntity player = MC.player; player.networkHandler.sendPacket(new ClientCommandC2SPacket(player, Mode.RELEASE_SHIFT_KEY)); + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override @@ -56,27 +58,11 @@ public void onToggle() { } @Override - public void onUpdate() { + public void OnUpdate(TickEvent event) { ClientPlayerEntity player = MC.player; MC.player.networkHandler.sendPacket(new ClientCommandC2SPacket(player, Mode.PRESS_SHIFT_KEY)); MC.player.networkHandler.sendPacket(new ClientCommandC2SPacket(player, Mode.RELEASE_SHIFT_KEY)); } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - - } } diff --git a/src/main/java/net/aoba/module/modules/movement/Spider.java b/src/main/java/net/aoba/module/modules/movement/Spider.java index c48853d2..5db28292 100644 --- a/src/main/java/net/aoba/module/modules/movement/Spider.java +++ b/src/main/java/net/aoba/module/modules/movement/Spider.java @@ -22,14 +22,15 @@ package net.aoba.module.modules.movement; import org.lwjgl.glfw.GLFW; +import net.aoba.Aoba; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; import net.aoba.module.Module; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; import net.minecraft.util.math.Vec3d; -public class Spider extends Module { +public class Spider extends Module implements TickListener { public Spider() { this.setName("Spider"); @@ -40,10 +41,12 @@ public Spider() { @Override public void onDisable() { + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override @@ -52,7 +55,7 @@ public void onToggle() { } @Override - public void onUpdate() { + public void OnUpdate(TickEvent event) { ClientPlayerEntity player = MC.player; if(player.horizontalCollision) { player.getVelocity().multiply(new Vec3d(1,0,1)); @@ -60,20 +63,4 @@ public void onUpdate() { player.setOnGround(true); } } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - - } } diff --git a/src/main/java/net/aoba/module/modules/movement/Sprint.java b/src/main/java/net/aoba/module/modules/movement/Sprint.java index 3f7790f8..e6214dca 100644 --- a/src/main/java/net/aoba/module/modules/movement/Sprint.java +++ b/src/main/java/net/aoba/module/modules/movement/Sprint.java @@ -22,12 +22,13 @@ package net.aoba.module.modules.movement; import org.lwjgl.glfw.GLFW; +import net.aoba.Aoba; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; -public class Sprint extends Module { +public class Sprint extends Module implements TickListener { public Sprint() { this.setName("Sprint"); @@ -38,12 +39,12 @@ public Sprint() { @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override @@ -52,23 +53,7 @@ public void onToggle() { } @Override - public void onUpdate() { + public void OnUpdate(TickEvent event) { MC.player.setSprinting(true); } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - - } } diff --git a/src/main/java/net/aoba/module/modules/movement/Step.java b/src/main/java/net/aoba/module/modules/movement/Step.java index dd523e07..bfbb9bdd 100644 --- a/src/main/java/net/aoba/module/modules/movement/Step.java +++ b/src/main/java/net/aoba/module/modules/movement/Step.java @@ -22,12 +22,9 @@ package net.aoba.module.modules.movement; import org.lwjgl.glfw.GLFW; - import net.aoba.core.settings.types.FloatSetting; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; public class Step extends Module { @@ -58,27 +55,6 @@ public void onEnable() { @Override public void onToggle() { - } - - @Override - public void onUpdate() { - - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - } public void setStepHeight(float height) { diff --git a/src/main/java/net/aoba/module/modules/render/Breadcrumbs.java b/src/main/java/net/aoba/module/modules/render/Breadcrumbs.java index 656573af..8dd082bd 100644 --- a/src/main/java/net/aoba/module/modules/render/Breadcrumbs.java +++ b/src/main/java/net/aoba/module/modules/render/Breadcrumbs.java @@ -23,21 +23,21 @@ import java.util.ArrayList; import java.util.List; - import net.aoba.Aoba; import net.aoba.core.settings.types.BooleanSetting; import net.aoba.core.settings.types.FloatSetting; - +import net.aoba.event.events.RenderEvent; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.RenderListener; +import net.aoba.event.listeners.TickListener; import org.lwjgl.glfw.GLFW; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; import net.minecraft.util.math.Vec3d; import net.aoba.gui.Color; import net.aoba.misc.RainbowColor; -public class Breadcrumbs extends Module{ +public class Breadcrumbs extends Module implements RenderListener, TickListener { private Color currentColor; private Color color; private RainbowColor rainbowColor; @@ -65,20 +65,30 @@ public Breadcrumbs() { @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(RenderListener.class, this); + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { + Aoba.getInstance().eventManager.AddListener(RenderListener.class, this); + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override public void onToggle() { } - + + @Override + public void OnRender(RenderEvent event) { + for(int i = 0; i < this.positions.size() - 1; i++) { + this.getRenderUtils().drawLine3D(event.GetMatrixStack(), this.positions.get(i), this.positions.get(i + 1), this.currentColor); + } + } + @Override - public void onUpdate() { + public void OnUpdate(TickEvent event) { currentTick++; if(timer == currentTick) { currentTick = 0; @@ -94,21 +104,4 @@ public void onUpdate() { this.currentColor = color; } } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - for(int i = 0; i < this.positions.size() - 1; i++) { - this.getRenderUtils().drawLine3D(matrixStack, this.positions.get(i), this.positions.get(i + 1), this.currentColor); - } - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - } } \ No newline at end of file diff --git a/src/main/java/net/aoba/module/modules/render/ChestESP.java b/src/main/java/net/aoba/module/modules/render/ChestESP.java index 8c15b2f0..d4addf3e 100644 --- a/src/main/java/net/aoba/module/modules/render/ChestESP.java +++ b/src/main/java/net/aoba/module/modules/render/ChestESP.java @@ -23,11 +23,14 @@ import java.util.ArrayList; import java.util.stream.Collectors; - import org.lwjgl.glfw.GLFW; - +import net.aoba.Aoba; import net.aoba.core.settings.types.BooleanSetting; import net.aoba.core.settings.types.FloatSetting; +import net.aoba.event.events.RenderEvent; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.RenderListener; +import net.aoba.event.listeners.TickListener; import net.aoba.gui.Color; import net.aoba.misc.ModuleUtils; import net.aoba.misc.RainbowColor; @@ -36,11 +39,9 @@ import net.minecraft.block.entity.ChestBlockEntity; import net.minecraft.block.entity.TrappedChestBlockEntity; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; import net.minecraft.util.math.Box; -public class ChestESP extends Module { +public class ChestESP extends Module implements RenderListener, TickListener { private Color currentColor; private Color color; private RainbowColor rainbowColor; @@ -64,50 +65,41 @@ public ChestESP() { @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(RenderListener.class, this); + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(RenderListener.class, this); + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override public void onToggle() { } - - @Override - public void onUpdate() { - if(this.rainbow.getValue()) { - this.rainbowColor.update(this.effectSpeed.getValue().floatValue()); - this.currentColor = this.rainbowColor.getColor(); - }else { - this.color.setHSV(hue.getValue().floatValue(), 1f, 1f); - this.currentColor = color; - } - } - + @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { + public void OnRender(RenderEvent event) { ArrayList blockEntities = ModuleUtils.getTileEntities().collect(Collectors.toCollection(ArrayList::new)); for(BlockEntity blockEntity : blockEntities) { if(blockEntity instanceof ChestBlockEntity || blockEntity instanceof TrappedChestBlockEntity) { Box box = new Box(blockEntity.getPos()); - this.getRenderUtils().draw3DBox(matrixStack, box, currentColor, 0.2f); + this.getRenderUtils().draw3DBox(event.GetMatrixStack(), box, currentColor, 0.2f); } } } @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - + public void OnUpdate(TickEvent event) { + if(this.rainbow.getValue()) { + this.rainbowColor.update(this.effectSpeed.getValue().floatValue()); + this.currentColor = this.rainbowColor.getColor(); + }else { + this.color.setHSV(hue.getValue().floatValue(), 1f, 1f); + this.currentColor = color; + } } } diff --git a/src/main/java/net/aoba/module/modules/render/EntityESP.java b/src/main/java/net/aoba/module/modules/render/EntityESP.java index 129f9779..fdc25fac 100644 --- a/src/main/java/net/aoba/module/modules/render/EntityESP.java +++ b/src/main/java/net/aoba/module/modules/render/EntityESP.java @@ -21,32 +21,28 @@ */ package net.aoba.module.modules.render; -import org.joml.Quaternionf; import org.lwjgl.glfw.GLFW; - +import net.aoba.Aoba; import net.aoba.core.settings.types.BooleanSetting; import net.aoba.core.settings.types.FloatSetting; +import net.aoba.event.events.RenderEvent; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.RenderListener; +import net.aoba.event.listeners.TickListener; import net.aoba.gui.Color; import net.aoba.misc.RainbowColor; import net.aoba.module.Module; -import net.minecraft.client.model.ModelData; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.entity.model.CowEntityModel; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.render.entity.model.EntityModelLoader; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.mob.Monster; import net.minecraft.entity.passive.AnimalEntity; -import net.minecraft.network.packet.Packet; import net.minecraft.util.math.Box; import net.minecraft.util.math.Vec3d; -public class EntityESP extends Module { +public class EntityESP extends Module implements RenderListener, TickListener { private Color color; private RainbowColor rainbowColor; @@ -69,12 +65,14 @@ public EntityESP() { @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(RenderListener.class, this); + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(RenderListener.class, this); + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override @@ -83,16 +81,10 @@ public void onToggle() { } @Override - public void onUpdate() { - if(this.rainbow.getValue()) { - this.rainbowColor.update(this.effectSpeed.getValue().floatValue()); - }else { - this.color.setHSV(hue.getValue().floatValue(), 1f, 1f); - } - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { + public void OnRender(RenderEvent event) { + MatrixStack matrixStack = event.GetMatrixStack(); + float partialTicks = event.GetPartialTicks(); + matrixStack.push(); for (Entity entity : MC.world.getEntities()) { @@ -118,12 +110,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) { } @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - + public void OnUpdate(TickEvent event) { + if(this.rainbow.getValue()) { + this.rainbowColor.update(this.effectSpeed.getValue().floatValue()); + }else { + this.color.setHSV(hue.getValue().floatValue(), 1f, 1f); + } } } diff --git a/src/main/java/net/aoba/module/modules/render/Fullbright.java b/src/main/java/net/aoba/module/modules/render/Fullbright.java index 49c17341..be605e20 100644 --- a/src/main/java/net/aoba/module/modules/render/Fullbright.java +++ b/src/main/java/net/aoba/module/modules/render/Fullbright.java @@ -22,12 +22,9 @@ package net.aoba.module.modules.render; import org.lwjgl.glfw.GLFW; - import net.aoba.interfaces.ISimpleOption; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; public class Fullbright extends Module { @@ -61,26 +58,4 @@ public void onEnable() { public void onToggle() { } - - @Override - public void onUpdate() { - - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - - } - } diff --git a/src/main/java/net/aoba/module/modules/render/ItemESP.java b/src/main/java/net/aoba/module/modules/render/ItemESP.java index e95fe3ae..4c7dbc3c 100644 --- a/src/main/java/net/aoba/module/modules/render/ItemESP.java +++ b/src/main/java/net/aoba/module/modules/render/ItemESP.java @@ -22,16 +22,16 @@ package net.aoba.module.modules.render; import org.lwjgl.glfw.GLFW; - +import net.aoba.Aoba; +import net.aoba.event.events.RenderEvent; +import net.aoba.event.listeners.RenderListener; import net.aoba.gui.Color; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; import net.minecraft.entity.ItemEntity; -import net.minecraft.network.packet.Packet; -public class ItemESP extends Module { +public class ItemESP extends Module implements RenderListener { public ItemESP() { this.setName("ItemESP"); @@ -43,12 +43,12 @@ public ItemESP() { @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(RenderListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(RenderListener.class, this); } @Override @@ -57,28 +57,12 @@ public void onToggle() { } @Override - public void onUpdate() { - - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { + public void OnRender(RenderEvent event) { for (Entity entity : MC.world.getEntities()) { if(entity instanceof ItemEntity) { - this.getRenderUtils().draw3DBox(matrixStack, entity.getBoundingBox(), new Color(255, 0, 0), 0.2f); + this.getRenderUtils().draw3DBox(event.GetMatrixStack(), entity.getBoundingBox(), new Color(255, 0, 0), 0.2f); } } } - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - - } - } diff --git a/src/main/java/net/aoba/module/modules/render/POV.java b/src/main/java/net/aoba/module/modules/render/POV.java index e7a1e4a9..ea92c9a8 100644 --- a/src/main/java/net/aoba/module/modules/render/POV.java +++ b/src/main/java/net/aoba/module/modules/render/POV.java @@ -22,18 +22,18 @@ package net.aoba.module.modules.render; import org.lwjgl.glfw.GLFW; - +import net.aoba.Aoba; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; import net.aoba.misc.FakePlayerEntity; import net.aoba.module.Module; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.network.packet.Packet; -public class POV extends Module { +public class POV extends Module implements TickListener { private FakePlayerEntity fakePlayer; private String povString = null; private Entity povEntity = null; @@ -53,11 +53,12 @@ public void onDisable() { fakePlayer.despawn(); MC.world.removeEntity(-3, null); } + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @@ -66,8 +67,24 @@ public void onToggle() { } + public void setEntityPOV(String entity) { + this.povString = entity; + } + + public Entity getEntity() { + return this.povEntity; + } + + public PlayerEntity getEntityAsPlayer() { + if(this.povEntity instanceof PlayerEntity) { + return (PlayerEntity) this.povEntity; + }else { + return null; + } + } + @Override - public void onUpdate() { + public void OnUpdate(TickEvent event) { ClientPlayerEntity player = MC.player; povEntity = null; for(Entity entity : MC.world.getPlayers()) { @@ -96,38 +113,5 @@ public void onUpdate() { MinecraftClient.getInstance().setCameraEntity(povEntity); } } - - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - - } - - public void setEntityPOV(String entity) { - this.povString = entity; - } - - public Entity getEntity() { - return this.povEntity; - } - - public PlayerEntity getEntityAsPlayer() { - if(this.povEntity instanceof PlayerEntity) { - return (PlayerEntity) this.povEntity; - }else { - return null; - } } } \ No newline at end of file diff --git a/src/main/java/net/aoba/module/modules/render/PlayerESP.java b/src/main/java/net/aoba/module/modules/render/PlayerESP.java index 7a70a3e0..aff5e2b7 100644 --- a/src/main/java/net/aoba/module/modules/render/PlayerESP.java +++ b/src/main/java/net/aoba/module/modules/render/PlayerESP.java @@ -22,15 +22,15 @@ package net.aoba.module.modules.render; import org.lwjgl.glfw.GLFW; - +import net.aoba.Aoba; +import net.aoba.event.events.RenderEvent; +import net.aoba.event.listeners.RenderListener; import net.aoba.gui.Color; import net.aoba.module.Module; import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; -public class PlayerESP extends Module { +public class PlayerESP extends Module implements RenderListener { public PlayerESP() { this.setName("PlayerESP"); @@ -42,42 +42,25 @@ public PlayerESP() { @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(RenderListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(RenderListener.class, this); } @Override public void onToggle() { } - - @Override - public void onUpdate() { - - } - + @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { + public void OnRender(RenderEvent event) { for (AbstractClientPlayerEntity entity : MC.world.getPlayers()) { if(entity != MC.player) { - this.getRenderUtils().draw3DBox(matrixStack, entity.getBoundingBox(), new Color(255, 0, 0), 0.2f); + this.getRenderUtils().draw3DBox(event.GetMatrixStack(), entity.getBoundingBox(), new Color(255, 0, 0), 0.2f); } } } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - - } - } diff --git a/src/main/java/net/aoba/module/modules/render/SpawnerESP.java b/src/main/java/net/aoba/module/modules/render/SpawnerESP.java index e292f76a..599c606c 100644 --- a/src/main/java/net/aoba/module/modules/render/SpawnerESP.java +++ b/src/main/java/net/aoba/module/modules/render/SpawnerESP.java @@ -24,17 +24,18 @@ import java.util.ArrayList; import java.util.stream.Collectors; import org.lwjgl.glfw.GLFW; +import net.aoba.Aoba; +import net.aoba.event.events.RenderEvent; +import net.aoba.event.listeners.RenderListener; import net.aoba.gui.Color; import net.aoba.misc.ModuleUtils; import net.aoba.module.Module; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.MobSpawnerBlockEntity; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; import net.minecraft.util.math.Box; -public class SpawnerESP extends Module { +public class SpawnerESP extends Module implements RenderListener { public SpawnerESP() { this.setName("SpawnerESP"); @@ -45,12 +46,12 @@ public SpawnerESP() { @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(RenderListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(RenderListener.class, this); } @Override @@ -59,31 +60,14 @@ public void onToggle() { } @Override - public void onUpdate() { - - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { + public void OnRender(RenderEvent event) { ArrayList blockEntities = ModuleUtils.getTileEntities().collect(Collectors.toCollection(ArrayList::new)); for(BlockEntity blockEntity : blockEntities) { if(blockEntity instanceof MobSpawnerBlockEntity) { Box box = new Box(blockEntity.getPos()); - this.getRenderUtils().draw3DBox(matrixStack, box, new Color(255,255,0), 0.2f); + this.getRenderUtils().draw3DBox(event.GetMatrixStack(), box, new Color(255,255,0), 0.2f); } } } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - - } - } \ No newline at end of file diff --git a/src/main/java/net/aoba/module/modules/render/Tracer.java b/src/main/java/net/aoba/module/modules/render/Tracer.java index 86bb2d39..6af44cfa 100644 --- a/src/main/java/net/aoba/module/modules/render/Tracer.java +++ b/src/main/java/net/aoba/module/modules/render/Tracer.java @@ -22,60 +22,44 @@ package net.aoba.module.modules.render; import org.lwjgl.glfw.GLFW; +import net.aoba.Aoba; +import net.aoba.event.events.RenderEvent; +import net.aoba.event.listeners.RenderListener; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; -import net.minecraft.network.packet.Packet; -public class Tracer extends Module { +public class Tracer extends Module implements RenderListener { public Tracer() { this.setName("Tracer"); this.setBind(new KeyBinding("key.tracer", GLFW.GLFW_KEY_UNKNOWN, "key.categories.aoba")); this.setCategory(Category.Render); this.setDescription("Points toward other players and entities with a line."); - } @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(RenderListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(RenderListener.class, this); } @Override public void onToggle() { } - - @Override - public void onUpdate() { - - } - + @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { + public void OnRender(RenderEvent event) { for (Entity entity : MC.world.getEntities()) { if(entity instanceof LivingEntity && (entity != MC.player)) { //this.getRenderUtils().drawLine3D(mc.player, entity); } } } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - - } } diff --git a/src/main/java/net/aoba/module/modules/render/Trajectory.java b/src/main/java/net/aoba/module/modules/render/Trajectory.java index 2e0fe118..be660670 100644 --- a/src/main/java/net/aoba/module/modules/render/Trajectory.java +++ b/src/main/java/net/aoba/module/modules/render/Trajectory.java @@ -24,9 +24,10 @@ import org.joml.Matrix4f; import org.lwjgl.glfw.GLFW; import org.lwjgl.opengl.GL11; - import com.mojang.blaze3d.systems.RenderSystem; - +import net.aoba.Aoba; +import net.aoba.event.events.RenderEvent; +import net.aoba.event.listeners.RenderListener; import net.aoba.misc.ModuleUtils; import net.aoba.module.Module; import net.minecraft.client.MinecraftClient; @@ -40,10 +41,9 @@ import net.minecraft.item.BowItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.network.packet.Packet; import net.minecraft.util.math.Vec3d; -public class Trajectory extends Module { +public class Trajectory extends Module implements RenderListener { public Trajectory() { this.setName("Trajectory"); @@ -54,27 +54,29 @@ public Trajectory() { @Override public void onDisable() { - + Aoba.getInstance().eventManager.RemoveListener(RenderListener.class, this); } @Override public void onEnable() { - + Aoba.getInstance().eventManager.AddListener(RenderListener.class, this); } @Override public void onToggle() { } - - @Override - public void onUpdate() { + + private double IntepolateThrowPower(Item item) { + float power = (float) Math.pow(((72000 - MinecraftClient.getInstance().player.getItemUseTime()) / 20.0f), 2.0f); + + return power + (power * 2.0f); } @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { + public void OnRender(RenderEvent event) { MinecraftClient mc = MinecraftClient.getInstance(); - + MatrixStack matrixStack = event.GetMatrixStack(); matrixStack.push(); RenderSystem.setShaderColor(0, 0, 0, 1); @@ -116,20 +118,4 @@ public void onRender(MatrixStack matrixStack, float partialTicks) { matrixStack.pop(); } - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - } - - private double IntepolateThrowPower(Item item) { - float power = (float) Math.pow(((72000 - MinecraftClient.getInstance().player.getItemUseTime()) / 20.0f), 2.0f); - - return power + (power * 2.0f); - } - } \ No newline at end of file diff --git a/src/main/java/net/aoba/module/modules/render/XRay.java b/src/main/java/net/aoba/module/modules/render/XRay.java index f56fb50d..fb85c165 100644 --- a/src/main/java/net/aoba/module/modules/render/XRay.java +++ b/src/main/java/net/aoba/module/modules/render/XRay.java @@ -28,8 +28,6 @@ import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; public class XRay extends Module { public static ArrayList blocks = new ArrayList(); @@ -66,11 +64,6 @@ public void onToggle() { } - @Override - public void onUpdate() { - - } - public void initXRay() { blocks.add(Blocks.EMERALD_ORE); blocks.add(Blocks.EMERALD_BLOCK); @@ -105,21 +98,4 @@ public static boolean isXRayBlock(Block b) { } return false; } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - - } - } diff --git a/src/main/java/net/aoba/module/modules/world/AutoFarm.java b/src/main/java/net/aoba/module/modules/world/AutoFarm.java index 05df717b..106f79e1 100644 --- a/src/main/java/net/aoba/module/modules/world/AutoFarm.java +++ b/src/main/java/net/aoba/module/modules/world/AutoFarm.java @@ -27,10 +27,8 @@ import net.minecraft.block.CropBlock; import net.minecraft.block.FarmlandBlock; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; -import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket; import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket.Action; import net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket; @@ -39,12 +37,15 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; +import net.aoba.Aoba; import net.aoba.core.settings.types.FloatSetting; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.TickListener; import net.aoba.misc.ModuleUtils; import org.lwjgl.glfw.GLFW; import net.aoba.module.Module; -public class AutoFarm extends Module { +public class AutoFarm extends Module implements TickListener { private FloatSetting radius; public AutoFarm() { @@ -62,10 +63,12 @@ public void setRadius(int radius) { @Override public void onDisable() { + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override @@ -73,7 +76,7 @@ public void onToggle() { } @Override - public void onUpdate() { + public void OnUpdate(TickEvent event) { int rad = radius.getValue().intValue(); for (int x = -rad; x < rad; x++) { for (int y = -1; y <= 1; y++) { @@ -127,19 +130,4 @@ public void onUpdate() { } } } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - } } \ No newline at end of file diff --git a/src/main/java/net/aoba/module/modules/world/AutoSign.java b/src/main/java/net/aoba/module/modules/world/AutoSign.java index 097b075f..584f2595 100644 --- a/src/main/java/net/aoba/module/modules/world/AutoSign.java +++ b/src/main/java/net/aoba/module/modules/world/AutoSign.java @@ -22,12 +22,9 @@ package net.aoba.module.modules.world; import org.lwjgl.glfw.GLFW; - import net.aoba.cmd.CommandManager; import net.aoba.module.Module; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; public class AutoSign extends Module { String[] text; @@ -61,24 +58,4 @@ public void onEnable() { @Override public void onToggle() { } - - @Override - public void onUpdate() { - - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - - } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - } } diff --git a/src/main/java/net/aoba/module/modules/world/Nuker.java b/src/main/java/net/aoba/module/modules/world/Nuker.java index bb24624b..570e6399 100644 --- a/src/main/java/net/aoba/module/modules/world/Nuker.java +++ b/src/main/java/net/aoba/module/modules/world/Nuker.java @@ -22,23 +22,25 @@ package net.aoba.module.modules.world; import org.lwjgl.glfw.GLFW; - +import net.aoba.Aoba; import net.aoba.core.settings.types.FloatSetting; +import net.aoba.event.events.RenderEvent; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.RenderListener; +import net.aoba.event.listeners.TickListener; import net.aoba.gui.Color; import net.aoba.module.Module; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.client.MinecraftClient; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket; import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket.Action; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.Direction; -public class Nuker extends Module { +public class Nuker extends Module implements RenderListener, TickListener { private MinecraftClient mc; private FloatSetting radius; @@ -59,10 +61,14 @@ public void setRadius(int radius) { @Override public void onDisable() { + Aoba.getInstance().eventManager.RemoveListener(RenderListener.class, this); + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { + Aoba.getInstance().eventManager.AddListener(RenderListener.class, this); + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override @@ -70,8 +76,7 @@ public void onToggle() { } @Override - public void onUpdate() { - + public void OnUpdate(TickEvent event) { int rad = radius.getValue().intValue(); for (int x = -rad; x < rad; x++) { for (int y = rad; y > -rad; y--) { @@ -92,7 +97,7 @@ public void onUpdate() { } @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { + public void OnRender(RenderEvent event) { int rad = radius.getValue().intValue(); for (int x = -rad; x < rad; x++) { for (int y = rad; y > -rad; y--) { @@ -104,19 +109,9 @@ public void onRender(MatrixStack matrixStack, float partialTicks) { if (block == Blocks.AIR || block == Blocks.WATER || block == Blocks.LAVA) continue; - this.getRenderUtils().draw3DBox(matrixStack, new Box(blockpos), new Color(255,0,0), 0.2f); + this.getRenderUtils().draw3DBox(event.GetMatrixStack(), new Box(blockpos), new Color(255,0,0), 0.2f); } } } } - - @Override - public void onSendPacket(Packet packet) { - - } - - @Override - public void onReceivePacket(Packet packet) { - - } } diff --git a/src/main/java/net/aoba/module/modules/world/TileBreaker.java b/src/main/java/net/aoba/module/modules/world/TileBreaker.java index 1ada2b31..9736b9f6 100644 --- a/src/main/java/net/aoba/module/modules/world/TileBreaker.java +++ b/src/main/java/net/aoba/module/modules/world/TileBreaker.java @@ -22,25 +22,26 @@ package net.aoba.module.modules.world; import java.util.ArrayList; - import org.lwjgl.glfw.GLFW; - +import net.aoba.Aoba; import net.aoba.core.settings.types.FloatSetting; +import net.aoba.event.events.RenderEvent; +import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.RenderListener; +import net.aoba.event.listeners.TickListener; import net.aoba.gui.Color; import net.aoba.module.Module; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.client.MinecraftClient; import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.Direction; import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket; import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket.Action; -public class TileBreaker extends Module { +public class TileBreaker extends Module implements TickListener, RenderListener { private MinecraftClient mc; private ArrayList blocks = new ArrayList(); private FloatSetting radius; @@ -62,55 +63,20 @@ public void setRadius(int radius) { @Override public void onDisable() { + Aoba.getInstance().eventManager.RemoveListener(RenderListener.class, this); + Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); } @Override public void onEnable() { + Aoba.getInstance().eventManager.AddListener(RenderListener.class, this); + Aoba.getInstance().eventManager.AddListener(TickListener.class, this); } @Override public void onToggle() { } - @Override - public void onUpdate() { - int rad = this.radius.getValue().intValue(); - for (int x = -rad; x < rad; x++) { - for (int y = rad; y > -rad; y--) { - for (int z = -rad; z < rad; z++) { - BlockPos blockpos = new BlockPos( mc.player.getBlockX() + x, - mc.player.getBlockY() + y, - mc.player.getBlockZ() + z); - Block block = mc.world.getBlockState(blockpos).getBlock(); - if (this.isTileBreakerBlock(block)) { - mc.player.networkHandler.sendPacket( - new PlayerActionC2SPacket(Action.START_DESTROY_BLOCK, blockpos, Direction.NORTH)); - mc.player.networkHandler.sendPacket( - new PlayerActionC2SPacket(Action.STOP_DESTROY_BLOCK, blockpos, Direction.NORTH)); - } - } - } - } - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) { - int rad = this.radius.getValue().intValue(); - for (int x = -rad; x < rad; x++) { - for (int y = rad; y > -rad; y--) { - for (int z = -rad; z < rad; z++) { - BlockPos blockpos = new BlockPos((int) mc.player.getBlockX() + x, - mc.player.getBlockY() + y, - mc.player.getBlockZ() + z); - Block block = mc.world.getBlockState(blockpos).getBlock(); - if (this.isTileBreakerBlock(block)) { - this.getRenderUtils().draw3DBox(matrixStack, new Box(blockpos), new Color(255,0,0), 0.2f); - } - } - } - } - } - private void loadTileBreakerBlocks() { this.blocks.add(Blocks.TORCH); this.blocks.add(Blocks.WALL_TORCH); @@ -155,13 +121,41 @@ public boolean isTileBreakerBlock(Block b) { } @Override - public void onSendPacket(Packet packet) { - + public void OnUpdate(TickEvent event) { + int rad = this.radius.getValue().intValue(); + for (int x = -rad; x < rad; x++) { + for (int y = rad; y > -rad; y--) { + for (int z = -rad; z < rad; z++) { + BlockPos blockpos = new BlockPos( mc.player.getBlockX() + x, + mc.player.getBlockY() + y, + mc.player.getBlockZ() + z); + Block block = mc.world.getBlockState(blockpos).getBlock(); + if (this.isTileBreakerBlock(block)) { + mc.player.networkHandler.sendPacket( + new PlayerActionC2SPacket(Action.START_DESTROY_BLOCK, blockpos, Direction.NORTH)); + mc.player.networkHandler.sendPacket( + new PlayerActionC2SPacket(Action.STOP_DESTROY_BLOCK, blockpos, Direction.NORTH)); + } + } + } + } } @Override - public void onReceivePacket(Packet packet) { - - + public void OnRender(RenderEvent event) { + int rad = this.radius.getValue().intValue(); + for (int x = -rad; x < rad; x++) { + for (int y = rad; y > -rad; y--) { + for (int z = -rad; z < rad; z++) { + BlockPos blockpos = new BlockPos((int) mc.player.getBlockX() + x, + mc.player.getBlockY() + y, + mc.player.getBlockZ() + z); + Block block = mc.world.getBlockState(blockpos).getBlock(); + if (this.isTileBreakerBlock(block)) { + this.getRenderUtils().draw3DBox(event.GetMatrixStack(), new Box(blockpos), new Color(255,0,0), 0.2f); + } + } + } + } } }