From c2ca99af03d8ab1aad708ed75e7bea2463c6d51a Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Wed, 30 Jul 2014 21:02:37 -0500 Subject: [PATCH] Added Feature: #0717 - Remove from Interface Terminal --- client/gui/implementations/GuiInterface.java | 12 ++++++++++++ container/implementations/ContainerInterface.java | 4 ++++ .../implementations/ContainerInterfaceTerminal.java | 12 ++++++++++-- core/localization/GuiText.java | 2 +- helpers/DualityInterface.java | 1 + 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/client/gui/implementations/GuiInterface.java b/client/gui/implementations/GuiInterface.java index 7d6a8923..07a88448 100644 --- a/client/gui/implementations/GuiInterface.java +++ b/client/gui/implementations/GuiInterface.java @@ -11,6 +11,7 @@ import appeng.api.config.Settings; import appeng.api.config.YesNo; import appeng.client.gui.widgets.GuiImgButton; import appeng.client.gui.widgets.GuiTabButton; +import appeng.client.gui.widgets.GuiToggleButton; import appeng.container.implementations.ContainerInterface; import appeng.core.AELog; import appeng.core.localization.GuiText; @@ -25,6 +26,7 @@ public class GuiInterface extends GuiUpgradeable GuiTabButton priority; GuiImgButton BlockMode; + GuiToggleButton interfaceMode; public GuiInterface(InventoryPlayer inventoryPlayer, IInterfaceHost te) { super( new ContainerInterface( inventoryPlayer, te ) ); @@ -52,6 +54,9 @@ public class GuiInterface extends GuiUpgradeable try { + if ( btn == interfaceMode ) + NetworkHandler.instance.sendToServer( new PacketConfigButton( Settings.INTERFACE_TERMINAL, backwards ) ); + if ( btn == BlockMode ) NetworkHandler.instance.sendToServer( new PacketConfigButton( BlockMode.getSetting(), backwards ) ); @@ -70,6 +75,10 @@ public class GuiInterface extends GuiUpgradeable BlockMode = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.BLOCK, YesNo.NO ); buttonList.add( BlockMode ); + + interfaceMode = new GuiToggleButton( this.guiLeft - 18, guiTop + 26, 84, 85, GuiText.InterfaceTerminal.getLocal(), + GuiText.InterfaceTerminalHint.getLocal() ); + buttonList.add( interfaceMode ); } protected String getBackground() @@ -83,6 +92,9 @@ public class GuiInterface extends GuiUpgradeable if ( BlockMode != null ) BlockMode.set( ((ContainerInterface) cvb).bMode ); + if ( interfaceMode != null ) + interfaceMode.setState( ((ContainerInterface) cvb).iTermMode == YesNo.YES ); + fontRendererObj.drawString( getGuiDisplayName( GuiText.Interface.getLocal() ), 8, 6, 4210752 ); fontRendererObj.drawString( GuiText.Config.getLocal(), 18, 6 + 11 + 7, 4210752 ); diff --git a/container/implementations/ContainerInterface.java b/container/implementations/ContainerInterface.java index 8ebfd20b..47db08af 100644 --- a/container/implementations/ContainerInterface.java +++ b/container/implementations/ContainerInterface.java @@ -21,6 +21,9 @@ public class ContainerInterface extends ContainerUpgradeable @GuiSync(3) public YesNo bMode = YesNo.NO; + @GuiSync(4) + public YesNo iTermMode = YesNo.YES; + public ContainerInterface(InventoryPlayer ip, IInterfaceHost te) { super( ip, te.getInterfaceDuality().getHost() ); @@ -52,6 +55,7 @@ public class ContainerInterface extends ContainerUpgradeable protected void loadSettingsFromHost(IConfigManager cm) { this.bMode = (YesNo) cm.getSetting( Settings.BLOCK ); + this.iTermMode = (YesNo) cm.getSetting( Settings.INTERFACE_TERMINAL ); } public int availableUpgrades() diff --git a/container/implementations/ContainerInterfaceTerminal.java b/container/implementations/ContainerInterfaceTerminal.java index 679481c5..565b2457 100644 --- a/container/implementations/ContainerInterfaceTerminal.java +++ b/container/implementations/ContainerInterfaceTerminal.java @@ -11,6 +11,8 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.config.Settings; +import appeng.api.config.YesNo; import appeng.api.networking.IGrid; import appeng.api.networking.IGridNode; import appeng.api.networking.security.IActionHost; @@ -217,6 +219,9 @@ public class ContainerInterfaceTerminal extends AEBaseContainer if ( gn.isActive() ) { IInterfaceHost ih = (IInterfaceHost) gn.getMachine(); + if ( ih.getInterfaceDuality().getConfigManager().getSetting( Settings.INTERFACE_TERMINAL ) == YesNo.NO ) + continue; + InvTracker t = diList.get( ih ); if ( t == null ) @@ -237,6 +242,9 @@ public class ContainerInterfaceTerminal extends AEBaseContainer if ( gn.isActive() ) { IInterfaceHost ih = (IInterfaceHost) gn.getMachine(); + if ( ih.getInterfaceDuality().getConfigManager().getSetting( Settings.INTERFACE_TERMINAL ) == YesNo.NO ) + continue; + InvTracker t = diList.get( ih ); if ( t == null ) @@ -310,7 +318,7 @@ public class ContainerInterfaceTerminal extends AEBaseContainer { IInterfaceHost ih = (IInterfaceHost) gn.getMachine(); DualityInterface dual = ih.getInterfaceDuality(); - if ( gn.isActive() ) + if ( gn.isActive() && dual.getConfigManager().getSetting( Settings.INTERFACE_TERMINAL ) == YesNo.YES ) diList.put( ih, new InvTracker( dual, dual.getPatterns(), dual.getTermName() ) ); } @@ -318,7 +326,7 @@ public class ContainerInterfaceTerminal extends AEBaseContainer { IInterfaceHost ih = (IInterfaceHost) gn.getMachine(); DualityInterface dual = ih.getInterfaceDuality(); - if ( gn.isActive() ) + if ( gn.isActive() && dual.getConfigManager().getSetting( Settings.INTERFACE_TERMINAL ) == YesNo.YES ) diList.put( ih, new InvTracker( dual, dual.getPatterns(), dual.getTermName() ) ); } } diff --git a/core/localization/GuiText.java b/core/localization/GuiText.java index 6eb3546b..0b2fdddb 100644 --- a/core/localization/GuiText.java +++ b/core/localization/GuiText.java @@ -32,7 +32,7 @@ public enum GuiText OfSecondOutput, NoSecondOutput, RFTunnel, Stores, Next, SelectAmount, Lumen, Empty, ConfirmCrafting, - Stored, Crafting, Scheduled, CraftingStatus, Cancel, FromStorage, ToCraft, CraftingPlan, CalculatingWait, Start, Bytes, CraftingCPU, Automatic, CoProcessors, Simulation, Missing, InterfaceTerminal, NoCraftingCPUs, LightTunnel, Clean, InvalidPattern; + Stored, Crafting, Scheduled, CraftingStatus, Cancel, FromStorage, ToCraft, CraftingPlan, CalculatingWait, Start, Bytes, CraftingCPU, Automatic, CoProcessors, Simulation, Missing, InterfaceTerminal, NoCraftingCPUs, LightTunnel, Clean, InvalidPattern, InterfaceTerminalHint; String root; diff --git a/helpers/DualityInterface.java b/helpers/DualityInterface.java index a10dc678..8ada1eae 100644 --- a/helpers/DualityInterface.java +++ b/helpers/DualityInterface.java @@ -202,6 +202,7 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt upgrades = new UpgradeInventory( gridProxy.getMachineRepresentation(), this, 1 ); cm.registerSetting( Settings.BLOCK, YesNo.NO ); + cm.registerSetting( Settings.INTERFACE_TERMINAL, YesNo.YES ); iHost = ih; craftingTracker = new MultiCraftingTracker( iHost, 9 );