From 0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Mon, 30 Jan 2023 10:56:42 -0800 Subject: [ci skip] spotlessApply with the new settings --- src/main/java/gregtech/api/gui/GT_Container.java | 98 +++---- .../api/gui/GT_ContainerMetaTile_Machine.java | 54 ++-- .../java/gregtech/api/gui/GT_Container_1by1.java | 3 +- .../java/gregtech/api/gui/GT_Container_2by2.java | 3 +- .../java/gregtech/api/gui/GT_Container_3by3.java | 3 +- .../java/gregtech/api/gui/GT_Container_4by4.java | 3 +- .../api/gui/GT_Container_BasicMachine.java | 13 +- .../gregtech/api/gui/GT_Container_BasicTank.java | 30 +- .../api/gui/GT_Container_MultiMachine.java | 8 +- .../java/gregtech/api/gui/GT_GUIColorOverride.java | 19 +- .../java/gregtech/api/gui/GT_GUIContainer.java | 21 +- .../api/gui/GT_GUIContainerMetaTile_Machine.java | 68 ++--- .../gregtech/api/gui/GT_GUIContainer_1by1.java | 7 +- .../gregtech/api/gui/GT_GUIContainer_2by2.java | 7 +- .../gregtech/api/gui/GT_GUIContainer_3by3.java | 7 +- .../gregtech/api/gui/GT_GUIContainer_4by4.java | 7 +- .../api/gui/GT_GUIContainer_BasicMachine.java | 130 +++++---- .../api/gui/GT_GUIContainer_BasicTank.java | 9 +- .../api/gui/GT_GUIContainer_MultiMachine.java | 59 ++-- src/main/java/gregtech/api/gui/GT_GUICover.java | 19 +- .../gregtech/api/gui/GT_GUIDialogSelectItem.java | 62 ++-- src/main/java/gregtech/api/gui/GT_GUIScreen.java | 19 +- src/main/java/gregtech/api/gui/GT_Slot_Armor.java | 1 + .../java/gregtech/api/gui/GT_Slot_DataOrb.java | 4 +- src/main/java/gregtech/api/gui/GT_Slot_Holo.java | 20 +- src/main/java/gregtech/api/gui/GT_Slot_Output.java | 1 + src/main/java/gregtech/api/gui/GT_Slot_Render.java | 4 +- .../gui/modularui/FallbackableSteamTexture.java | 8 +- .../api/gui/modularui/GT_CoverUIBuildContext.java | 25 +- .../gregtech/api/gui/modularui/GT_UIInfos.java | 181 ++++++------ .../gregtech/api/gui/modularui/GT_UITextures.java | 320 ++++++++++----------- .../gregtech/api/gui/modularui/GUITextureSet.java | 21 +- .../api/gui/modularui/IDataFollowerWidget.java | 29 +- .../gregtech/api/gui/modularui/SteamTexture.java | 19 +- .../api/gui/widgets/GT_GuiCoverTabLine.java | 102 ++++--- .../api/gui/widgets/GT_GuiFakeItemButton.java | 40 +-- .../java/gregtech/api/gui/widgets/GT_GuiIcon.java | 31 +- .../gregtech/api/gui/widgets/GT_GuiIconButton.java | 11 +- .../api/gui/widgets/GT_GuiIconCheckButton.java | 12 +- .../api/gui/widgets/GT_GuiIntegerTextBox.java | 8 +- .../api/gui/widgets/GT_GuiSlotTooltip.java | 5 +- .../api/gui/widgets/GT_GuiSmartTooltip.java | 5 +- .../java/gregtech/api/gui/widgets/GT_GuiTab.java | 48 ++-- .../gregtech/api/gui/widgets/GT_GuiTabLine.java | 68 ++--- .../gregtech/api/gui/widgets/GT_GuiTooltip.java | 12 +- .../api/gui/widgets/GT_GuiTooltipManager.java | 7 +- 46 files changed, 812 insertions(+), 819 deletions(-) (limited to 'src/main/java/gregtech/api/gui') diff --git a/src/main/java/gregtech/api/gui/GT_Container.java b/src/main/java/gregtech/api/gui/GT_Container.java index 5d9dde3535..2c4d7292d0 100644 --- a/src/main/java/gregtech/api/gui/GT_Container.java +++ b/src/main/java/gregtech/api/gui/GT_Container.java @@ -1,10 +1,7 @@ package gregtech.api.gui; -import gregtech.api.interfaces.IFluidAccess; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_Utility; import java.util.List; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -15,12 +12,18 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; +import gregtech.api.interfaces.IFluidAccess; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_Utility; + /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! *

* Main Container-Class, used for all my GUIs */ public class GT_Container extends Container { + public IGregTechTileEntity mTileEntity; public InventoryPlayer mPlayerInventory; @@ -108,10 +111,8 @@ public class GT_Container extends Container { if (aSlotIndex >= 0) { if (inventorySlots.get(aSlotIndex) == null || inventorySlots.get(aSlotIndex) instanceof GT_Slot_Holo) return null; - if (!(inventorySlots.get(aSlotIndex) instanceof GT_Slot_Armor)) - if (aSlotIndex < getAllSlotCount()) - if (aSlotIndex < getSlotStartIndex() || aSlotIndex >= getSlotStartIndex() + getSlotCount()) - return null; + if (!(inventorySlots.get(aSlotIndex) instanceof GT_Slot_Armor)) if (aSlotIndex < getAllSlotCount()) + if (aSlotIndex < getSlotStartIndex() || aSlotIndex >= getSlotStartIndex() + getSlotCount()) return null; } try { @@ -138,8 +139,7 @@ public class GT_Container extends Container { aPlayerInventory.setItemStack(null); } if (aMouseclick == 1) { - aPlayer.dropPlayerItemWithRandomChoice( - aPlayerInventory.getItemStack().splitStack(1), true); + aPlayer.dropPlayerItemWithRandomChoice(aPlayerInventory.getItemStack().splitStack(1), true); if (aPlayerInventory.getItemStack().stackSize == 0) { aPlayerInventory.setItemStack(null); } @@ -208,25 +208,24 @@ public class GT_Container extends Container { aSlot.putStack(mouseStack); aPlayerInventory.setItemStack(tTempStack); } - } else if (tTempStack.getItem() == mouseStack.getItem() - && mouseStack.getMaxStackSize() > 1 + } else if (tTempStack.getItem() == mouseStack.getItem() && mouseStack.getMaxStackSize() > 1 && (!tTempStack.getHasSubtypes() || tTempStack.getItemDamage() == mouseStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(tTempStack, mouseStack)) { - tTempStackSize = tTempStack.stackSize; + tTempStackSize = tTempStack.stackSize; - if (tTempStackSize > 0 - && tTempStackSize + mouseStack.stackSize <= mouseStack.getMaxStackSize()) { - mouseStack.stackSize += tTempStackSize; - tTempStack = aSlot.decrStackSize(tTempStackSize); + if (tTempStackSize > 0 + && tTempStackSize + mouseStack.stackSize <= mouseStack.getMaxStackSize()) { + mouseStack.stackSize += tTempStackSize; + tTempStack = aSlot.decrStackSize(tTempStackSize); - if (tTempStack.stackSize == 0) { - aSlot.putStack(null); - } + if (tTempStack.stackSize == 0) { + aSlot.putStack(null); + } - aSlot.onPickupFromSlot(aPlayer, aPlayerInventory.getItemStack()); - } - } + aSlot.onPickupFromSlot(aPlayer, aPlayerInventory.getItemStack()); + } + } } aSlot.onSlotChanged(); } @@ -240,8 +239,8 @@ public class GT_Container extends Container { if (aSlot.canTakeStack(aPlayer)) { // get the stack at the specified hotbar slot. tTempStack = aPlayerInventory.getStackInSlot(aMouseclick); - boolean canSwap = - tTempStack == null || aSlot.inventory == aPlayerInventory && aSlot.isItemValid(tTempStack); + boolean canSwap = tTempStack == null + || aSlot.inventory == aPlayerInventory && aSlot.isItemValid(tTempStack); tTempStackSize = -1; if (!canSwap) { @@ -270,17 +269,16 @@ public class GT_Container extends Container { aSlot.putStack(tTempStack); } } - } else if (aShifthold == 3 - && aPlayer.capabilities.isCreativeMode + } else if (aShifthold == 3 && aPlayer.capabilities.isCreativeMode && aPlayerInventory.getItemStack() == null && aSlotIndex >= 0) { - aSlot = (Slot) this.inventorySlots.get(aSlotIndex); - if (aSlot != null && aSlot.getHasStack()) { - tTempStack = GT_Utility.copyOrNull(aSlot.getStack()); - tTempStack.stackSize = tTempStack.getMaxStackSize(); - aPlayerInventory.setItemStack(tTempStack); - } - } + aSlot = (Slot) this.inventorySlots.get(aSlotIndex); + if (aSlot != null && aSlot.getHasStack()) { + tTempStack = GT_Utility.copyOrNull(aSlot.getStack()); + tTempStack.stackSize = tTempStack.getMaxStackSize(); + aPlayerInventory.setItemStack(tTempStack); + } + } return rStack; } @@ -292,8 +290,7 @@ public class GT_Container extends Container { mTileEntity.markDirty(); // null checks and checks if the item can be stacked (maxStackSize > 1) - if (getSlotCount() > 0 - && slotObject != null + if (getSlotCount() > 0 && slotObject != null && slotObject.getHasStack() && !(slotObject instanceof GT_Slot_Holo)) { ItemStack stackInSlot = slotObject.getStack(); @@ -311,8 +308,8 @@ public class GT_Container extends Container { getShiftClickStartIndex(), getShiftClickStartIndex() + getShiftClickSlotCount(), false)) { - return null; - } + return null; + } if (stackInSlot.stackSize == 0) { slotObject.putStack(null); @@ -345,8 +342,7 @@ public class GT_Container extends Container { && (!reverseOrder && slotIndex < aSlotCount || reverseOrder && slotIndex >= aStartIndex)) { slot = (Slot) this.inventorySlots.get(slotIndex); itemStack = slot.getStack(); - if (!(slot instanceof GT_Slot_Holo) - && !(slot instanceof GT_Slot_Output) + if (!(slot instanceof GT_Slot_Holo) && !(slot instanceof GT_Slot_Output) && slot.isItemValid(aStack) && itemStack != null && itemStack.getItem() == aStack.getItem() @@ -596,12 +592,8 @@ public class GT_Container extends Container { return true; } - protected static ItemStack handleFluidSlotClick( - IFluidAccess aFluidAccess, - EntityPlayer aPlayer, - boolean aProcessFullStack, - boolean aCanDrain, - boolean aCanFill) { + protected static ItemStack handleFluidSlotClick(IFluidAccess aFluidAccess, EntityPlayer aPlayer, + boolean aProcessFullStack, boolean aCanDrain, boolean aCanFill) { ItemStack tStackHeld = aPlayer.inventory.getItemStack(); ItemStack tStackSizedOne = GT_Utility.copyAmount(1, tStackHeld); if (tStackSizedOne == null || tStackHeld.stackSize == 0) return null; @@ -658,12 +650,10 @@ public class GT_Container extends Container { if (aProcessFullStack) { int tFilledAmount = tOriginalFluidAmount - tTankStack.amount; /* - work out how many more items we can fill - one cell is already used, so account for that - the round down behavior will left over a fraction of a cell worth of fluid - the user then get to decide what to do with it - it will not be too fancy if it spills out partially filled cells - */ + * work out how many more items we can fill one cell is already used, so account for that the round down + * behavior will left over a fraction of a cell worth of fluid the user then get to decide what to do + * with it it will not be too fancy if it spills out partially filled cells + */ int tAdditionalParallel = Math.min(tStackHeld.stackSize - 1, tTankStack.amount / tFilledAmount); tTankStack.amount -= tFilledAmount * tAdditionalParallel; tFilledContainer.stackSize += tAdditionalParallel; @@ -674,8 +664,8 @@ public class GT_Container extends Container { return tFilledContainer; } - protected static ItemStack fillFluid( - IFluidAccess aFluidAccess, EntityPlayer aPlayer, FluidStack aFluidHeld, boolean aProcessFullStack) { + protected static ItemStack fillFluid(IFluidAccess aFluidAccess, EntityPlayer aPlayer, FluidStack aFluidHeld, + boolean aProcessFullStack) { // we are not using aMachine.fill() here any more, so we need to check for fluid type here ourselves if (aFluidAccess.get() != null && !aFluidAccess.get().isFluidEqual(aFluidHeld)) return null; ItemStack tStackHeld = aPlayer.inventory.getItemStack(); diff --git a/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java b/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java index 588fb415c2..3ce2a53fce 100644 --- a/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java +++ b/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java @@ -1,16 +1,18 @@ package gregtech.api.gui; +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.item.ItemStack; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.IConfigurationCircuitSupport; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; -import java.util.List; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.item.ItemStack; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -19,29 +21,11 @@ import net.minecraft.item.ItemStack; */ public class GT_ContainerMetaTile_Machine extends GT_Container { - public int mActive = 0, - mMaxProgressTime = 0, - mProgressTime = 0, - mEnergy = 0, - mSteam = 0, - mSteamStorage = 0, - mStorage = 0, - mOutput = 0, - mInput = 0, - mID = 0, - mDisplayErrorCode = 0; + public int mActive = 0, mMaxProgressTime = 0, mProgressTime = 0, mEnergy = 0, mSteam = 0, mSteamStorage = 0, + mStorage = 0, mOutput = 0, mInput = 0, mID = 0, mDisplayErrorCode = 0; public long mEnergyLong = 0, mStorageLong = 0; - private int oActive = 0, - oMaxProgressTime = 0, - oProgressTime = 0, - oEnergy = 0, - oSteam = 0, - oSteamStorage = 0, - oStorage = 0, - oOutput = 0, - oInput = 0, - oID = 0, - oDisplayErrorCode = 0; + private int oActive = 0, oMaxProgressTime = 0, oProgressTime = 0, oEnergy = 0, oSteam = 0, oSteamStorage = 0, + oStorage = 0, oOutput = 0, oInput = 0, oID = 0, oDisplayErrorCode = 0; private long oEnergyLong = 0, oStorageLong = 0; protected int mTimer = 0; protected Runnable circuitSlotClickCallback; @@ -60,8 +44,8 @@ public class GT_ContainerMetaTile_Machine extends GT_Container { } } - public GT_ContainerMetaTile_Machine( - InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean doesBindInventory) { + public GT_ContainerMetaTile_Machine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, + boolean doesBindInventory) { super(aInventoryPlayer, aTileEntity); mTileEntity = aTileEntity; @@ -77,8 +61,11 @@ public class GT_ContainerMetaTile_Machine extends GT_Container { protected void addCircuitSlot() { if (mTileEntity.getMetaTileEntity() instanceof IConfigurationCircuitSupport) { IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport) mTileEntity.getMetaTileEntity(); - GT_Slot_Render slotCircuit = - new GT_Slot_Render(mTileEntity, ccs.getCircuitSlot(), ccs.getCircuitSlotX(), ccs.getCircuitSlotY()); + GT_Slot_Render slotCircuit = new GT_Slot_Render( + mTileEntity, + ccs.getCircuitSlot(), + ccs.getCircuitSlotX(), + ccs.getCircuitSlotY()); addSlotToContainer(slotCircuit); slotCircuit.setEnabled(ccs.allowSelectCircuit()); } @@ -278,9 +265,8 @@ public class GT_ContainerMetaTile_Machine extends GT_Container { List tCircuits = ccs.getConfigurationCircuits(); int index = GT_Utility.findMatchingStackInList(tCircuits, cursorStack); if (index < 0) { - int curIndex = GT_Utility.findMatchingStackInList( - tCircuits, machine.getStackInSlot(ccs.getCircuitSlot())) - + 1; + int curIndex = GT_Utility + .findMatchingStackInList(tCircuits, machine.getStackInSlot(ccs.getCircuitSlot())) + 1; if (aMouseclick == 0) { curIndex += 1; } else { diff --git a/src/main/java/gregtech/api/gui/GT_Container_1by1.java b/src/main/java/gregtech/api/gui/GT_Container_1by1.java index 882b4d0502..06efaee5ef 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_1by1.java +++ b/src/main/java/gregtech/api/gui/GT_Container_1by1.java @@ -1,9 +1,10 @@ package gregtech.api.gui; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + @Deprecated public class GT_Container_1by1 extends GT_ContainerMetaTile_Machine { diff --git a/src/main/java/gregtech/api/gui/GT_Container_2by2.java b/src/main/java/gregtech/api/gui/GT_Container_2by2.java index 4267423b75..4e3584a0a6 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_2by2.java +++ b/src/main/java/gregtech/api/gui/GT_Container_2by2.java @@ -1,9 +1,10 @@ package gregtech.api.gui; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + @Deprecated public class GT_Container_2by2 extends GT_ContainerMetaTile_Machine { diff --git a/src/main/java/gregtech/api/gui/GT_Container_3by3.java b/src/main/java/gregtech/api/gui/GT_Container_3by3.java index 80f3e213d6..4c0f7f946b 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_3by3.java +++ b/src/main/java/gregtech/api/gui/GT_Container_3by3.java @@ -1,9 +1,10 @@ package gregtech.api.gui; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + @Deprecated public class GT_Container_3by3 extends GT_ContainerMetaTile_Machine { diff --git a/src/main/java/gregtech/api/gui/GT_Container_4by4.java b/src/main/java/gregtech/api/gui/GT_Container_4by4.java index 6aa0717a11..db5cde4cfe 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_4by4.java +++ b/src/main/java/gregtech/api/gui/GT_Container_4by4.java @@ -1,9 +1,10 @@ package gregtech.api.gui; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + @Deprecated public class GT_Container_4by4 extends GT_ContainerMetaTile_Machine { diff --git a/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java b/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java index 28779ada08..101c1cba83 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java +++ b/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java @@ -2,6 +2,12 @@ package gregtech.api.gui; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine.OTHER_SLOT_COUNT; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.IFluidAccess; @@ -10,11 +16,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachin import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -223,7 +224,7 @@ public class GT_Container_BasicMachine extends GT_Container_BasicTank { } IFluidAccess tFillableAccess = constructFluidAccess(tTank, true); GT_Recipe_Map recipes = machine.getRecipeList(); - // If the machine has recipes but no fluid inputs, disallow filling this slot with fluids. + // If the machine has recipes but no fluid inputs, disallow filling this slot with fluids. ItemStack tToken = handleFluidSlotClick( tFillableAccess, aPlayer, diff --git a/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java b/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java index bc0ac72a8b..5aa793f8f6 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java +++ b/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java @@ -1,11 +1,5 @@ package gregtech.api.gui; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.interfaces.IFluidAccess; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; -import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; @@ -13,6 +7,13 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.interfaces.IFluidAccess; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; +import gregtech.api.util.GT_Utility; + /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! *

@@ -28,8 +29,8 @@ public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine { } /** - * Subclasses must ensure third slot (aSlotIndex==2) is drainable fluid display item slot. - * Otherwise, subclasses must intercept the appropriate the slotClick event and call super.slotClick(2, xxx) if necessary + * Subclasses must ensure third slot (aSlotIndex==2) is drainable fluid display item slot. Otherwise, subclasses + * must intercept the appropriate the slotClick event and call super.slotClick(2, xxx) if necessary */ @Override public void addSlots(InventoryPlayer aInventoryPlayer) { @@ -46,16 +47,20 @@ public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine { /* * While a logical client don't really need to process fluid cells upon click (it could have just wait * for server side to send the result), doing so would result in every fluid interaction having a - * noticeable delay between clicking and changes happening even on single player. - * I'd imagine this lag to become only more severe when playing MP over ethernet, which would have much more latency - * than a memory connection + * noticeable delay between clicking and changes happening even on single player. I'd imagine this lag + * to become only more severe when playing MP over ethernet, which would have much more latency than a + * memory connection */ Slot slot = (Slot) inventorySlots.get(aSlotIndex); tTank.setDrainableStack(GT_Utility.getFluidFromDisplayStack(slot.getStack())); } IFluidAccess tDrainableAccess = constructFluidAccess(tTank, false); return handleFluidSlotClick( - tDrainableAccess, aPlayer, aMouseclick == 0, true, !tTank.isDrainableStackSeparate()); + tDrainableAccess, + aPlayer, + aMouseclick == 0, + true, + !tTank.isDrainableStackSeparate()); } return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } @@ -110,6 +115,7 @@ public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine { } static class BasicTankFluidAccess implements IFluidAccess { + protected final GT_MetaTileEntity_BasicTank mTank; protected final boolean mIsFillableStack; diff --git a/src/main/java/gregtech/api/gui/GT_Container_MultiMachine.java b/src/main/java/gregtech/api/gui/GT_Container_MultiMachine.java index 4bfc14ad57..bcc9219d5e 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_MultiMachine.java +++ b/src/main/java/gregtech/api/gui/GT_Container_MultiMachine.java @@ -1,9 +1,10 @@ package gregtech.api.gui; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! *

@@ -11,12 +12,13 @@ import net.minecraft.inventory.Slot; */ @Deprecated public class GT_Container_MultiMachine extends GT_ContainerMetaTile_Machine { + public GT_Container_MultiMachine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { super(aInventoryPlayer, aTileEntity); } - public GT_Container_MultiMachine( - InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean bindInventory) { + public GT_Container_MultiMachine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, + boolean bindInventory) { super(aInventoryPlayer, aTileEntity, bindInventory); } diff --git a/src/main/java/gregtech/api/gui/GT_GUIColorOverride.java b/src/main/java/gregtech/api/gui/GT_GUIColorOverride.java index 2d6268dbec..795148ee25 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIColorOverride.java +++ b/src/main/java/gregtech/api/gui/GT_GUIColorOverride.java @@ -1,24 +1,29 @@ package gregtech.api.gui; +import java.util.concurrent.ExecutionException; + +import javax.annotation.Nonnull; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.IResource; +import net.minecraft.util.ResourceLocation; + import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import com.google.common.util.concurrent.UncheckedExecutionException; + import cpw.mods.fml.relauncher.FMLLaunchHandler; import cpw.mods.fml.relauncher.Side; import gregtech.api.GregTech_API; import gregtech.api.util.ColorsMetadataSection; -import java.util.concurrent.ExecutionException; -import javax.annotation.Nonnull; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.IResource; -import net.minecraft.util.ResourceLocation; public class GT_GUIColorOverride { + private static final Object NOT_FOUND = new Object(); - private static final LoadingCache cache = CacheBuilder.newBuilder() - .softValues() + private static final LoadingCache cache = CacheBuilder.newBuilder().softValues() .build(new CacheLoader() { + @Override public Object load(@Nonnull ResourceLocation key) throws Exception { IResource ir = Minecraft.getMinecraft().getResourceManager().getResource(key); diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer.java b/src/main/java/gregtech/api/gui/GT_GUIContainer.java index efed327b46..639bd56162 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer.java @@ -7,6 +7,7 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.util.ResourceLocation; + import org.lwjgl.input.Mouse; /** @@ -90,19 +91,9 @@ public class GT_GUIContainer extends GuiContainer { } /* - @Override - protected void drawSlotInventory(Slot slot) { - try { - super.drawSlotInventory(slot); - } catch(Throwable e) { - try { - Tessellator.instance.draw(); - } catch(Throwable f) {} - if (!mCrashed) { - GT_Log.out.println("Clientside Slot drawing Crash prevented. Seems one Itemstack causes Problems with negative Damage Values or the Wildcard Damage Value. This is absolutely NOT a Bug of the GregTech-Addon, so don't even think about reporting it to me, it's a Bug of the Mod, which belongs to the almost-crash-causing Item, so bug that Mods Author and not me! Did you hear it? NOT ME!!!"); - e.printStackTrace(); - mCrashed = true; - } - } - }*/ + * @Override protected void drawSlotInventory(Slot slot) { try { super.drawSlotInventory(slot); } catch(Throwable e) + * { try { Tessellator.instance.draw(); } catch(Throwable f) {} if (!mCrashed) { GT_Log.out. + * println("Clientside Slot drawing Crash prevented. Seems one Itemstack causes Problems with negative Damage Values or the Wildcard Damage Value. This is absolutely NOT a Bug of the GregTech-Addon, so don't even think about reporting it to me, it's a Bug of the Mod, which belongs to the almost-crash-causing Item, so bug that Mods Author and not me! Did you hear it? NOT ME!!!" + * ); e.printStackTrace(); mCrashed = true; } } } + */ } diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java b/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java index 19aa8fa9a8..7e072f0fe6 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java @@ -1,5 +1,16 @@ package gregtech.api.gui; +import java.util.List; + +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; + +import org.lwjgl.opengl.GL11; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.Dyes; @@ -17,14 +28,6 @@ import gregtech.api.net.GT_Packet_SetConfigurationCircuit; import gregtech.api.util.GT_TooltipDataCache; import gregtech.api.util.GT_Util; import gregtech.api.util.GT_Utility; -import java.util.List; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; -import org.lwjgl.opengl.GL11; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -43,14 +46,13 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer implements // Cover Tabs support. Subclasses can override display position, style and visuals by overriding setupCoverTabs public GT_GuiCoverTabLine coverTabs; - private static final int COVER_TAB_LEFT = -16, - COVER_TAB_TOP = 1, - COVER_TAB_HEIGHT = 20, - COVER_TAB_WIDTH = 18, + private static final int COVER_TAB_LEFT = -16, COVER_TAB_TOP = 1, COVER_TAB_HEIGHT = 20, COVER_TAB_WIDTH = 18, COVER_TAB_SPACING = 2; private static final DisplayStyle COVER_TAB_X_DIR = DisplayStyle.NONE, COVER_TAB_Y_DIR = DisplayStyle.NORMAL; - private static final GT_GuiTabIconSet TAB_ICONSET = - new GT_GuiTabIconSet(GT_GuiIcon.TAB_NORMAL, GT_GuiIcon.TAB_HIGHLIGHT, GT_GuiIcon.TAB_DISABLED); + private static final GT_GuiTabIconSet TAB_ICONSET = new GT_GuiTabIconSet( + GT_GuiIcon.TAB_NORMAL, + GT_GuiIcon.TAB_HIGHLIGHT, + GT_GuiIcon.TAB_DISABLED); public GT_GUIContainerMetaTile_Machine(GT_ContainerMetaTile_Machine aContainer, String aGUIbackground) { super(aContainer, aGUIbackground); @@ -70,8 +72,8 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer implements mContainer.setCircuitSlotClickCallback(this::openSelectCircuitDialog); } - public GT_GUIContainerMetaTile_Machine( - InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aGUIbackground) { + public GT_GUIContainerMetaTile_Machine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, + String aGUIbackground) { this(new GT_ContainerMetaTile_Machine(aInventoryPlayer, aTileEntity), aGUIbackground); } @@ -174,16 +176,17 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer implements // Tooltips support /** - * Load data for and create appropriate tooltips for this machine. - * Only called when one of regular or shift tooltips are enabled. + * Load data for and create appropriate tooltips for this machine. Only called when one of regular or shift tooltips + * are enabled. */ protected void setupTooltips() { if (mContainer.mTileEntity.getMetaTileEntity() instanceof IConfigurationCircuitSupport) { - IConfigurationCircuitSupport ccs = - (IConfigurationCircuitSupport) mContainer.mTileEntity.getMetaTileEntity(); - if (ccs.allowSelectCircuit()) - addToolTip(new GT_GuiSlotTooltip( - mContainer.getSlot(ccs.getCircuitGUISlot()), mTooltipCache.getData(GHOST_CIRCUIT_TOOLTIP))); + IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport) mContainer.mTileEntity + .getMetaTileEntity(); + if (ccs.allowSelectCircuit()) addToolTip( + new GT_GuiSlotTooltip( + mContainer.getSlot(ccs.getCircuitGUISlot()), + mTooltipCache.getData(GHOST_CIRCUIT_TOOLTIP))); } } @@ -231,8 +234,8 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer implements @Override protected void onMouseWheel(int mx, int my, int delta) { if (mContainer.mTileEntity.getMetaTileEntity() instanceof IConfigurationCircuitSupport) { - IConfigurationCircuitSupport ccs = - (IConfigurationCircuitSupport) mContainer.mTileEntity.getMetaTileEntity(); + IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport) mContainer.mTileEntity + .getMetaTileEntity(); Slot slotCircuit = mContainer.getSlot(ccs.getCircuitGUISlot()); if (slotCircuit != null && func_146978_c(slotCircuit.xDisplayPosition, slotCircuit.yDisplayPosition, 16, 16, mx, my)) { @@ -248,13 +251,14 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer implements IMetaTileEntity machine = mContainer.mTileEntity.getMetaTileEntity(); IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport) machine; List circuits = ccs.getConfigurationCircuits(); - mc.displayGuiScreen(new GT_GUIDialogSelectItem( - StatCollector.translateToLocal("GT5U.machines.select_circuit"), - machine.getStackForm(0), - this, - this::onCircuitSelected, - circuits, - GT_Utility.findMatchingStackInList(circuits, machine.getStackInSlot(ccs.getCircuitSlot())))); + mc.displayGuiScreen( + new GT_GUIDialogSelectItem( + StatCollector.translateToLocal("GT5U.machines.select_circuit"), + machine.getStackForm(0), + this, + this::onCircuitSelected, + circuits, + GT_Utility.findMatchingStackInList(circuits, machine.getStackInSlot(ccs.getCircuitSlot())))); } private void onCircuitSelected(ItemStack selected) { diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_1by1.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_1by1.java index 694b212872..b891ed177d 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_1by1.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_1by1.java @@ -2,9 +2,10 @@ package gregtech.api.gui; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + @Deprecated public class GT_GUIContainer_1by1 extends GT_GUIContainerMetaTile_Machine { @@ -16,8 +17,8 @@ public class GT_GUIContainer_1by1 extends GT_GUIContainerMetaTile_Machine { mName = aName; } - public GT_GUIContainer_1by1( - InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) { + public GT_GUIContainer_1by1(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, + String aBackground) { super(new GT_Container_1by1(aInventoryPlayer, aTileEntity), RES_PATH_GUI + aBackground + "1by1.png"); mName = aName; } diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2.java index 069e6f67fe..a06d4a98d2 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2.java @@ -2,9 +2,10 @@ package gregtech.api.gui; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + @Deprecated public class GT_GUIContainer_2by2 extends GT_GUIContainerMetaTile_Machine { @@ -16,8 +17,8 @@ public class GT_GUIContainer_2by2 extends GT_GUIContainerMetaTile_Machine { mName = aName; } - public GT_GUIContainer_2by2( - InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) { + public GT_GUIContainer_2by2(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, + String aBackground) { super(new GT_Container_2by2(aInventoryPlayer, aTileEntity), RES_PATH_GUI + aBackground + "2by2.png"); mName = aName; } diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_3by3.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_3by3.java index 2ce72e054c..715be4fdea 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_3by3.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_3by3.java @@ -2,9 +2,10 @@ package gregtech.api.gui; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + @Deprecated public class GT_GUIContainer_3by3 extends GT_GUIContainerMetaTile_Machine { @@ -16,8 +17,8 @@ public class GT_GUIContainer_3by3 extends GT_GUIContainerMetaTile_Machine { mName = aName; } - public GT_GUIContainer_3by3( - InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) { + public GT_GUIContainer_3by3(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, + String aBackground) { super(new GT_Container_3by3(aInventoryPlayer, aTileEntity), RES_PATH_GUI + aBackground + "3by3.png"); mName = aName; } diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_4by4.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_4by4.java index df8e3d137b..d091abfff6 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_4by4.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_4by4.java @@ -2,9 +2,10 @@ package gregtech.api.gui; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + @Deprecated public class GT_GUIContainer_4by4 extends GT_GUIContainerMetaTile_Machine { @@ -16,8 +17,8 @@ public class GT_GUIContainer_4by4 extends GT_GUIContainerMetaTile_Machine { mName = aName; } - public GT_GUIContainer_4by4( - InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) { + public GT_GUIContainer_4by4(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, + String aBackground) { super(new GT_Container_4by4(aInventoryPlayer, aTileEntity), RES_PATH_GUI + aBackground + "4by4.png"); mName = aName; } diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java index 50272f4820..43943b49cb 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java @@ -2,6 +2,11 @@ package gregtech.api.gui; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; +import java.awt.Rectangle; + +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.StatCollector; + import gregtech.api.enums.GT_Values; import gregtech.api.gui.widgets.GT_GuiIcon; import gregtech.api.gui.widgets.GT_GuiSlotTooltip; @@ -14,9 +19,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachin import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.common.power.Power; import gregtech.nei.NEI_TransferRectHost; -import java.awt.Rectangle; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.StatCollector; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -24,11 +26,16 @@ import net.minecraft.util.StatCollector; * The GUI-Container I use for all my Basic Machines */ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machine implements NEI_TransferRectHost { + private static final int NEEDS_STEAM_VENTING = 64; private static final GT_GuiTabIconSet TAB_ICONSET_BRONZE = new GT_GuiTabIconSet( - GT_GuiIcon.TAB_NORMAL_BRONZE, GT_GuiIcon.TAB_HIGHLIGHT_BRONZE, GT_GuiIcon.TAB_DISABLED_BRONZE); + GT_GuiIcon.TAB_NORMAL_BRONZE, + GT_GuiIcon.TAB_HIGHLIGHT_BRONZE, + GT_GuiIcon.TAB_DISABLED_BRONZE); private static final GT_GuiTabIconSet TAB_ICONSET_STEEL = new GT_GuiTabIconSet( - GT_GuiIcon.TAB_NORMAL_STEEL, GT_GuiIcon.TAB_HIGHLIGHT_STEEL, GT_GuiIcon.TAB_DISABLED_STEEL); + GT_GuiIcon.TAB_NORMAL_STEEL, + GT_GuiIcon.TAB_HIGHLIGHT_STEEL, + GT_GuiIcon.TAB_DISABLED_STEEL); private final int textColor = this.getTextColorOrDefault("title", 0x404040); public final String mName, mNEI; public final byte mProgressBarDirection, mProgressBarAmount; @@ -46,23 +53,13 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin ITEM_TRANSFER_TOOLTIP = "GT5U.machines.item_transfer.tooltip", POWER_SOURCE_KEY = "GT5U.machines.powersource."; - public GT_GUIContainer_BasicMachine( - InventoryPlayer aInventoryPlayer, - IGregTechTileEntity aTileEntity, - String aName, - String aTextureFile, - String aNEI) { + public GT_GUIContainer_BasicMachine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, + String aTextureFile, String aNEI) { this(aInventoryPlayer, aTileEntity, aName, aTextureFile, aNEI, (byte) 0, (byte) 1); } - public GT_GUIContainer_BasicMachine( - InventoryPlayer aInventoryPlayer, - IGregTechTileEntity aTileEntity, - String aName, - String aTextureFile, - String aNEI, - byte aProgressBarDirection, - byte aProgressBarAmount) { + public GT_GUIContainer_BasicMachine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, + String aTextureFile, String aNEI, byte aProgressBarDirection, byte aProgressBarAmount) { super( new GT_Container_BasicMachine(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "basicmachines/" + aTextureFile); @@ -87,57 +84,67 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin if (machine.isSteampowered()) { batterySlotTooltipKey = UNUSED_SLOT_TOOLTIP; batterySlotTooltipArgs = new String[0]; - addToolTip(new GT_GuiSmartTooltip( - tProblemArea, - new TooltipVisibilityProvider() { - public boolean shouldShowTooltip() { - return hasErrorCode(NEEDS_STEAM_VENTING); - } - }, - mTooltipCache.getData(STALLED_VENT_TOOLTIP))); + addToolTip(new GT_GuiSmartTooltip(tProblemArea, new TooltipVisibilityProvider() { + + public boolean shouldShowTooltip() { + return hasErrorCode(NEEDS_STEAM_VENTING); + } + }, mTooltipCache.getData(STALLED_VENT_TOOLTIP))); } else { String pTier1 = powerTierName(machine.mTier); if (machine.mTier == GT_Values.VN.length - 1) { batterySlotTooltipKey = BATTERY_SLOT_TOOLTIP_ALT; - batterySlotTooltipArgs = new String[] {pTier1}; + batterySlotTooltipArgs = new String[] { pTier1 }; } else { batterySlotTooltipKey = BATTERY_SLOT_TOOLTIP; - batterySlotTooltipArgs = new String[] {pTier1, powerTierName((byte) (machine.mTier + 1))}; + batterySlotTooltipArgs = new String[] { pTier1, powerTierName((byte) (machine.mTier + 1)) }; } - addToolTip(new GT_GuiSlotTooltip( - container.slotFluidTransferToggle, mTooltipCache.getData(FLUID_TRANSFER_TOOLTIP))); - addToolTip(new GT_GuiSlotTooltip( - container.slotItemTransferToggle, mTooltipCache.getData(ITEM_TRANSFER_TOOLTIP))); + addToolTip( + new GT_GuiSlotTooltip( + container.slotFluidTransferToggle, + mTooltipCache.getData(FLUID_TRANSFER_TOOLTIP))); + addToolTip( + new GT_GuiSlotTooltip( + container.slotItemTransferToggle, + mTooltipCache.getData(ITEM_TRANSFER_TOOLTIP))); } if (recipes != null && recipes.hasFluidInputs()) { - addToolTip(new GT_GuiSlotTooltip( - container.slotFluidInput, mTooltipCache.getData(FLUID_INPUT_TOOLTIP, machine.getCapacity()))); + addToolTip( + new GT_GuiSlotTooltip( + container.slotFluidInput, + mTooltipCache.getData(FLUID_INPUT_TOOLTIP, machine.getCapacity()))); } if (recipes != null && recipes.hasFluidOutputs()) { - addToolTip(new GT_GuiSlotTooltip( - container.slotFluidOutput, mTooltipCache.getData(FLUID_OUTPUT_TOOLTIP, machine.getCapacity()))); + addToolTip( + new GT_GuiSlotTooltip( + container.slotFluidOutput, + mTooltipCache.getData(FLUID_OUTPUT_TOOLTIP, machine.getCapacity()))); } - addToolTip(new GT_GuiSlotTooltip( - getContainer().slotBattery, mTooltipCache.getData(batterySlotTooltipKey, batterySlotTooltipArgs))); - addToolTip(new GT_GuiSlotTooltip( - container.slotSpecial, - mTooltipCache.getData( - recipes != null && recipes.usesSpecialSlot() ? SPECIAL_SLOT_TOOLTIP : UNUSED_SLOT_TOOLTIP))); - addToolTip(new GT_GuiSmartTooltip( - tProblemArea, - new TooltipVisibilityProvider() { - public boolean shouldShowTooltip() { - return container.mStuttering && !hasErrorCode(NEEDS_STEAM_VENTING); - } - }, + addToolTip( + new GT_GuiSlotTooltip( + getContainer().slotBattery, + mTooltipCache.getData(batterySlotTooltipKey, batterySlotTooltipArgs))); + addToolTip( + new GT_GuiSlotTooltip( + container.slotSpecial, + mTooltipCache.getData( + recipes != null && recipes.usesSpecialSlot() ? SPECIAL_SLOT_TOOLTIP + : UNUSED_SLOT_TOOLTIP))); + addToolTip(new GT_GuiSmartTooltip(tProblemArea, new TooltipVisibilityProvider() { + + public boolean shouldShowTooltip() { + return container.mStuttering && !hasErrorCode(NEEDS_STEAM_VENTING); + } + }, mTooltipCache.getData( STALLED_STUTTERING_TOOLTIP, - StatCollector.translateToLocal( - POWER_SOURCE_KEY + (machine.isSteampowered() ? "steam" : "power"))))); + StatCollector + .translateToLocal(POWER_SOURCE_KEY + (machine.isSteampowered() ? "steam" : "power"))))); } /** * Apply proper coloration to a machine's power tier short name + * * @param machineTier * @return colored power tier short name */ @@ -171,14 +178,12 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin if (mContainer.mMaxProgressTime > 0) { int tSize = mProgressBarDirection < 2 ? 20 : 18; int tProgress = Math.max( - 1, - Math.min( - tSize * mProgressBarAmount, - (mContainer.mProgressTime > 0 ? 1 : 0) - + mContainer.mProgressTime - * tSize - * mProgressBarAmount - / mContainer.mMaxProgressTime)) + 1, + Math.min( + tSize * mProgressBarAmount, + (mContainer.mProgressTime > 0 ? 1 : 0) + mContainer.mProgressTime * tSize + * mProgressBarAmount + / mContainer.mMaxProgressTime)) % (tSize + 1); switch (mProgressBarDirection) { // yes, my OCD was mad at me before I did the Tabs. @@ -218,8 +223,7 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin @Override protected GT_GuiTabIconSet getTabBackground() { if (getMachine().isSteampowered()) { - return getMachine() instanceof GT_MetaTileEntity_BasicMachine_Steel - ? TAB_ICONSET_STEEL + return getMachine() instanceof GT_MetaTileEntity_BasicMachine_Steel ? TAB_ICONSET_STEEL : TAB_ICONSET_BRONZE; } return super.getTabBackground(); @@ -253,7 +257,7 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin @Override public Object[] getNeiTransferRectArgs() { - return new Object[] {getMachine().getPower()}; + return new Object[] { getMachine().getPower() }; } @Override diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicTank.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicTank.java index 034525c338..28075cabdb 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicTank.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicTank.java @@ -2,11 +2,12 @@ package gregtech.api.gui; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.StatCollector; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Utility; + public class GT_GUIContainer_BasicTank extends GT_GUIContainerMetaTile_Machine { private final String mName; @@ -21,8 +22,8 @@ public class GT_GUIContainer_BasicTank extends GT_GUIContainerMetaTile_Machine { @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { - fontRendererObj.drawString( - StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, textColorTitle); + fontRendererObj + .drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, textColorTitle); fontRendererObj.drawString(mName, 8, 6, textColorTitle); if (mContainer != null) { fontRendererObj.drawString("Liquid Amount", 10, 20, textColor); diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java index 7fb5026cd3..f2ea91571a 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java @@ -2,14 +2,15 @@ package gregtech.api.gui; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; + import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gregtech.common.items.GT_MetaGenerated_Tool_01; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_DrillerBase; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -23,8 +24,8 @@ public class GT_GUIContainer_MultiMachine extends GT_GUIContainerMetaTile_Machin private final int textColor = this.getTextColorOrDefault("text", 0xFAFAFF), textColorTitle = this.getTextColorOrDefault("title", 0xFAFAFF); - public GT_GUIContainer_MultiMachine( - InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { + public GT_GUIContainer_MultiMachine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, + String aTextureFile) { super( new GT_Container_MultiMachine(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); @@ -73,8 +74,8 @@ public class GT_GUIContainer_MultiMachine extends GT_GUIContainerMetaTile_Machin } line_counter += 8; - if (mContainer - != null) { // (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) + if (mContainer != null) { // (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? + // 0 : 8) // | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64)); if ((mContainer.mDisplayErrorCode & 1) != 0) { fontRendererObj.drawString(GT_Utility.trans("132", "Pipe is loose."), 10, line_counter, textColor); @@ -92,42 +93,45 @@ public class GT_GUIContainer_MultiMachine extends GT_GUIContainerMetaTile_Machin } if ((mContainer.mDisplayErrorCode & 8) != 0) { - fontRendererObj.drawString( - GT_Utility.trans("135", "Platings are dented."), 10, line_counter, textColor); + fontRendererObj + .drawString(GT_Utility.trans("135", "Platings are dented."), 10, line_counter, textColor); line_counter += 8; } if ((mContainer.mDisplayErrorCode & 16) != 0) { - fontRendererObj.drawString( - GT_Utility.trans("136", "Circuitry burned out."), 10, line_counter, textColor); + fontRendererObj + .drawString(GT_Utility.trans("136", "Circuitry burned out."), 10, line_counter, textColor); line_counter += 8; } if ((mContainer.mDisplayErrorCode & 32) != 0) { - fontRendererObj.drawString( - GT_Utility.trans("137", "That doesn't belong there."), 10, line_counter, textColor); + fontRendererObj + .drawString(GT_Utility.trans("137", "That doesn't belong there."), 10, line_counter, textColor); line_counter += 8; } if ((mContainer.mDisplayErrorCode & 64) != 0) { - fontRendererObj.drawString( - GT_Utility.trans("138", "Incomplete Structure."), 10, line_counter, textColor); + fontRendererObj + .drawString(GT_Utility.trans("138", "Incomplete Structure."), 10, line_counter, textColor); line_counter += 8; } if (mContainer.mDisplayErrorCode == 0) { if (mContainer.mActive == 0) { - fontRendererObj.drawString( - GT_Utility.trans("139", "Hit with Soft Mallet"), 10, line_counter, textColor); + fontRendererObj + .drawString(GT_Utility.trans("139", "Hit with Soft Mallet"), 10, line_counter, textColor); line_counter += 8; fontRendererObj.drawString( - GT_Utility.trans("140", "to (re-)start the Machine"), 10, line_counter, textColor); + GT_Utility.trans("140", "to (re-)start the Machine"), + 10, + line_counter, + textColor); line_counter += 8; - fontRendererObj.drawString( - GT_Utility.trans("141", "if it doesn't start."), 10, line_counter, textColor); + fontRendererObj + .drawString(GT_Utility.trans("141", "if it doesn't start."), 10, line_counter, textColor); } else { - fontRendererObj.drawString( - GT_Utility.trans("142", "Running perfectly."), 10, line_counter, textColor); + fontRendererObj + .drawString(GT_Utility.trans("142", "Running perfectly."), 10, line_counter, textColor); } line_counter += 8; if (mContainer.mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_DrillerBase) { @@ -135,16 +139,21 @@ public class GT_GUIContainer_MultiMachine extends GT_GUIContainerMetaTile_Machin if (tItem == null || !GT_Utility.areStacksEqual(tItem, GT_ModHandler.getIC2Item("miningPipe", 1L))) { fontRendererObj.drawString( - GT_Utility.trans("143", "Missing Mining Pipe"), 10, line_counter, textColor); + GT_Utility.trans("143", "Missing Mining Pipe"), + 10, + line_counter, + textColor); } } else if (mContainer.mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_LargeTurbine) { ItemStack tItem = mContainer.mTileEntity.getMetaTileEntity().getStackInSlot(1); if (tItem == null - || !(tItem.getItem() == GT_MetaGenerated_Tool_01.INSTANCE - && tItem.getItemDamage() >= 170 + || !(tItem.getItem() == GT_MetaGenerated_Tool_01.INSTANCE && tItem.getItemDamage() >= 170 && tItem.getItemDamage() <= 177)) { fontRendererObj.drawString( - GT_Utility.trans("144", "Missing Turbine Rotor"), 10, line_counter, textColor); + GT_Utility.trans("144", "Missing Turbine Rotor"), + 10, + line_counter, + textColor); } } } diff --git a/src/main/java/gregtech/api/gui/GT_GUICover.java b/src/main/java/gregtech/api/gui/GT_GUICover.java index cef3ddb3bf..2bd981c6b1 100644 --- a/src/main/java/gregtech/api/gui/GT_GUICover.java +++ b/src/main/java/gregtech/api/gui/GT_GUICover.java @@ -1,9 +1,10 @@ package gregtech.api.gui; +import net.minecraft.item.ItemStack; + import gregtech.api.enums.GT_Values; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.net.GT_Packet_GtTileEntityGuiRequest; -import net.minecraft.item.ItemStack; @Deprecated public abstract class GT_GUICover extends GT_GUIScreen { @@ -27,6 +28,7 @@ public abstract class GT_GUICover extends GT_GUIScreen { /** * The parent GUI to exit to. -1 is ignored. + * * @param parentGuiId */ public void setParentGuiId(int parentGuiId) { @@ -37,13 +39,14 @@ public abstract class GT_GUICover extends GT_GUIScreen { public void closeScreen() {