diff --git a/src/main/java/com/glodblock/github/client/gui/GuiMagnet.java b/src/main/java/com/glodblock/github/client/gui/GuiMagnet.java index 05b02d10..8897770e 100644 --- a/src/main/java/com/glodblock/github/client/gui/GuiMagnet.java +++ b/src/main/java/com/glodblock/github/client/gui/GuiMagnet.java @@ -45,12 +45,12 @@ public class GuiMagnet extends AEBaseMEGui { private GuiFCImgButton disable; private String action; - private boolean var; + private boolean value; - public Component(int x, int y, boolean var, String action) { + public Component(int x, int y, boolean value, String action) { this.enable = new GuiFCImgButton(x, y, "ENABLE_12x", "ENABLE", false); this.disable = new GuiFCImgButton(x, y, "DISABLE_12x", "DISABLE", false); - this.var = var; + this.value = value; this.action = action; buttonList.add(this.enable); buttonList.add(this.disable); @@ -60,20 +60,20 @@ public class GuiMagnet extends AEBaseMEGui { return btn == this.enable || btn == this.disable; } - public boolean getVar() { - return this.var; + public boolean getValue() { + return this.value; } - public void setVar(boolean var) { - this.var = var; + public void setValue(boolean value) { + this.value = value; } public void send() { - FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidTerminalBtns(this.action, !this.getVar())); + FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidTerminalBtns(this.action, !this.getValue())); } public void draw() { - if (var) { + if (value) { this.enable.visible = true; this.disable.visible = false; } else { @@ -138,9 +138,9 @@ public class GuiMagnet extends AEBaseMEGui { .drawString(getGuiDisplayName(NameConst.i18n(NameConst.GUI_MAGNET_CARD_META)), 61, 34, 0x404040); this.fontRendererObj .drawString(getGuiDisplayName(NameConst.i18n(NameConst.GUI_MAGNET_CARD_ORE)), 61, 46, 0x404040); - this.components[0].setVar(this.cont.nbt); - this.components[1].setVar(this.cont.meta); - this.components[2].setVar(this.cont.ore); + this.components[0].setValue(this.cont.nbt); + this.components[1].setValue(this.cont.meta); + this.components[2].setValue(this.cont.ore); for (Component c : components) { c.draw(); } diff --git a/src/main/java/com/glodblock/github/client/gui/base/FCBaseMEGui.java b/src/main/java/com/glodblock/github/client/gui/base/FCBaseMEGui.java index dbdb63ff..f54997db 100644 --- a/src/main/java/com/glodblock/github/client/gui/base/FCBaseMEGui.java +++ b/src/main/java/com/glodblock/github/client/gui/base/FCBaseMEGui.java @@ -63,17 +63,17 @@ public abstract class FCBaseMEGui extends AEBaseMEGui { protected boolean drawSwitchGuiBtn; private boolean hasMagnetCard = false; private StorageChannel channel = null; + private final FCBaseContainer container; + protected final int buttonOffset = 18; public FCBaseMEGui(final InventoryPlayer inventoryPlayer, Container container) { super(container); - if (container instanceof FCBaseContainer) { - Object target = ((FCBaseContainer) container).getTarget(); - if (target instanceof IWirelessTerminal - && ((IWirelessTerminal) target).getItemStack().getItem() instanceof ItemWirelessUltraTerminal) { - this.drawSwitchGuiBtn = true; - this.hasMagnetCard = Util.Wireless.hasMagnetCard(((IWirelessTerminal) target).getItemStack()); - this.channel = ((IWirelessTerminal) target).getChannel(); - } + this.container = (FCBaseContainer) container; + if (this.container.getTarget() instanceof IWirelessTerminal iwt + && iwt.getItemStack().getItem() instanceof ItemWirelessUltraTerminal) { + this.drawSwitchGuiBtn = true; + this.hasMagnetCard = Util.Wireless.hasMagnetCard(iwt.getItemStack()); + this.channel = iwt.getChannel(); } } @@ -112,17 +112,17 @@ public abstract class FCBaseMEGui extends AEBaseMEGui { protected ItemMagnetCard.Mode getMagnetMode() { if (this.hasMagnetCard) { - return ((FCBaseContainer) this.inventorySlots).mode; + return this.container.mode; } return null; } protected boolean isRestock() { - return ((FCBaseContainer) this.inventorySlots).restock; + return this.container.restock; } protected boolean isSyncData() { - return ((FCBaseContainer) this.inventorySlots).sync; + return this.container.sync; } @Override @@ -131,16 +131,16 @@ public abstract class FCBaseMEGui extends AEBaseMEGui { } protected void setSyncState() { - if (this.inventorySlots instanceof FCContainerMonitor && !isPortableCell()) { + if (this.container instanceof FCContainerMonitor && !isPortableCell()) { this.buttonList.add( this.dataSyncEnableBtn = new GuiFCImgButton( - this.guiLeft + this.xSize - 18, + this.guiLeft + this.xSize - buttonOffset, this.guiTop + this.ySize - 44, "DATA_SYNC", "ENABLE")); this.buttonList.add( this.dataSyncDisableBtn = new GuiFCImgButton( - this.guiLeft + this.xSize - 18, + this.guiLeft + this.xSize - buttonOffset, this.guiTop + this.ySize - 44, "DATA_SYNC", "DISABLE")); @@ -167,25 +167,25 @@ public abstract class FCBaseMEGui extends AEBaseMEGui { if (this.getMagnetMode() != null && this.channel == StorageChannel.ITEMS) { this.buttonList.add( this.magnetOff = new GuiFCImgButton( - this.guiLeft + this.xSize - 18, + this.guiLeft + this.xSize - buttonOffset, this.guiTop + this.ySize - 124, "MAGNET_CARD", "OFF")); this.buttonList.add( this.magnetInv = new GuiFCImgButton( - this.guiLeft + this.xSize - 18, + this.guiLeft + this.xSize - buttonOffset, this.guiTop + this.ySize - 124, "MAGNET_CARD", "INV")); this.buttonList.add( this.magnetME = new GuiFCImgButton( - this.guiLeft + this.xSize - 18, + this.guiLeft + this.xSize - buttonOffset, this.guiTop + this.ySize - 124, "MAGNET_CARD", "ME")); this.buttonList.add( this.magnetFilter = new GuiFCImgButton( - this.guiLeft + this.xSize - 18, + this.guiLeft + this.xSize - buttonOffset, this.guiTop + this.ySize - 104, "MAGNET_CARD", "FILTER")); @@ -193,13 +193,13 @@ public abstract class FCBaseMEGui extends AEBaseMEGui { if (this.channel == StorageChannel.ITEMS) { this.buttonList.add( this.restockEnableBtn = new GuiFCImgButton( - this.guiLeft + this.xSize - 18, + this.guiLeft + this.xSize - buttonOffset, this.guiTop + this.ySize - 84, "RESTOCK", "ENABLE")); this.buttonList.add( this.restockDisableBtn = new GuiFCImgButton( - this.guiLeft + this.xSize - 18, + this.guiLeft + this.xSize - buttonOffset, this.guiTop + this.ySize - 84, "RESTOCK", "DISABLE")); @@ -207,7 +207,7 @@ public abstract class FCBaseMEGui extends AEBaseMEGui { if (!(this instanceof GuiFluidCraftingWireless)) { this.buttonList.add( this.CraftingTerminal = new GuiFCImgButton( - this.guiLeft - 18, + this.guiLeft - buttonOffset, this.getOffsetY(), "CRAFT_TEM", "YES")); @@ -217,7 +217,7 @@ public abstract class FCBaseMEGui extends AEBaseMEGui { if (!(this instanceof GuiFluidPatternWireless)) { this.buttonList.add( this.PatternTerminal = new GuiFCImgButton( - this.guiLeft - 18, + this.guiLeft - buttonOffset, this.getOffsetY(), "PATTERN_TEM", "YES")); @@ -227,7 +227,7 @@ public abstract class FCBaseMEGui extends AEBaseMEGui { if (!(this instanceof GuiFluidPatternExWireless)) { this.buttonList.add( this.PatternTerminalEx = new GuiFCImgButton( - this.guiLeft - 18, + this.guiLeft - buttonOffset, this.getOffsetY(), "PATTERN_EX_TEM", "YES")); @@ -236,14 +236,18 @@ public abstract class FCBaseMEGui extends AEBaseMEGui { } if (!(this instanceof GuiFluidPortableCell)) { this.buttonList.add( - this.FluidTerminal = new GuiFCImgButton(this.guiLeft - 18, this.getOffsetY(), "FLUID_TEM", "YES")); + this.FluidTerminal = new GuiFCImgButton( + this.guiLeft - buttonOffset, + this.getOffsetY(), + "FLUID_TEM", + "YES")); this.setOffsetY(this.getOffsetY() + 20); termBtns.add(this.FluidTerminal); } if (!(this instanceof GuiInterfaceWireless)) { this.buttonList.add( this.InterfaceTerminal = new GuiFCImgButton( - this.guiLeft - 18, + this.guiLeft - buttonOffset, this.getOffsetY(), "INTERFACE_TEM", "YES")); @@ -252,14 +256,18 @@ public abstract class FCBaseMEGui extends AEBaseMEGui { } if (!(this instanceof GuiLevelWireless)) { this.buttonList.add( - this.LevelTerminal = new GuiFCImgButton(this.guiLeft - 18, this.getOffsetY(), "LEVEL_TEM", "YES")); + this.LevelTerminal = new GuiFCImgButton( + this.guiLeft - buttonOffset, + this.getOffsetY(), + "LEVEL_TEM", + "YES")); this.setOffsetY(this.getOffsetY() + 20); termBtns.add(this.LevelTerminal); } if (ModAndClassUtil.ThE && !(this instanceof GuiEssentiaTerminal)) { this.buttonList.add( this.EssentiaTerminal = new GuiFCImgButton( - this.guiLeft - 18, + this.guiLeft - buttonOffset, this.getOffsetY(), "ESSENTIA_TEM", "YES")); @@ -283,10 +291,8 @@ public abstract class FCBaseMEGui extends AEBaseMEGui { magnetButtons[i].visible = getMagnetMode().ordinal() == i; } } - if (this.inventorySlots instanceof FCBaseContainer) { - this.dataSyncDisableBtn.visible = !isSyncData(); - this.dataSyncEnableBtn.visible = isSyncData(); - } + this.dataSyncDisableBtn.visible = !isSyncData(); + this.dataSyncEnableBtn.visible = isSyncData(); if (this.drawSwitchGuiBtn && this.channel == StorageChannel.ITEMS) { // Only ultra terminal this.restockDisableBtn.visible = !this.isRestock(); this.restockEnableBtn.visible = this.isRestock(); diff --git a/src/main/java/com/glodblock/github/client/gui/container/base/FCBaseContainer.java b/src/main/java/com/glodblock/github/client/gui/container/base/FCBaseContainer.java index 9be67fea..d468272d 100644 --- a/src/main/java/com/glodblock/github/client/gui/container/base/FCBaseContainer.java +++ b/src/main/java/com/glodblock/github/client/gui/container/base/FCBaseContainer.java @@ -17,7 +17,7 @@ public abstract class FCBaseContainer extends AEBaseContainer { private int ticks; private final double powerMultiplier = 0.5; - private ITerminalHost host; + protected ITerminalHost host; private int slot = -1; private final InventoryPlayer ip; @GuiSync(105) @@ -40,8 +40,8 @@ public abstract class FCBaseContainer extends AEBaseContainer { private int lockSlot() { if (isWirelessTerminal()) { - if (this.host instanceof IFluidPortableCell) { - final int slotIndex = ((IFluidPortableCell) this.host).getInventorySlot(); + if (this.host instanceof IFluidPortableCell ifpc) { + final int slotIndex = ifpc.getInventorySlot(); if (Util.GuiHelper.decodeInvType(slotIndex).getLeft() == Util.GuiHelper.InvType.PLAYER_INV) { this.lockPlayerInventorySlot(slotIndex); } @@ -66,12 +66,12 @@ public abstract class FCBaseContainer extends AEBaseContainer { ((IFluidPortableCell) this.host)); } if (Platform.isServer()) { - if (this.host instanceof IWirelessExtendCard) { - this.mode = ((IWirelessExtendCard) this.host).getMagnetCardMode(); - this.restock = ((IWirelessExtendCard) this.host).isRestock(); + if (this.host instanceof IWirelessExtendCard iwec) { + this.mode = iwec.getMagnetCardMode(); + this.restock = iwec.isRestock(); } - if (this.host != null && this.host instanceof IItemTerminal) { - this.sync = ((IItemTerminal) this.host).getSyncData(); + if (this.host != null && this.host instanceof IItemTerminal iwt) { + this.sync = iwt.getSyncData(); } } super.detectAndSendChanges(); @@ -86,8 +86,8 @@ public abstract class FCBaseContainer extends AEBaseContainer { } public IFluidPortableCell getPortableCell() { - if (this.host instanceof IFluidPortableCell) { - return (IFluidPortableCell) this.host; + if (this.host instanceof IFluidPortableCell ifpc) { + return ifpc; } else { return null; } diff --git a/src/main/java/com/glodblock/github/client/gui/container/base/FCContainerMonitor.java b/src/main/java/com/glodblock/github/client/gui/container/base/FCContainerMonitor.java index 3b2d05e5..ed836f69 100644 --- a/src/main/java/com/glodblock/github/client/gui/container/base/FCContainerMonitor.java +++ b/src/main/java/com/glodblock/github/client/gui/container/base/FCContainerMonitor.java @@ -43,7 +43,6 @@ public abstract class FCContainerMonitor> extends FCBaseCo protected final SlotRestrictedInput[] cellView = new SlotRestrictedInput[5]; protected final IConfigManager clientCM; - protected final ITerminalHost host; @GuiSync(99) public boolean canAccessViewCells = false; diff --git a/src/main/java/com/glodblock/github/loader/RecipeLoader.java b/src/main/java/com/glodblock/github/loader/RecipeLoader.java index bfb32e90..9484a236 100644 --- a/src/main/java/com/glodblock/github/loader/RecipeLoader.java +++ b/src/main/java/com/glodblock/github/loader/RecipeLoader.java @@ -661,6 +661,7 @@ public class RecipeLoader implements Runnable { GameRegistry.addRecipe(new WirelessTerminalInfinityBoosterRecipe(WIRELESS_FLUID_TERM.stack(), c)); GameRegistry.addRecipe(new WirelessTerminalInfinityBoosterRecipe(WIRELESS_ULTRA_TERM.stack(), c)); GameRegistry.addRecipe(new WirelessTerminalInfinityBoosterRecipe(WIRELESS_INTERFACE_TERM.stack(), c)); + GameRegistry.addRecipe(new WirelessTerminalInfinityBoosterRecipe(WIRELESS_LEVEL_TERM.stack(), c)); } for (ItemStack m : magnetCards) { GameRegistry.addRecipe(new WirelessTerminalMagnetRecipe(WIRELESS_ULTRA_TERM.stack(), m)); diff --git a/src/main/java/com/glodblock/github/proxy/CommonProxy.java b/src/main/java/com/glodblock/github/proxy/CommonProxy.java index 1bc0aeb1..d264fa52 100644 --- a/src/main/java/com/glodblock/github/proxy/CommonProxy.java +++ b/src/main/java/com/glodblock/github/proxy/CommonProxy.java @@ -31,6 +31,7 @@ import appeng.api.config.Upgrades; import appeng.api.networking.IGridNode; import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IItemList; +import appeng.core.AELog; import appeng.util.Platform; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; @@ -93,7 +94,7 @@ public class CommonProxy { } } catch (NullPointerException ex) { - ex.printStackTrace(); + AELog.error(ex); } }