(#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.
This commit is contained in:
Christopher Wessel committed 2022-10-15 14:03:59 -07:00
1 parent d1e1725eb0
commit 357341c87d
1 file changed
+1 -34
@@ -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() ) );
}
}