Skip to content

Commit e84e63e

Browse files
authored
Fix antidisconnect (#219)
1 parent 0459298 commit e84e63e

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.lambda.client.mixin.client.gui;
2+
3+
import com.lambda.client.gui.mc.LambdaGuiAntiDisconnect;
4+
import com.lambda.client.module.modules.misc.AntiDisconnect;
5+
import com.lambda.client.util.Wrapper;
6+
import net.minecraft.client.gui.GuiButton;
7+
import net.minecraft.client.gui.GuiIngameMenu;
8+
import net.minecraft.client.gui.GuiScreen;
9+
import org.spongepowered.asm.mixin.Mixin;
10+
import org.spongepowered.asm.mixin.injection.At;
11+
import org.spongepowered.asm.mixin.injection.Inject;
12+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
13+
14+
@Mixin(GuiIngameMenu.class)
15+
public class MixinGuiIngameMenu extends GuiScreen {
16+
@Inject(method = "actionPerformed", at = @At("HEAD"), cancellable = true)
17+
public void actionPerformed(GuiButton button, CallbackInfo callbackInfo) {
18+
if (button.id == 1) {
19+
if (AntiDisconnect.INSTANCE.isEnabled()) {
20+
Wrapper.getMinecraft().displayGuiScreen(new LambdaGuiAntiDisconnect());
21+
callbackInfo.cancel();
22+
}
23+
}
24+
}
25+
}

src/main/resources/mixins.lambda.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"gui.MixinGuiChest",
4242
"gui.MixinGuiContainer",
4343
"gui.MixinGuiIngameForge",
44+
"gui.MixinGuiIngameMenu",
4445
"gui.MixinGuiInventory",
4546
"gui.MixinGuiMainMenu",
4647
"gui.MixinGuiNewChat",

0 commit comments

Comments
 (0)