From 357341c87d6ff28d8bc0b30c498a2ff1d5a21cab Mon Sep 17 00:00:00 2001 From: Christopher Wessel Date: Sat, 15 Oct 2022 14:03:59 -0700 Subject: [PATCH] (#11628) Fix crash when Cancel button is selected THIS CHANGE RELIES ON AE2 CHANGE at: https://github.com/GTNewHorizons/Applied-Energistics-2-Unofficial/pull/194 Use Cancel Button from the base GUI instead of adding a new one. The button that was added was never the button that was sent into the ActionPerformed method. Tested and verified in local server. --- .../client/gui/GuiCraftConfirmBridge.java | 35 +------------------ 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/src/main/java/thaumicenergistics/client/gui/GuiCraftConfirmBridge.java b/src/main/java/thaumicenergistics/client/gui/GuiCraftConfirmBridge.java index dbdd3820..be9c9038 100644 --- a/src/main/java/thaumicenergistics/client/gui/GuiCraftConfirmBridge.java +++ b/src/main/java/thaumicenergistics/client/gui/GuiCraftConfirmBridge.java @@ -18,12 +18,6 @@ import thaumicenergistics.api.grid.ICraftingIssuerHost; public class GuiCraftConfirmBridge extends GuiCraftConfirm { - - /** - * Cancel button. - */ - protected GuiButton buttonCancel; - /** * Player using this GUI */ @@ -59,36 +53,9 @@ public class GuiCraftConfirmBridge super.actionPerformed( btn ); // Cancel button or start button? - if( ( btn == this.buttonCancel ) || ( btn.displayString == GuiText.Start.getLocal() ) ) + if( ( btn == super.getCancelButton() ) || ( btn.displayString.equals( GuiText.Start.getLocal() ) ) ) { this.host.launchGUI( this.player ); } } - - @Override - public void initGui() - { - // Call super - super.initGui(); - - // Locate and remove the null cancel button - for( int i = 0; i < this.buttonList.size(); ++i ) - { - // Get the button - Object btn = this.buttonList.get( i ); - - // Is it null? - if( btn == null ) - { - // Remove it and move i back 1 - this.buttonList.remove( i-- ); - } - } - - // Create a new cancel button - this.buttonList.add( this.buttonCancel = new GuiButton( 0, this.guiLeft + 6, ( this.guiTop + this.ySize ) - 25, 50, 20, GuiText.Cancel - .getLocal() ) ); - - } - }