From afb18445b175ce54b9bae6f59ab73a2502be9e42 Mon Sep 17 00:00:00 2001 From: Matthias Luger Date: Tue, 16 May 2023 23:21:39 +0200 Subject: handle crash when clicking on cancel --- src/main/java/de/torui/coflsky/gui/bingui/BinGuiCurrent.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/torui/coflsky/gui/bingui/BinGuiCurrent.java b/src/main/java/de/torui/coflsky/gui/bingui/BinGuiCurrent.java index edb87d0..d2cb0fd 100644 --- a/src/main/java/de/torui/coflsky/gui/bingui/BinGuiCurrent.java +++ b/src/main/java/de/torui/coflsky/gui/bingui/BinGuiCurrent.java @@ -29,8 +29,6 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.input.Mouse; - -import java.awt.event.MouseWheelEvent; import java.util.Base64; import java.util.List; import java.util.Locale; @@ -81,7 +79,7 @@ public class BinGuiCurrent extends GuiChest { public void onGuiOpen(GuiOpenEvent event) { if (event.gui == null) { - resetGUI(); + return; } isRendered = false; @@ -221,7 +219,6 @@ public class BinGuiCurrent extends GuiChest { //play a anvilsound mc.thePlayer.playSound("random.anvil_land", 1, 1); resetGUI(); - mc.thePlayer.closeScreen(); } } @@ -273,7 +270,7 @@ public class BinGuiCurrent extends GuiChest { itemStack = null; hasInitialMouseSet = false; isRendered = false; - Mouse.setGrabbed(true); + mc.thePlayer.closeScreen(); MinecraftForge.EVENT_BUS.unregister(this); } @@ -339,7 +336,6 @@ public class BinGuiCurrent extends GuiChest { ) { //close the gui resetGUI(); - mc.thePlayer.closeScreen(); } } -- cgit