From 2da51458bd4bf79c8d52f4ad6d12868d8b2183bf Mon Sep 17 00:00:00 2001 From: Hudson <35442144+huddy987@users.noreply.github.com> Date: Sat, 1 Jan 2022 19:34:41 -0700 Subject: [PATCH] Fix antidisconnect --- .../mixin/client/gui/MixinGuiIngameMenu.java | 25 +++++++++++++++++++ src/main/resources/mixins.lambda.json | 1 + 2 files changed, 26 insertions(+) create mode 100644 src/main/java/com/lambda/client/mixin/client/gui/MixinGuiIngameMenu.java diff --git a/src/main/java/com/lambda/client/mixin/client/gui/MixinGuiIngameMenu.java b/src/main/java/com/lambda/client/mixin/client/gui/MixinGuiIngameMenu.java new file mode 100644 index 000000000..2510068e1 --- /dev/null +++ b/src/main/java/com/lambda/client/mixin/client/gui/MixinGuiIngameMenu.java @@ -0,0 +1,25 @@ +package com.lambda.client.mixin.client.gui; + +import com.lambda.client.gui.mc.LambdaGuiAntiDisconnect; +import com.lambda.client.module.modules.misc.AntiDisconnect; +import com.lambda.client.util.Wrapper; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiIngameMenu; +import net.minecraft.client.gui.GuiScreen; +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; + +@Mixin(GuiIngameMenu.class) +public class MixinGuiIngameMenu extends GuiScreen { + @Inject(method = "actionPerformed", at = @At("HEAD"), cancellable = true) + public void actionPerformed(GuiButton button, CallbackInfo callbackInfo) { + if (button.id == 1) { + if (AntiDisconnect.INSTANCE.isEnabled()) { + Wrapper.getMinecraft().displayGuiScreen(new LambdaGuiAntiDisconnect()); + callbackInfo.cancel(); + } + } + } +} diff --git a/src/main/resources/mixins.lambda.json b/src/main/resources/mixins.lambda.json index a5518651a..275c3a73b 100644 --- a/src/main/resources/mixins.lambda.json +++ b/src/main/resources/mixins.lambda.json @@ -41,6 +41,7 @@ "gui.MixinGuiChest", "gui.MixinGuiContainer", "gui.MixinGuiIngameForge", + "gui.MixinGuiIngameMenu", "gui.MixinGuiInventory", "gui.MixinGuiMainMenu", "gui.MixinGuiNewChat",