11package com .circulation .random_complement .mixin .ae2 .gui ;
22
3+ import appeng .api .storage .ITerminalHost ;
34import appeng .api .storage .data .IAEItemStack ;
45import appeng .api .storage .data .IItemList ;
56import appeng .client .gui .AEBaseGui ;
67import appeng .client .gui .implementations .GuiCraftConfirm ;
78import appeng .core .AELog ;
9+ import appeng .core .sync .GuiBridge ;
810import appeng .core .sync .network .NetworkHandler ;
911import appeng .core .sync .packets .PacketValueConfig ;
12+ import appeng .tile .misc .TileSecurityStation ;
1013import appeng .util .Platform ;
1114import appeng .util .item .AEItemStack ;
1215import com .circulation .random_complement .RandomComplement ;
2528import net .minecraft .client .gui .GuiScreen ;
2629import net .minecraft .client .resources .I18n ;
2730import net .minecraft .client .util .ITooltipFlag ;
31+ import net .minecraft .entity .player .InventoryPlayer ;
2832import net .minecraft .inventory .Container ;
2933import net .minecraft .item .ItemStack ;
3034import net .minecraftforge .fml .common .Loader ;
@@ -53,6 +57,9 @@ public MixinGuiCraftConfirm(Container container) {
5357 super (container );
5458 }
5559
60+ @ Shadow (remap = false )
61+ private GuiBridge OriginalGui ;
62+
5663 @ Unique
5764 private static String randomComplement$getItemInformation (final Object o ) {
5865 String dspToolTip = "" ;
@@ -100,6 +107,14 @@ public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
100107
101108 }
102109
110+ @ Inject (method = "<init>" , at = @ At ("TAIL" ))
111+ public void onInit (InventoryPlayer inventoryPlayer , ITerminalHost te , CallbackInfo ci ) {
112+ if (te instanceof TileSecurityStation ) {
113+ this .OriginalGui = GuiBridge .GUI_SECURITY ;
114+ }
115+
116+ }
117+
103118 @ Inject (method = "drawFG" , at = @ At ("TAIL" ), remap = false )
104119 private void onDrawFG (int offsetX , int offsetY , int mouseX , int mouseY , CallbackInfo ci ) {
105120 if (r$getCancel ().isMouseOver () && Loader .isModLoaded ("jei" )) {
@@ -108,7 +123,7 @@ private void onDrawFG(int offsetX, int offsetY, int mouseX, int mouseY, Callback
108123 }
109124
110125 @ Inject (method = "actionPerformed" , at = @ At ("HEAD" ), cancellable = true )
111- public void onActionPerformed1 (GuiButton btn , CallbackInfo ci ) {
126+ public void onActionPerformed (GuiButton btn , CallbackInfo ci ) {
112127 if (Loader .isModLoaded ("jei" ) && btn == r$getCancel () && isShiftKeyDown ()) rc$addMissBookmark ();
113128 if (RCInputHandler .getOldGui () == null ) return ;
114129 if (btn == this .start || btn == r$getCancel ()) {
@@ -123,7 +138,9 @@ public void onActionPerformed1(GuiButton btn, CallbackInfo ci) {
123138 GuiScreen oldGui ;
124139 if ((oldGui = RCInputHandler .getOldGui ()) != null ) {
125140 RCInputHandler .setDelayMethod (() -> Minecraft .getMinecraft ().displayGuiScreen (oldGui ));
126- RandomComplement .NET_CHANNEL .sendToServer (new ContainerRollBACK ());
141+ if (btn == r$getCancel ()) {
142+ RandomComplement .NET_CHANNEL .sendToServer (new ContainerRollBACK ());
143+ }
127144 }
128145 ci .cancel ();
129146 }
0 commit comments