Fixed potential memory leak in the UI code.

This commit is contained in:
Gunther De Wachter
2017-06-30 17:17:34 +02:00
parent b1e249aad0
commit 10e050c35b
2 changed files with 5 additions and 0 deletions
@@ -104,6 +104,7 @@ public abstract class AEBaseGui extends GuiContainer
super( container );
this.subGui = switchingGuis;
switchingGuis = false;
// TODO : Remove when mezz removes displayGuiScreenWithoutClose() in 1.12.
MinecraftForge.EVENT_BUS.register( this );
}
@@ -585,6 +586,7 @@ public abstract class AEBaseGui extends GuiContainer
return false;
}
// TODO : Remove when mezz removes displayGuiScreenWithoutClose() in 1.12.
public void onGuiOpenEvent(GuiOpenEvent event) { // Why oh why mezz? (RecipesGui.java, displayGuiScreenWithoutClose()
if(event.getGui() instanceof IRecipesGui)
{
@@ -597,6 +599,8 @@ public abstract class AEBaseGui extends GuiContainer
{
super.onGuiClosed();
this.subGui = true; // in case the gui is reopened later ( i'm looking at you NEI )
// TODO : Remove when mezz removes displayGuiScreenWithoutClose() in 1.12.
MinecraftForge.EVENT_BUS.unregister( this );
}
protected Slot getSlot( final int mouseX, final int mouseY )