Skip to content

Commit

Permalink
Fixed Criticals + clientside crash.
Browse files Browse the repository at this point in the history
- Fixed Criticals causing crash immediately on launch.
- Removed unnecessary AobaClient update function.
  • Loading branch information
coltonk9043 committed Jun 10, 2024
1 parent cb246ae commit ac013c5
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 39 deletions.
8 changes: 0 additions & 8 deletions src/main/java/net/aoba/AobaClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,6 @@ public void loadAssets() {
//GuiManager.borderColor.setMode(ColorMode.Rainbow);
//GuiManager.foregroundColor.setMode(ColorMode.Random);
}

/**
* Updates Aoba on a per-tick basis.
*/
public void update() {
moduleManager.update();
hudManager.update();
}

/**
* Renders the HUD every frame
Expand Down
1 change: 0 additions & 1 deletion src/main/java/net/aoba/gui/AbstractGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public abstract class AbstractGui implements IGuiElement, LeftMouseDownListener,
protected double lastClickOffsetY;
protected boolean inheritHeightFromChildren = true;


protected ArrayList<Component> children = new ArrayList<>();

public AbstractGui(String ID, float x, float y, float width, float height) {
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/net/aoba/gui/GuiManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
import net.aoba.event.events.KeyDownEvent;
import net.aoba.event.events.LeftMouseDownEvent;
import net.aoba.event.events.LeftMouseUpEvent;
import net.aoba.event.events.TickEvent;
import net.aoba.event.listeners.LeftMouseDownListener;
import net.aoba.event.listeners.LeftMouseUpListener;
import net.aoba.event.listeners.TickListener;
import net.aoba.event.listeners.KeyDownListener;
import org.joml.Matrix4f;
import org.lwjgl.glfw.GLFW;
Expand Down Expand Up @@ -56,7 +58,7 @@
import net.minecraft.client.util.Window;
import net.minecraft.client.util.math.MatrixStack;

public class GuiManager implements LeftMouseDownListener, LeftMouseUpListener, KeyDownListener {
public class GuiManager implements LeftMouseDownListener, LeftMouseUpListener, KeyDownListener, TickListener {
protected MinecraftClient mc = MinecraftClient.getInstance();

public KeybindSetting clickGuiButton = new KeybindSetting("key.clickgui", "ClickGUI Key", InputUtil.fromKeyCode(GLFW.GLFW_KEY_GRAVE_ACCENT, 0));
Expand Down Expand Up @@ -105,6 +107,7 @@ public GuiManager() {
SettingManager.registerSetting(clickGuiButton, Aoba.getInstance().settingManager.modules_category);

Aoba.getInstance().eventManager.AddListener(KeyDownListener.class, this);
Aoba.getInstance().eventManager.AddListener(TickListener.class, this);
}

public void Initialize() {
Expand Down Expand Up @@ -191,7 +194,8 @@ public void SetHudActive(AbstractHud hud, boolean state) {
* Getter for the current color used by the GUI for text rendering.
* @return Current Color
*/
public void update() {
@Override
public void OnUpdate(TickEvent event) {
if(!Aoba.getInstance().isGhosted()){

/**
Expand Down Expand Up @@ -227,7 +231,7 @@ public void update() {

//Aoba.getInstance().eventManager.Fire(new MouseScrollEvent(5.0f, 5.0f));
}

public void draw(DrawContext drawContext, float tickDelta) {
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
Expand Down
30 changes: 5 additions & 25 deletions src/main/java/net/aoba/mixin/MinecraftClientMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package net.aoba.mixin;

import net.aoba.Aoba;
import net.aoba.AobaClient;
import net.aoba.event.events.TickEvent;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.Mouse;
Expand Down Expand Up @@ -57,19 +58,11 @@ private void onfinishedloading(CallbackInfo info) {
Aoba.getInstance().loadAssets();
}

// TODO: this was moved to the FontManager class.
//@Inject(at = @At("TAIL"), method = "initFont(Z)V")
//private void onInitFont(boolean forcesUnicode, CallbackInfo info) {
// Aoba.getInstance().loadAssets();
//}

@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();
}
}

Expand All @@ -87,22 +80,6 @@ private Session getSessionForSessionProperties(MinecraftClient mc)
return session;
}

@Inject(at = {@At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;crosshairTarget:Lnet/minecraft/util/hit/HitResult;", ordinal = 0)}, method = {"doAttack()Z"}, cancellable = true)
private void onDoAttack(CallbackInfoReturnable<Boolean> cir) {
//double mouseX = Math.ceil(mouse.getX());
//double mouseY = Math.ceil(mouse.getY());

//System.out.println("DOuble Click?");
//MouseLeftClickEvent event = new MouseLeftClickEvent(mouseX, mouseY);

//Aoba.getInstance().eventManager.Fire(event);

//if(event.IsCancelled()) {
// cir.setReturnValue(false);
// cir.cancel();
//}
}

@Inject(at = {@At(value = "HEAD")}, method = {"close()V"})
private void onClose(CallbackInfo ci) {
try {
Expand All @@ -114,6 +91,9 @@ private void onClose(CallbackInfo ci) {

@Inject(at = {@At(value="HEAD")}, method = {"openGameMenu(Z)V"})
private void onOpenPauseMenu(boolean pause, CallbackInfo ci) {
Aoba.getInstance().hudManager.setClickGuiOpen(false);
AobaClient aoba = Aoba.getInstance();
if(aoba.hudManager != null) {
Aoba.getInstance().hudManager.setClickGuiOpen(false);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
@Mixin(PlayerInteractEntityC2SPacket.class)
public interface IPlayerInteractEntityC2SPacket {
@Invoker("write")
void write(PacketByteBuf buf);
public void invokeWrite(PacketByteBuf buf);
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void OnSendPacket(SendPacketEvent event) {
IPlayerInteractEntityC2SPacket packetAccessor = (IPlayerInteractEntityC2SPacket)playerInteractPacket;

PacketByteBuf packetBuf = new PacketByteBuf(Unpooled.buffer());
packetAccessor.write(packetBuf);
packetAccessor.invokeWrite(packetBuf);
packetBuf.readVarInt();
InteractType type = packetBuf.readEnumConstant(InteractType.class);

Expand Down

0 comments on commit ac013c5

Please sign in to comment.