diff options
author | Jason Mitchell <mitchej@gmail.com> | 2023-01-30 10:56:42 -0800 |
---|---|---|
committer | Jason Mitchell <mitchej@gmail.com> | 2023-01-30 10:56:42 -0800 |
commit | 0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a (patch) | |
tree | 1e2c649f3a6ce3f6b2babd0098a5f4819e9cd0b6 /src/main/java/gregtech/api/gui | |
parent | f8cc82edeb9810c45cba762d733a2c909a302faa (diff) | |
download | GT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.tar.gz GT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.tar.bz2 GT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.zip |
[ci skip] spotlessApply with the new settings
Diffstat (limited to 'src/main/java/gregtech/api/gui')
46 files changed, 812 insertions, 819 deletions
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!!! * <p/> * 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<ItemStack> 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!!! * <p/> @@ -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!!! * <p/> @@ -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<ResourceLocation, Object> cache = CacheBuilder.newBuilder() - .softValues() + private static final LoadingCache<ResourceLocation, Object> cache = CacheBuilder.newBuilder().softValues() .build(new CacheLoader<ResourceLocation, Object>() { + @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<ItemStack> 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() { // If this cover was given a guiId, tell the server to open it for us when this GUI closes. if (parentGuiId != -1 && tile.isUseableByPlayer(mc.thePlayer)) { - GT_Values.NW.sendToServer(new GT_Packet_GtTileEntityGuiRequest( - tile.getXCoord(), - tile.getYCoord(), - tile.getZCoord(), - parentGuiId, - tile.getWorld().provider.dimensionId, - mc.thePlayer.getEntityId())); + GT_Values.NW.sendToServer( + new GT_Packet_GtTileEntityGuiRequest( + tile.getXCoord(), + tile.getYCoord(), + tile.getZCoord(), + parentGuiId, + tile.getWorld().provider.dimensionId, + mc.thePlayer.getEntityId())); } else { this.mc.displayGuiScreen(null); this.mc.setIngameFocus(); diff --git a/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java b/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java index b0c381f104..f2352fb53d 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java +++ b/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java @@ -1,19 +1,22 @@ package gregtech.api.gui; -import gregtech.api.gui.widgets.GT_GuiFakeItemButton; -import gregtech.api.gui.widgets.GT_GuiIcon; -import gregtech.api.gui.widgets.GT_GuiIconButton; -import gregtech.api.util.GT_Utility; import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; + import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; +import gregtech.api.gui.widgets.GT_GuiFakeItemButton; +import gregtech.api.gui.widgets.GT_GuiIcon; +import gregtech.api.gui.widgets.GT_GuiIconButton; +import gregtech.api.util.GT_Utility; + @Deprecated public class GT_GUIDialogSelectItem extends GT_GUIScreen { + public static final int UNSELECTED = -1; private static final int cols = 9; private static final int rows = 3; @@ -25,51 +28,40 @@ public class GT_GUIDialogSelectItem extends GT_GUIScreen { // all slots not including btnCurrent private final List<GT_GuiFakeItemButton> slots = new ArrayList<>(); // the currently selected slot content - private final GT_GuiFakeItemButton btnCurrent = - new GT_GuiFakeItemButton(this, 8, 25, GT_GuiIcon.SLOT_DARKGRAY).setMimicSlot(true); + private final GT_GuiFakeItemButton btnCurrent = new GT_GuiFakeItemButton(this, 8, 25, GT_GuiIcon.SLOT_DARKGRAY) + .setMimicSlot(true); private final boolean noDeselect; private int selected; private int scroll = 0; private GT_GuiIconButton btnUp; private GT_GuiIconButton btnDown; - public GT_GUIDialogSelectItem( - String header, - ItemStack headerItem, - GuiScreen parent, - Consumer<ItemStack> selectedCallback, - List<ItemStack> stacks) { + public GT_GUIDialogSelectItem(String header, ItemStack headerItem, GuiScreen parent, + Consumer<ItemStack> selectedCallback, List<ItemStack> stacks) { this(header, headerItem, parent, selectedCallback, stacks, UNSELECTED); } - public GT_GUIDialogSelectItem( - String header, - ItemStack headerItem, - GuiScreen parent, - Consumer<ItemStack> selectedCallback, - List<ItemStack> stacks, - int selected) { + public GT_GUIDialogSelectItem(String header, ItemStack headerItem, GuiScreen parent, + Consumer<ItemStack> selectedCallback, List<ItemStack> stacks, int selected) { this(header, headerItem, parent, selectedCallback, stacks, selected, false); } /** - * Open a dialog to select an item from given list. Given callback may be called zero or more times depending on user action. - * @param header Header text + * Open a dialog to select an item from given list. Given callback may be called zero or more times depending on + * user action. + * + * @param header Header text * @param headerItem ItemStack to use as Dialog icon * @param parent open which GUIScreen when this dialog is closed. use null if it has no parent. * @param selectedCallback callback upon selected * @param stacks list to choose from - * @param selected preselected item. Use {@link #UNSELECTED} for unselected. Invalid selected will be clamped to 0 or highest index - * @param noDeselect true if player cannot deselect, false otherwise. If this is set to true, selectedCallback is guaranteed to be called with a nonnull stack + * @param selected preselected item. Use {@link #UNSELECTED} for unselected. Invalid selected will be + * clamped to 0 or highest index + * @param noDeselect true if player cannot deselect, false otherwise. If this is set to true, selectedCallback + * is guaranteed to be called with a nonnull stack */ - public GT_GUIDialogSelectItem( - String header, - ItemStack headerItem, - GuiScreen parent, - Consumer<ItemStack> selectedCallback, - List<ItemStack> stacks, - int selected, - boolean noDeselect) { + public GT_GUIDialogSelectItem(String header, ItemStack headerItem, GuiScreen parent, + Consumer<ItemStack> selectedCallback, List<ItemStack> stacks, int selected, boolean noDeselect) { super(176, 107, header); this.noDeselect = noDeselect; if (headerItem != null) this.headerIcon.setItem(headerItem); @@ -84,8 +76,9 @@ public class GT_GUIDialogSelectItem extends GT_GUIScreen { for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { - slots.add(new GT_GuiFakeItemButton(this, 8 + 18 * j, 44 + 18 * i, GT_GuiIcon.SLOT_GRAY) - .setMimicSlot(true)); + slots.add( + new GT_GuiFakeItemButton(this, 8 + 18 * j, 44 + 18 * i, GT_GuiIcon.SLOT_GRAY) + .setMimicSlot(true)); } } @@ -163,8 +156,7 @@ public class GT_GUIDialogSelectItem extends GT_GUIScreen { private void fillSlots() { for (int i = 0, j = scroll * cols; i < slots.size(); i++, j++) { - slots.get(i) - .setItem(getCandidate(j)) + slots.get(i).setItem(getCandidate(j)) .setBgIcon(j == getSelected() ? GT_GuiIcon.SLOT_DARKGRAY : GT_GuiIcon.SLOT_GRAY); } } diff --git a/src/main/java/gregtech/api/gui/GT_GUIScreen.java b/src/main/java/gregtech/api/gui/GT_GUIScreen.java index 141f51e7c7..1aa9ccc24c 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIScreen.java +++ b/src/main/java/gregtech/api/gui/GT_GUIScreen.java @@ -1,14 +1,8 @@ package gregtech.api.gui; -import gregtech.api.enums.Dyes; -import gregtech.api.gui.widgets.GT_GuiFakeItemButton; -import gregtech.api.gui.widgets.GT_GuiIntegerTextBox; -import gregtech.api.gui.widgets.GT_GuiTooltip; -import gregtech.api.gui.widgets.GT_GuiTooltipManager; -import gregtech.api.gui.widgets.GT_GuiTooltipManager.GT_IToolTipRenderer; -import gregtech.api.interfaces.IGuiScreen; import java.util.ArrayList; import java.util.List; + import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; @@ -16,10 +10,19 @@ import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.util.ResourceLocation; + import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; +import gregtech.api.enums.Dyes; +import gregtech.api.gui.widgets.GT_GuiFakeItemButton; +import gregtech.api.gui.widgets.GT_GuiIntegerTextBox; +import gregtech.api.gui.widgets.GT_GuiTooltip; +import gregtech.api.gui.widgets.GT_GuiTooltipManager; +import gregtech.api.gui.widgets.GT_GuiTooltipManager.GT_IToolTipRenderer; +import gregtech.api.interfaces.IGuiScreen; + @Deprecated public abstract class GT_GUIScreen extends GuiScreen implements GT_IToolTipRenderer, IGuiScreen { @@ -161,7 +164,7 @@ public abstract class GT_GUIScreen extends GuiScreen implements GT_IToolTipRende if (tBox.isEnabled() || hadFocus) tBox.mouseClicked(x, y, button); if (tBox.isFocused() && button == 1 && tBox.isEnabled()) // rightclick -> lcear it - tBox.setText("0"); + tBox.setText("0"); else if (hadFocus && !tBox.isFocused()) applyTextBox(tBox); } super.mouseClicked(x, y, button); diff --git a/src/main/java/gregtech/api/gui/GT_Slot_Armor.java b/src/main/java/gregtech/api/gui/GT_Slot_Armor.java index 3b454aee0e..be9b0e5e00 100644 --- a/src/main/java/gregtech/api/gui/GT_Slot_Armor.java +++ b/src/main/java/gregtech/api/gui/GT_Slot_Armor.java @@ -6,6 +6,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class GT_Slot_Armor extends Slot { + final int mArmorType; final EntityPlayer mPlayer; diff --git a/src/main/java/gregtech/api/gui/GT_Slot_DataOrb.java b/src/main/java/gregtech/api/gui/GT_Slot_DataOrb.java index 0a78e3f0b3..115b50ddb8 100644 --- a/src/main/java/gregtech/api/gui/GT_Slot_DataOrb.java +++ b/src/main/java/gregtech/api/gui/GT_Slot_DataOrb.java @@ -1,11 +1,13 @@ package gregtech.api.gui; -import gregtech.api.enums.ItemList; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import gregtech.api.enums.ItemList; + public class GT_Slot_DataOrb extends Slot { + public GT_Slot_DataOrb(IInventory inventory, int slotIndex, int xPos, int yPos) { super(inventory, slotIndex, xPos, yPos); } diff --git a/src/main/java/gregtech/api/gui/GT_Slot_Holo.java b/src/main/java/gregtech/api/gui/GT_Slot_Holo.java index bf5f8886b3..a01b91cefb 100644 --- a/src/main/java/gregtech/api/gui/GT_Slot_Holo.java +++ b/src/main/java/gregtech/api/gui/GT_Slot_Holo.java @@ -1,26 +1,22 @@ package gregtech.api.gui; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class GT_Slot_Holo extends Slot { + public final int mSlotIndex; public boolean mEnabled = true; public boolean mCanInsertItem, mCanStackItem; public int mMaxStacksize = 127; - public GT_Slot_Holo( - IInventory inventory, - int slotIndex, - int xPos, - int yPos, - boolean aCanInsertItem, - boolean aCanStackItem, - int aMaxStacksize) { + public GT_Slot_Holo(IInventory inventory, int slotIndex, int xPos, int yPos, boolean aCanInsertItem, + boolean aCanStackItem, int aMaxStacksize) { super(inventory, slotIndex, xPos, yPos); mCanInsertItem = aCanInsertItem; mCanStackItem = aCanStackItem; @@ -55,8 +51,8 @@ public class GT_Slot_Holo extends Slot { } /** - * Whether this slot should be ignored in event processing, - * for example highlight the slot on mouseOver + * Whether this slot should be ignored in event processing, for example highlight the slot on mouseOver + * * @param enabled */ public void setEnabled(boolean enabled) { diff --git a/src/main/java/gregtech/api/gui/GT_Slot_Output.java b/src/main/java/gregtech/api/gui/GT_Slot_Output.java index d348e4e236..7c883ea2d1 100644 --- a/src/main/java/gregtech/api/gui/GT_Slot_Output.java +++ b/src/main/java/gregtech/api/gui/GT_Slot_Output.java @@ -5,6 +5,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class GT_Slot_Output extends Slot { + public GT_Slot_Output(IInventory inventory, int slotIndex, int xPos, int yPos) { super(inventory, slotIndex, xPos, yPos); } diff --git a/src/main/java/gregtech/api/gui/GT_Slot_Render.java b/src/main/java/gregtech/api/gui/GT_Slot_Render.java index dd11aa6305..ae03ce83ea 100644 --- a/src/main/java/gregtech/api/gui/GT_Slot_Render.java +++ b/src/main/java/gregtech/api/gui/GT_Slot_Render.java @@ -5,12 +5,14 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; public class GT_Slot_Render extends GT_Slot_Holo { + public GT_Slot_Render(IInventory inventory, int slotIndex, int xPos, int yPos) { super(inventory, slotIndex, xPos, yPos, false, false, 0); } /** - * NEI has a nice and "useful" Delete-All Function, which would delete the Content of this Slot. This is here to prevent that. + * NEI has a nice and "useful" Delete-All Function, which would delete the Content of this Slot. This is here to + * prevent that. */ @Override public void putStack(ItemStack aStack) { diff --git a/src/main/java/gregtech/api/gui/modularui/FallbackableSteamTexture.java b/src/main/java/gregtech/api/gui/modularui/FallbackableSteamTexture.java index 9216d1d224..f242aff0ed 100644 --- a/src/main/java/gregtech/api/gui/modularui/FallbackableSteamTexture.java +++ b/src/main/java/gregtech/api/gui/modularui/FallbackableSteamTexture.java @@ -1,15 +1,17 @@ package gregtech.api.gui.modularui; -import com.gtnewhorizons.modularui.api.drawable.UITexture; -import com.gtnewhorizons.modularui.common.internal.network.NetworkUtils; -import gregtech.api.enums.SteamVariant; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; + import net.minecraft.client.Minecraft; +import com.gtnewhorizons.modularui.api.drawable.UITexture; +import com.gtnewhorizons.modularui.common.internal.network.NetworkUtils; +import gregtech.api.enums.SteamVariant; + public class FallbackableSteamTexture { private final SteamTexture candidate; diff --git a/src/main/java/gregtech/api/gui/modularui/GT_CoverUIBuildContext.java b/src/main/java/gregtech/api/gui/modularui/GT_CoverUIBuildContext.java index 811ad8be5f..65a61ad951 100644 --- a/src/main/java/gregtech/api/gui/modularui/GT_CoverUIBuildContext.java +++ b/src/main/java/gregtech/api/gui/modularui/GT_CoverUIBuildContext.java @@ -1,8 +1,9 @@ package gregtech.api.gui.modularui; +import net.minecraft.entity.player.EntityPlayer; + import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import gregtech.api.interfaces.tileentity.ICoverable; -import net.minecraft.entity.player.EntityPlayer; public class GT_CoverUIBuildContext extends UIBuildContext { @@ -14,15 +15,15 @@ public class GT_CoverUIBuildContext extends UIBuildContext { private final int guiColorization; /** - * @param player Player opened this UI - * @param coverID See {@link ICoverable#getCoverIDAtSide} - * @param side Side this cover is attached to - * @param tile Tile this cover is attached to - * @param anotherWindow If cover UI is shown on top of another window + * @param player Player opened this UI + * @param coverID See {@link ICoverable#getCoverIDAtSide} + * @param side Side this cover is attached to + * @param tile Tile this cover is attached to + * @param anotherWindow If cover UI is shown on top of another window * @param guiColorization The color used to render machine's GUI */ - public GT_CoverUIBuildContext( - EntityPlayer player, int coverID, byte side, ICoverable tile, boolean anotherWindow, int guiColorization) { + public GT_CoverUIBuildContext(EntityPlayer player, int coverID, byte side, ICoverable tile, boolean anotherWindow, + int guiColorization) { super(player); this.coverID = coverID; this.side = side; @@ -32,10 +33,10 @@ public class GT_CoverUIBuildContext extends UIBuildContext { } /** - * @param player Player opened this UI - * @param coverID See {@link ICoverable#getCoverIDAtSide} - * @param side Side this cover is attached to - * @param tile Tile this cover is attached to + * @param player Player opened this UI + * @param coverID See {@link ICoverable#getCoverIDAtSide} + * @param side Side this cover is attached to + * @param tile Tile this cover is attached to * @param anotherWindow If cover GUI is shown in opened on top of another window */ public GT_CoverUIBuildContext(EntityPlayer player, int coverID, byte side, ICoverable tile, boolean anotherWindow) { diff --git a/src/main/java/gregtech/api/gui/modularui/GT_UIInfos.java b/src/main/java/gregtech/api/gui/modularui/GT_UIInfos.java index d1e699bb40..32ed6442c1 100644 --- a/src/main/java/gregtech/api/gui/modularui/GT_UIInfos.java +++ b/src/main/java/gregtech/api/gui/modularui/GT_UIInfos.java @@ -1,5 +1,14 @@ package gregtech.api.gui.modularui; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + import com.gtnewhorizons.modularui.api.UIInfos; import com.gtnewhorizons.modularui.api.screen.ITileWithModularUI; import com.gtnewhorizons.modularui.api.screen.ModularUIContext; @@ -10,6 +19,7 @@ import com.gtnewhorizons.modularui.common.builder.UIInfo; import com.gtnewhorizons.modularui.common.internal.network.NetworkUtils; import com.gtnewhorizons.modularui.common.internal.wrapper.ModularGui; import com.gtnewhorizons.modularui.common.internal.wrapper.ModularUIContainer; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.GT_Values; @@ -17,47 +27,37 @@ import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; import gregtech.api.net.GT_Packet_SendCoverData; import gregtech.api.util.GT_CoverBehaviorBase; -import java.util.HashMap; -import java.util.Map; -import java.util.function.Function; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; public class GT_UIInfos { /** - * Generator for {@link UIInfo} which is responsible for registering and opening UIs. - * Unlike {@link com.gtnewhorizons.modularui.api.UIInfos#TILE_MODULAR_UI}, this accepts - * custom constructors for UI. - * <br> Do NOT run {@link UIBuilder#build} on-the-fly, otherwise MP client won't register UIs. - * Instead, store to static field, just like {@link #GTTileEntityDefaultUI}. - * Such mistake can be easily overlooked by testing only SP. + * Generator for {@link UIInfo} which is responsible for registering and opening UIs. Unlike + * {@link com.gtnewhorizons.modularui.api.UIInfos#TILE_MODULAR_UI}, this accepts custom constructors for UI. <br> + * Do NOT run {@link UIBuilder#build} on-the-fly, otherwise MP client won't register UIs. Instead, store to static + * field, just like {@link #GTTileEntityDefaultUI}. Such mistake can be easily overlooked by testing only SP. */ - public static final Function<ContainerConstructor, UIInfo<?, ?>> GTTileEntityUIFactory = - containerConstructor -> UIBuilder.of() - .container((player, world, x, y, z) -> { - TileEntity te = world.getTileEntity(x, y, z); - if (te instanceof ITileWithModularUI) { - return createTileEntityContainer( - player, - ((ITileWithModularUI) te)::createWindow, - te::markDirty, - containerConstructor); - } - return null; - }) - .gui(((player, world, x, y, z) -> { - if (!world.isRemote) return null; - TileEntity te = world.getTileEntity(x, y, z); - if (te instanceof ITileWithModularUI) { - return createTileEntityGuiContainer( - player, ((ITileWithModularUI) te)::createWindow, containerConstructor); - } - return null; - })) - .build(); + public static final Function<ContainerConstructor, UIInfo<?, ?>> GTTileEntityUIFactory = containerConstructor -> UIBuilder + .of().container((player, world, x, y, z) -> { + TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof ITileWithModularUI) { + return createTileEntityContainer( + player, + ((ITileWithModularUI) te)::createWindow, + te::markDirty, + containerConstructor); + } + return null; + }).gui(((player, world, x, y, z) -> { + if (!world.isRemote) return null; + TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof ITileWithModularUI) { + return createTileEntityGuiContainer( + player, + ((ITileWithModularUI) te)::createWindow, + containerConstructor); + } + return null; + })).build(); private static final UIInfo<?, ?> GTTileEntityDefaultUI = GTTileEntityUIFactory.apply(ModularUIContainer::new); @@ -66,36 +66,31 @@ public class GT_UIInfos { static { for (byte i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) { final byte side = i; - coverUI.put( - side, - UIBuilder.of() - .container((player, world, x, y, z) -> { - final TileEntity te = world.getTileEntity(x, y, z); - if (!(te instanceof ICoverable)) return null; - final ICoverable gtTileEntity = (ICoverable) te; - GT_CoverBehaviorBase<?> cover = gtTileEntity.getCoverBehaviorAtSideNew(side); - return createCoverContainer( - player, - cover::createWindow, - te::markDirty, - gtTileEntity.getCoverIDAtSide(side), - side, - gtTileEntity); - }) - .gui((player, world, x, y, z) -> { - if (!world.isRemote) return null; - final TileEntity te = world.getTileEntity(x, y, z); - if (!(te instanceof ICoverable)) return null; - final ICoverable gtTileEntity = (ICoverable) te; - final GT_CoverBehaviorBase<?> cover = gtTileEntity.getCoverBehaviorAtSideNew(side); - return createCoverGuiContainer( - player, - cover::createWindow, - gtTileEntity.getCoverIDAtSide(side), - side, - gtTileEntity); - }) - .build()); + coverUI.put(side, UIBuilder.of().container((player, world, x, y, z) -> { + final TileEntity te = world.getTileEntity(x, y, z); + if (!(te instanceof ICoverable)) return null; + final ICoverable gtTileEntity = (ICoverable) te; + GT_CoverBehaviorBase<?> cover = gtTileEntity.getCoverBehaviorAtSideNew(side); + return createCoverContainer( + player, + cover::createWindow, + te::markDirty, + gtTileEntity.getCoverIDAtSide(side), + side, + gtTileEntity); + }).gui((player, world, x, y, z) -> { + if (!world.isRemote) return null; + final TileEntity te = world.getTileEntity(x, y, z); + if (!(te instanceof ICoverable)) return null; + final ICoverable gtTileEntity = (ICoverable) te; + final GT_CoverBehaviorBase<?> cover = gtTileEntity.getCoverBehaviorAtSideNew(side); + return createCoverGuiContainer( + player, + cover::createWindow, + gtTileEntity.getCoverIDAtSide(side), + side, + gtTileEntity); + }).build()); } } @@ -126,27 +121,25 @@ public class GT_UIInfos { tileEntity), (EntityPlayerMP) player); - coverUI.get(side) - .open( - player, - tileEntity.getWorld(), - tileEntity.getXCoord(), - tileEntity.getYCoord(), - tileEntity.getZCoord()); + coverUI.get(side).open( + player, + tileEntity.getWorld(), + tileEntity.getXCoord(), + tileEntity.getYCoord(), + tileEntity.getZCoord()); } /** - * Opens UI for player's item, created by {@link com.gtnewhorizons.modularui.api.screen.IItemWithModularUI#createWindow}. + * Opens UI for player's item, created by + * {@link com.gtnewhorizons.modularui.api.screen.IItemWithModularUI#createWindow}. */ public static void openPlayerHeldItemUI(EntityPlayer player) { if (NetworkUtils.isClient()) return; UIInfos.PLAYER_HELD_ITEM_UI.open(player); } - private static ModularUIContainer createTileEntityContainer( - EntityPlayer player, - Function<UIBuildContext, ModularWindow> windowCreator, - Runnable onWidgetUpdate, + private static ModularUIContainer createTileEntityContainer(EntityPlayer player, + Function<UIBuildContext, ModularWindow> windowCreator, Runnable onWidgetUpdate, ContainerConstructor containerCreator) { final UIBuildContext buildContext = new UIBuildContext(player); final ModularWindow window = windowCreator.apply(buildContext); @@ -155,23 +148,20 @@ public class GT_UIInfos { } @SideOnly(Side.CLIENT) - private static ModularGui createTileEntityGuiContainer( - EntityPlayer player, - Function<UIBuildContext, ModularWindow> windowCreator, - ContainerConstructor containerConstructor) { - final ModularUIContainer container = - createTileEntityContainer(player, windowCreator, null, containerConstructor); + private static ModularGui createTileEntityGuiContainer(EntityPlayer player, + Function<UIBuildContext, ModularWindow> windowCreator, ContainerConstructor containerConstructor) { + final ModularUIContainer container = createTileEntityContainer( + player, + windowCreator, + null, + containerConstructor); if (container == null) return null; return new ModularGui(container); } - private static ModularUIContainer createCoverContainer( - EntityPlayer player, - Function<GT_CoverUIBuildContext, ModularWindow> windowCreator, - Runnable onWidgetUpdate, - int coverID, - byte side, - ICoverable tile) { + private static ModularUIContainer createCoverContainer(EntityPlayer player, + Function<GT_CoverUIBuildContext, ModularWindow> windowCreator, Runnable onWidgetUpdate, int coverID, + byte side, ICoverable tile) { final GT_CoverUIBuildContext buildContext = new GT_CoverUIBuildContext(player, coverID, side, tile, false); final ModularWindow window = windowCreator.apply(buildContext); if (window == null) return null; @@ -179,12 +169,8 @@ public class GT_UIInfos { } @SideOnly(Side.CLIENT) - private static ModularGui createCoverGuiContainer( - EntityPlayer player, - Function<GT_CoverUIBuildContext, ModularWindow> windowCreator, - int coverID, - byte side, - ICoverable tile) { + private static ModularGui createCoverGuiContainer(EntityPlayer player, + Function<GT_CoverUIBuildContext, ModularWindow> windowCreator, int coverID, byte side, ICoverable tile) { final ModularUIContainer container = createCoverContainer(player, windowCreator, null, coverID, side, tile); if (container == null) { return null; @@ -194,6 +180,7 @@ public class GT_UIInfos { @FunctionalInterface public interface ContainerConstructor { + ModularUIContainer of(ModularUIContext context, ModularWindow mainWindow); } } diff --git a/src/main/java/gregtech/api/gui/modularui/GT_UITextures.java b/src/main/java/gregtech/api/gui/modularui/GT_UITextures.java index 3ca1e6d45e..a480178002 100644 --- a/src/main/java/gregtech/api/gui/modularui/GT_UITextures.java +++ b/src/main/java/gregtech/api/gui/modularui/GT_UITextures.java @@ -1,33 +1,34 @@ package gregtech.api.gui.modularui; -import com.gtnewhorizons.modularui.api.drawable.AdaptableUITexture; -import com.gtnewhorizons.modularui.api.drawable.UITexture; import java.util.function.BiFunction; import java.util.stream.Collectors; import java.util.stream.IntStream; +import com.gtnewhorizons.modularui.api.drawable.AdaptableUITexture; +import com.gtnewhorizons.modularui.api.drawable.UITexture; + public class GT_UITextures { private static final String MODID = "gregtech"; public static final UITexture TRANSPARENT = UITexture.fullImage(MODID, "gui/picture/transparent"); - public static final AdaptableUITexture BACKGROUND_SINGLEBLOCK_DEFAULT = - AdaptableUITexture.of(MODID, "gui/background/singleblock_default", 176, 166, 4); - public static final SteamTexture BACKGROUND_STEAM = - SteamTexture.adaptableTexture(MODID, "gui/background/%s", 176, 166, 4); - public static final UITexture BACKGROUND_FUSION_COMPUTER = - UITexture.fullImage(MODID, "gui/background/fusion_computer"); - public static final AdaptableUITexture BACKGROUND_TEXT_FIELD = - AdaptableUITexture.of(MODID, "gui/background/text_field", 142, 28, 1); - public static final AdaptableUITexture BACKGROUND_TEXT_FIELD_LIGHT_GRAY = - AdaptableUITexture.of(MODID, "gui/background/text_field_light_gray", 61, 12, 1); + public static final AdaptableUITexture BACKGROUND_SINGLEBLOCK_DEFAULT = AdaptableUITexture + .of(MODID, "gui/background/singleblock_default", 176, 166, 4); + public static final SteamTexture BACKGROUND_STEAM = SteamTexture + .adaptableTexture(MODID, "gui/background/%s", 176, 166, 4); + public static final UITexture BACKGROUND_FUSION_COMPUTER = UITexture + .fullImage(MODID, "gui/background/fusion_computer"); + public static final AdaptableUITexture BACKGROUND_TEXT_FIELD = AdaptableUITexture + .of(MODID, "gui/background/text_field", 142, 28, 1); + public static final AdaptableUITexture BACKGROUND_TEXT_FIELD_LIGHT_GRAY = AdaptableUITexture + .of(MODID, "gui/background/text_field_light_gray", 61, 12, 1); public static final SteamTexture SLOT_ITEM_STEAM = SteamTexture.fullImage(MODID, "gui/slot/item_%s"); - public static final AdaptableUITexture SLOT_DARK_GRAY = - AdaptableUITexture.of(MODID, "gui/slot/dark_gray", 18, 18, 1); - public static final AdaptableUITexture SLOT_MAINTENANCE = - AdaptableUITexture.of(MODID, "gui/slot/maintenance", 20, 20, 1); + public static final AdaptableUITexture SLOT_DARK_GRAY = AdaptableUITexture + .of(MODID, "gui/slot/dark_gray", 18, 18, 1); + public static final AdaptableUITexture SLOT_MAINTENANCE = AdaptableUITexture + .of(MODID, "gui/slot/maintenance", 20, 20, 1); public static final AdaptableUITexture SLOT_UPLIFTED = AdaptableUITexture.of(MODID, "gui/slot/uplifted", 18, 18, 1); public static final UITexture OVERLAY_SLOT_ARROW_ME = UITexture.fullImage(MODID, "gui/overlay_slot/arrow_me"); @@ -39,51 +40,51 @@ public class GT_UITextures { public static final UITexture OVERLAY_SLOT_BOX = UITexture.fullImage(MODID, "gui/overlay_slot/box"); public static final UITexture OVERLAY_SLOT_BOXED = UITexture.fullImage(MODID, "gui/overlay_slot/boxed"); public static final UITexture OVERLAY_SLOT_CANISTER = UITexture.fullImage(MODID, "gui/overlay_slot/canister"); - public static final SteamTexture OVERLAY_SLOT_CANISTER_STEAM = - SteamTexture.fullImage(MODID, "gui/overlay_slot/canister_%s"); + public static final SteamTexture OVERLAY_SLOT_CANISTER_STEAM = SteamTexture + .fullImage(MODID, "gui/overlay_slot/canister_%s"); public static final UITexture OVERLAY_SLOT_CANNER = UITexture.fullImage(MODID, "gui/overlay_slot/canner"); public static final UITexture OVERLAY_SLOT_CAULDRON = UITexture.fullImage(MODID, "gui/overlay_slot/cauldron"); public static final UITexture OVERLAY_SLOT_CENTRIFUGE = UITexture.fullImage(MODID, "gui/overlay_slot/centrifuge"); - public static final UITexture OVERLAY_SLOT_CENTRIFUGE_FLUID = - UITexture.fullImage(MODID, "gui/overlay_slot/centrifuge_fluid"); - public static final SteamTexture OVERLAY_SLOT_CENTRIFUGE_STEAM = - SteamTexture.fullImage(MODID, "gui/overlay_slot/centrifuge_%s"); + public static final UITexture OVERLAY_SLOT_CENTRIFUGE_FLUID = UITexture + .fullImage(MODID, "gui/overlay_slot/centrifuge_fluid"); + public static final SteamTexture OVERLAY_SLOT_CENTRIFUGE_STEAM = SteamTexture + .fullImage(MODID, "gui/overlay_slot/centrifuge_%s"); public static final UITexture OVERLAY_SLOT_CHARGER = UITexture.fullImage(MODID, "gui/overlay_slot/charger"); - public static final UITexture OVERLAY_SLOT_CHARGER_FLUID = - UITexture.fullImage(MODID, "gui/overlay_slot/charger_fluid"); + public static final UITexture OVERLAY_SLOT_CHARGER_FLUID = UITexture + .fullImage(MODID, "gui/overlay_slot/charger_fluid"); public static final UITexture OVERLAY_SLOT_CIRCUIT = UITexture.fullImage(MODID, "gui/overlay_slot/circuit"); - public static final SteamTexture OVERLAY_SLOT_COAL_STEAM = - SteamTexture.fullImage(MODID, "gui/overlay_slot/coal_%s"); + public static final SteamTexture OVERLAY_SLOT_COAL_STEAM = SteamTexture + .fullImage(MODID, "gui/overlay_slot/coal_%s"); public static final UITexture OVERLAY_SLOT_COMPRESSOR = UITexture.fullImage(MODID, "gui/overlay_slot/compressor"); - public static final SteamTexture OVERLAY_SLOT_COMPRESSOR_STEAM = - SteamTexture.fullImage(MODID, "gui/overlay_slot/compressor_%s"); + public static final SteamTexture OVERLAY_SLOT_COMPRESSOR_STEAM = SteamTexture + .fullImage(MODID, "gui/overlay_slot/compressor_%s"); public static final UITexture OVERLAY_SLOT_CRUSHED_ORE = UITexture.fullImage(MODID, "gui/overlay_slot/crushed_ore"); - public static final SteamTexture OVERLAY_SLOT_CRUSHED_ORE_STEAM = - SteamTexture.fullImage(MODID, "gui/overlay_slot/crushed_ore_%s"); - public static final UITexture OVERLAY_SLOT_CUTTER_SLICED = - UITexture.fullImage(MODID, "gui/overlay_slot/cutter_sliced"); + public static final SteamTexture OVERLAY_SLOT_CRUSHED_ORE_STEAM = SteamTexture + .fullImage(MODID, "gui/overlay_slot/crushed_ore_%s"); + public static final UITexture OVERLAY_SLOT_CUTTER_SLICED = UITexture + .fullImage(MODID, "gui/overlay_slot/cutter_sliced"); public static final UITexture OVERLAY_SLOT_DATA_ORB = UITexture.fullImage(MODID, "gui/overlay_slot/data_orb"); public static final UITexture OVERLAY_SLOT_DATA_STICK = UITexture.fullImage(MODID, "gui/overlay_slot/data_stick"); public static final UITexture OVERLAY_SLOT_DUST = UITexture.fullImage(MODID, "gui/overlay_slot/dust"); - public static final SteamTexture OVERLAY_SLOT_DUST_STEAM = - SteamTexture.fullImage(MODID, "gui/overlay_slot/dust_%s"); + public static final SteamTexture OVERLAY_SLOT_DUST_STEAM = SteamTexture + .fullImage(MODID, "gui/overlay_slot/dust_%s"); public static final UITexture OVERLAY_SLOT_EXPLOSIVE = UITexture.fullImage(MODID, "gui/overlay_slot/explosive"); - public static final UITexture OVERLAY_SLOT_EXTRUDER_SHAPE = - UITexture.fullImage(MODID, "gui/overlay_slot/extruder_shape"); + public static final UITexture OVERLAY_SLOT_EXTRUDER_SHAPE = UITexture + .fullImage(MODID, "gui/overlay_slot/extruder_shape"); public static final UITexture OVERLAY_SLOT_FURNACE = UITexture.fullImage(MODID, "gui/overlay_slot/furnace"); - public static final SteamTexture OVERLAY_SLOT_FURNACE_STEAM = - SteamTexture.fullImage(MODID, "gui/overlay_slot/furnace_%s"); + public static final SteamTexture OVERLAY_SLOT_FURNACE_STEAM = SteamTexture + .fullImage(MODID, "gui/overlay_slot/furnace_%s"); public static final UITexture OVERLAY_SLOT_GEM = UITexture.fullImage(MODID, "gui/overlay_slot/gem"); public static final UITexture OVERLAY_SLOT_HAMMER = UITexture.fullImage(MODID, "gui/overlay_slot/hammer"); - public static final SteamTexture OVERLAY_SLOT_HAMMER_STEAM = - SteamTexture.fullImage(MODID, "gui/overlay_slot/hammer_%s"); + public static final SteamTexture OVERLAY_SLOT_HAMMER_STEAM = SteamTexture + .fullImage(MODID, "gui/overlay_slot/hammer_%s"); public static final UITexture OVERLAY_SLOT_HEATER_1 = UITexture.fullImage(MODID, "gui/overlay_slot/heater_1"); public static final UITexture OVERLAY_SLOT_HEATER_2 = UITexture.fullImage(MODID, "gui/overlay_slot/heater_2"); public static final UITexture OVERLAY_SLOT_IMPLOSION = UITexture.fullImage(MODID, "gui/overlay_slot/implosion"); public static final UITexture OVERLAY_SLOT_IN = UITexture.fullImage(MODID, "gui/overlay_slot/in"); public static final SteamTexture OVERLAY_SLOT_IN_STEAM = SteamTexture.fullImage(MODID, "gui/overlay_slot/in_%s"); - public static final SteamTexture OVERLAY_SLOT_INGOT_STEAM = - SteamTexture.fullImage(MODID, "gui/overlay_slot/ingot_%s"); + public static final SteamTexture OVERLAY_SLOT_INGOT_STEAM = SteamTexture + .fullImage(MODID, "gui/overlay_slot/ingot_%s"); public static final UITexture OVERLAY_SLOT_INT_CIRCUIT = UITexture.fullImage(MODID, "gui/overlay_slot/int_circuit"); public static final UITexture OVERLAY_SLOT_LENS = UITexture.fullImage(MODID, "gui/overlay_slot/lens"); public static final UITexture OVERLAY_SLOT_MICROSCOPE = UITexture.fullImage(MODID, "gui/overlay_slot/microscope"); @@ -94,8 +95,8 @@ public class GT_UITextures { public static final UITexture OVERLAY_SLOT_OUT = UITexture.fullImage(MODID, "gui/overlay_slot/out"); public static final SteamTexture OVERLAY_SLOT_OUT_STEAM = SteamTexture.fullImage(MODID, "gui/overlay_slot/out_%s"); public static final UITexture OVERLAY_SLOT_PAGE_BLANK = UITexture.fullImage(MODID, "gui/overlay_slot/page_blank"); - public static final UITexture OVERLAY_SLOT_PAGE_PRINTED = - UITexture.fullImage(MODID, "gui/overlay_slot/page_printed"); + public static final UITexture OVERLAY_SLOT_PAGE_PRINTED = UITexture + .fullImage(MODID, "gui/overlay_slot/page_printed"); public static final UITexture OVERLAY_SLOT_PRESS_1 = UITexture.fullImage(MODID, "gui/overlay_slot/press_1"); public static final UITexture OVERLAY_SLOT_PRESS_2 = UITexture.fullImage(MODID, "gui/overlay_slot/press_2"); public static final UITexture OVERLAY_SLOT_PRESS_3 = UITexture.fullImage(MODID, "gui/overlay_slot/press_3"); @@ -103,8 +104,8 @@ public class GT_UITextures { public static final UITexture OVERLAY_SLOT_ROD_1 = UITexture.fullImage(MODID, "gui/overlay_slot/rod_1"); public static final UITexture OVERLAY_SLOT_ROD_2 = UITexture.fullImage(MODID, "gui/overlay_slot/rod_2"); public static final UITexture OVERLAY_SLOT_SLICE_SHAPE = UITexture.fullImage(MODID, "gui/overlay_slot/slice_shape"); - public static final UITexture OVERLAY_SLOT_SLICER_SLICED = - UITexture.fullImage(MODID, "gui/overlay_slot/slicer_sliced"); + public static final UITexture OVERLAY_SLOT_SLICER_SLICED = UITexture + .fullImage(MODID, "gui/overlay_slot/slicer_sliced"); public static final UITexture OVERLAY_SLOT_SQUARE = UITexture.fullImage(MODID, "gui/overlay_slot/square"); public static final UITexture OVERLAY_SLOT_UUA = UITexture.fullImage(MODID, "gui/overlay_slot/uua"); public static final UITexture OVERLAY_SLOT_UUM = UITexture.fullImage(MODID, "gui/overlay_slot/uum"); @@ -113,54 +114,53 @@ public class GT_UITextures { public static final UITexture OVERLAY_SLOT_WIREMILL = UITexture.fullImage(MODID, "gui/overlay_slot/wiremill"); public static final UITexture OVERLAY_SLOT_WRENCH = UITexture.fullImage(MODID, "gui/overlay_slot/wrench"); public static final UITexture[] OVERLAY_SLOTS_NUMBER = IntStream.range(0, 12) - .mapToObj(i -> UITexture.fullImage(MODID, "gui/overlay_slot/number_" + i)) - .collect(Collectors.toList()) + .mapToObj(i -> UITexture.fullImage(MODID, "gui/overlay_slot/number_" + i)).collect(Collectors.toList()) .toArray(new UITexture[0]); public static final UITexture PROGRESSBAR_ARROW = UITexture.fullImage(MODID, "gui/progressbar/arrow"); - public static final SteamTexture PROGRESSBAR_ARROW_STEAM = - SteamTexture.fullImage(MODID, "gui/progressbar/arrow_%s"); - public static final SteamTexture PROGRESSBAR_ARROW_2_STEAM = - SteamTexture.fullImage(MODID, "gui/progressbar/arrow_2_%s"); - public static final UITexture PROGRESSBAR_ARROW_MULTIPLE = - UITexture.fullImage(MODID, "gui/progressbar/arrow_multiple"); + public static final SteamTexture PROGRESSBAR_ARROW_STEAM = SteamTexture + .fullImage(MODID, "gui/progressbar/arrow_%s"); + public static final SteamTexture PROGRESSBAR_ARROW_2_STEAM = SteamTexture + .fullImage(MODID, "gui/progressbar/arrow_2_%s"); + public static final UITexture PROGRESSBAR_ARROW_MULTIPLE = UITexture + .fullImage(MODID, "gui/progressbar/arrow_multiple"); public static final UITexture PROGRESSBAR_ASSEMBLE = UITexture.fullImage(MODID, "gui/progressbar/assemble"); - public static final UITexture PROGRESSBAR_ASSEMBLY_LINE_1 = - UITexture.fullImage(MODID, "gui/progressbar/assemblyline_1"); - public static final UITexture PROGRESSBAR_ASSEMBLY_LINE_2 = - UITexture.fullImage(MODID, "gui/progressbar/assemblyline_2"); - public static final UITexture PROGRESSBAR_ASSEMBLY_LINE_3 = - UITexture.fullImage(MODID, "gui/progressbar/assemblyline_3"); + public static final UITexture PROGRESSBAR_ASSEMBLY_LINE_1 = UITexture + .fullImage(MODID, "gui/progressbar/assemblyline_1"); + public static final UITexture PROGRESSBAR_ASSEMBLY_LINE_2 = UITexture + .fullImage(MODID, "gui/progressbar/assemblyline_2"); + public static final UITexture PROGRESSBAR_ASSEMBLY_LINE_3 = UITexture + .fullImage(MODID, "gui/progressbar/assemblyline_3"); public static final UITexture PROGRESSBAR_BATH = UITexture.fullImage(MODID, "gui/progressbar/bath"); public static final UITexture PROGRESSBAR_BENDING = UITexture.fullImage(MODID, "gui/progressbar/bending"); - public static final SteamTexture PROGRESSBAR_BOILER_EMPTY_STEAM = - SteamTexture.fullImage(MODID, "gui/progressbar/boiler_empty_%s"); + public static final SteamTexture PROGRESSBAR_BOILER_EMPTY_STEAM = SteamTexture + .fullImage(MODID, "gui/progressbar/boiler_empty_%s"); public static final UITexture PROGRESSBAR_BOILER_HEAT = UITexture.fullImage(MODID, "gui/progressbar/boiler_heat"); public static final UITexture PROGRESSBAR_BOILER_STEAM = UITexture.fullImage(MODID, "gui/progressbar/boiler_steam"); public static final UITexture PROGRESSBAR_BOILER_WATER = UITexture.fullImage(MODID, "gui/progressbar/boiler_water"); public static final UITexture PROGRESSBAR_CANNER = UITexture.fullImage(MODID, "gui/progressbar/canner"); - public static final UITexture PROGRESSBAR_CIRCUIT_ASSEMBLER = - UITexture.fullImage(MODID, "gui/progressbar/circuit_assembler"); + public static final UITexture PROGRESSBAR_CIRCUIT_ASSEMBLER = UITexture + .fullImage(MODID, "gui/progressbar/circuit_assembler"); public static final UITexture PROGRESSBAR_COMPRESS = UITexture.fullImage(MODID, "gui/progressbar/compress"); - public static final SteamTexture PROGRESSBAR_COMPRESS_STEAM = - SteamTexture.fullImage(MODID, "gui/progressbar/compress_%s"); + public static final SteamTexture PROGRESSBAR_COMPRESS_STEAM = SteamTexture + .fullImage(MODID, "gui/progressbar/compress_%s"); public static final UITexture PROGRESSBAR_CUT = UITexture.fullImage(MODID, "gui/progressbar/cut"); public static final UITexture PROGRESSBAR_EXTRACT = UITexture.fullImage(MODID, "gui/progressbar/extract"); - public static final SteamTexture PROGRESSBAR_EXTRACT_STEAM = - SteamTexture.fullImage(MODID, "gui/progressbar/extract_%s"); + public static final SteamTexture PROGRESSBAR_EXTRACT_STEAM = SteamTexture + .fullImage(MODID, "gui/progressbar/extract_%s"); public static final UITexture PROGRESSBAR_EXTRUDE = UITexture.fullImage(MODID, "gui/progressbar/extrude"); public static final SteamTexture PROGRESSBAR_FUEL_STEAM = SteamTexture.fullImage(MODID, "gui/progressbar/fuel_%s"); public static final UITexture PROGRESSBAR_HAMMER = UITexture.fullImage(MODID, "gui/progressbar/hammer"); public static final UITexture PROGRESSBAR_HAMMER_BASE = UITexture.fullImage(MODID, "gui/progressbar/hammer_base"); - public static final SteamTexture PROGRESSBAR_HAMMER_STEAM = - SteamTexture.fullImage(MODID, "gui/progressbar/hammer_%s"); - public static final SteamTexture PROGRESSBAR_HAMMER_BASE_STEAM = - SteamTexture.fullImage(MODID, "gui/progressbar/hammer_base_%s"); + public static final SteamTexture PROGRESSBAR_HAMMER_STEAM = SteamTexture + .fullImage(MODID, "gui/progressbar/hammer_%s"); + public static final SteamTexture PROGRESSBAR_HAMMER_BASE_STEAM = SteamTexture + .fullImage(MODID, "gui/progressbar/hammer_base_%s"); public static final UITexture PROGRESSBAR_LATHE = UITexture.fullImage(MODID, "gui/progressbar/lathe"); public static final UITexture PROGRESSBAR_LATHE_BASE = UITexture.fullImage(MODID, "gui/progressbar/lathe_base"); public static final UITexture PROGRESSBAR_MACERATE = UITexture.fullImage(MODID, "gui/progressbar/macerate"); - public static final SteamTexture PROGRESSBAR_MACERATE_STEAM = - SteamTexture.fullImage(MODID, "gui/progressbar/macerate_%s"); + public static final SteamTexture PROGRESSBAR_MACERATE_STEAM = SteamTexture + .fullImage(MODID, "gui/progressbar/macerate_%s"); public static final UITexture PROGRESSBAR_MAGNET = UITexture.fullImage(MODID, "gui/progressbar/magnet"); public static final UITexture PROGRESSBAR_MIXER = UITexture.fullImage(MODID, "gui/progressbar/mixer"); public static final UITexture PROGRESSBAR_RECYCLE = UITexture.fullImage(MODID, "gui/progressbar/recycle"); @@ -173,36 +173,36 @@ public class GT_UITextures { public static final UITexture TAB_COVER_HIGHLIGHT = UITexture.fullImage(MODID, "gui/tab/cover_highlight"); public static final UITexture TAB_COVER_DISABLED = UITexture.fullImage(MODID, "gui/tab/cover_disabled"); public static final SteamTexture TAB_COVER_STEAM_NORMAL = SteamTexture.fullImage(MODID, "gui/tab/cover_%s_normal"); - public static final SteamTexture TAB_COVER_STEAM_HIGHLIGHT = - SteamTexture.fullImage(MODID, "gui/tab/cover_%s_highlight"); - public static final SteamTexture TAB_COVER_STEAM_DISABLED = - SteamTexture.fullImage(MODID, "gui/tab/cover_%s_disabled"); + public static final SteamTexture TAB_COVER_STEAM_HIGHLIGHT = SteamTexture + .fullImage(MODID, "gui/tab/cover_%s_highlight"); + public static final SteamTexture TAB_COVER_STEAM_DISABLED = SteamTexture + .fullImage(MODID, "gui/tab/cover_%s_disabled"); public static final AdaptableUITexture TAB_TITLE = AdaptableUITexture.of(MODID, "gui/tab/title", 28, 28, 4); - public static final AdaptableUITexture TAB_TITLE_DARK = - AdaptableUITexture.of(MODID, "gui/tab/title_dark", 28, 28, 4); - public static final SteamTexture TAB_TITLE_STEAM = - SteamTexture.adaptableTexture(MODID, "gui/tab/title_%s", 28, 28, 4); - public static final SteamTexture TAB_TITLE_DARK_STEAM = - SteamTexture.adaptableTexture(MODID, "gui/tab/title_dark_%s", 28, 28, 4); - public static final AdaptableUITexture TAB_TITLE_ANGULAR = - AdaptableUITexture.of(MODID, "gui/tab/title_angular", 28, 28, 4); - public static final SteamTexture TAB_TITLE_ANGULAR_STEAM = - SteamTexture.adaptableTexture(MODID, "gui/tab/title_angular_%s", 28, 28, 4); + public static final AdaptableUITexture TAB_TITLE_DARK = AdaptableUITexture + .of(MODID, "gui/tab/title_dark", 28, 28, 4); + public static final SteamTexture TAB_TITLE_STEAM = SteamTexture + .adaptableTexture(MODID, "gui/tab/title_%s", 28, 28, 4); + public static final SteamTexture TAB_TITLE_DARK_STEAM = SteamTexture + .adaptableTexture(MODID, "gui/tab/title_dark_%s", 28, 28, 4); + public static final AdaptableUITexture TAB_TITLE_ANGULAR = AdaptableUITexture + .of(MODID, "gui/tab/title_angular", 28, 28, 4); + public static final SteamTexture TAB_TITLE_ANGULAR_STEAM = SteamTexture + .adaptableTexture(MODID, "gui/tab/title_angular_%s", 28, 28, 4); public static final UITexture BUTTON_STANDARD = AdaptableUITexture.of(MODID, "gui/button/standard", 18, 18, 1); - public static final UITexture BUTTON_STANDARD_TOGGLE = - AdaptableUITexture.of(MODID, "gui/button/standard_toggle", 18, 18, 1); + public static final UITexture BUTTON_STANDARD_TOGGLE = AdaptableUITexture + .of(MODID, "gui/button/standard_toggle", 18, 18, 1); public static final UITexture BUTTON_COVER_NORMAL = UITexture.fullImage(MODID, "gui/button/cover_normal"); - public static final UITexture BUTTON_COVER_NORMAL_HOVERED = - UITexture.fullImage(MODID, "gui/button/cover_normal_hovered"); - public static final UITexture BUTTON_COVER_NORMAL_DISABLED = - UITexture.fullImage(MODID, "gui/button/cover_normal_disabled"); + public static final UITexture BUTTON_COVER_NORMAL_HOVERED = UITexture + .fullImage(MODID, "gui/button/cover_normal_hovered"); + public static final UITexture BUTTON_COVER_NORMAL_DISABLED = UITexture + .fullImage(MODID, "gui/button/cover_normal_disabled"); public static final UITexture OVERLAY_BUTTON_DISABLE = UITexture.fullImage(MODID, "gui/overlay_button/disable"); - public static final UITexture OVERLAY_BUTTON_REDSTONE_OFF = - UITexture.fullImage(MODID, "gui/overlay_button/redstone_off"); - public static final UITexture OVERLAY_BUTTON_REDSTONE_ON = - UITexture.fullImage(MODID, "gui/overlay_button/redstone_on"); + public static final UITexture OVERLAY_BUTTON_REDSTONE_OFF = UITexture + .fullImage(MODID, "gui/overlay_button/redstone_off"); + public static final UITexture OVERLAY_BUTTON_REDSTONE_ON = UITexture + .fullImage(MODID, "gui/overlay_button/redstone_on"); public static final UITexture OVERLAY_BUTTON_CHECKMARK = UITexture.fullImage(MODID, "gui/overlay_button/checkmark"); public static final UITexture OVERLAY_BUTTON_CROSS = UITexture.fullImage(MODID, "gui/overlay_button/cross"); public static final UITexture OVERLAY_BUTTON_WHITELIST = UITexture.fullImage(MODID, "gui/overlay_button/whitelist"); @@ -210,77 +210,77 @@ public class GT_UITextures { public static final UITexture OVERLAY_BUTTON_PROGRESS = UITexture.fullImage(MODID, "gui/overlay_button/progress"); public static final UITexture OVERLAY_BUTTON_EXPORT = UITexture.fullImage(MODID, "gui/overlay_button/export"); public static final UITexture OVERLAY_BUTTON_IMPORT = UITexture.fullImage(MODID, "gui/overlay_button/import"); - public static final UITexture OVERLAY_BUTTON_AUTOOUTPUT_ITEM = - UITexture.fullImage(MODID, "gui/overlay_button/autooutput_item"); - public static final UITexture OVERLAY_BUTTON_AUTOOUTPUT_FLUID = - UITexture.fullImage(MODID, "gui/overlay_button/autooutput_fluid"); - public static final UITexture OVERLAY_BUTTON_ALLOW_INPUT = - UITexture.fullImage(MODID, "gui/overlay_button/allow_input"); - public static final UITexture OVERLAY_BUTTON_BLOCK_INPUT = - UITexture.fullImage(MODID, "gui/overlay_button/block_input"); - public static final UITexture OVERLAY_BUTTON_ARROW_GREEN_UP = - UITexture.fullImage(MODID, "gui/overlay_button/arrow_green_up"); - public static final UITexture OVERLAY_BUTTON_ARROW_GREEN_DOWN = - UITexture.fullImage(MODID, "gui/overlay_button/arrow_green_down"); + public static final UITexture OVERLAY_BUTTON_AUTOOUTPUT_ITEM = UITexture + .fullImage(MODID, "gui/overlay_button/autooutput_item"); + public static final UITexture OVERLAY_BUTTON_AUTOOUTPUT_FLUID = UITexture + .fullImage(MODID, "gui/overlay_button/autooutput_fluid"); + public static final UITexture OVERLAY_BUTTON_ALLOW_INPUT = UITexture + .fullImage(MODID, "gui/overlay_button/allow_input"); + public static final UITexture OVERLAY_BUTTON_BLOCK_INPUT = UITexture + .fullImage(MODID, "gui/overlay_button/block_input"); + public static final UITexture OVERLAY_BUTTON_ARROW_GREEN_UP = UITexture + .fullImage(MODID, "gui/overlay_button/arrow_green_up"); + public static final UITexture OVERLAY_BUTTON_ARROW_GREEN_DOWN = UITexture + .fullImage(MODID, "gui/overlay_button/arrow_green_down"); public static final UITexture OVERLAY_BUTTON_CYCLIC = UITexture.fullImage(MODID, "gui/overlay_button/cyclic"); - public static final UITexture OVERLAY_BUTTON_EMIT_ENERGY = - UITexture.fullImage(MODID, "gui/overlay_button/emit_energy"); - public static final UITexture OVERLAY_BUTTON_EMIT_REDSTONE = - UITexture.fullImage(MODID, "gui/overlay_button/emit_redstone"); - public static final UITexture OVERLAY_BUTTON_INVERT_REDSTONE = - UITexture.fullImage(MODID, "gui/overlay_button/invert_redstone"); - public static final UITexture OVERLAY_BUTTON_STOCKING_MODE = - UITexture.fullImage(MODID, "gui/overlay_button/stocking_mode"); - public static final UITexture OVERLAY_BUTTON_INVERT_FILTER = - UITexture.fullImage(MODID, "gui/overlay_button/invert_filter"); + public static final UITexture OVERLAY_BUTTON_EMIT_ENERGY = UITexture + .fullImage(MODID, "gui/overlay_button/emit_energy"); + public static final UITexture OVERLAY_BUTTON_EMIT_REDSTONE = UITexture + .fullImage(MODID, "gui/overlay_button/emit_redstone"); + public static final UITexture OVERLAY_BUTTON_INVERT_REDSTONE = UITexture + .fullImage(MODID, "gui/overlay_button/invert_redstone"); + public static final UITexture OVERLAY_BUTTON_STOCKING_MODE = UITexture + .fullImage(MODID, "gui/overlay_button/stocking_mode"); + public static final UITexture OVERLAY_BUTTON_INVERT_FILTER = UITexture + .fullImage(MODID, "gui/overlay_button/invert_filter"); public static final UITexture OVERLAY_BUTTON_NBT = UITexture.fullImage(MODID, "gui/overlay_button/nbt"); public static final UITexture OVERLAY_BUTTON_PRINT = UITexture.fullImage(MODID, "gui/overlay_button/print"); public static final UITexture OVERLAY_BUTTON_TRANSPOSE = UITexture.fullImage(MODID, "gui/overlay_button/transpose"); - public static final UITexture OVERLAY_BUTTON_BOUNDING_BOX = - UITexture.fullImage(MODID, "gui/overlay_button/bounding_box"); - public static final UITexture OVERLAY_BUTTON_MINUS_SMALL = - UITexture.fullImage(MODID, "gui/overlay_button/minus_small"); - public static final UITexture OVERLAY_BUTTON_MINUS_LARGE = - UITexture.fullImage(MODID, "gui/overlay_button/minus_large"); - public static final UITexture OVERLAY_BUTTON_PLUS_SMALL = - UITexture.fullImage(MODID, "gui/overlay_button/plus_small"); - public static final UITexture OVERLAY_BUTTON_PLUS_LARGE = - UITexture.fullImage(MODID, "gui/overlay_button/plus_large"); + public static final UITexture OVERLAY_BUTTON_BOUNDING_BOX = UITexture + .fullImage(MODID, "gui/overlay_button/bounding_box"); + public static final UITexture OVERLAY_BUTTON_MINUS_SMALL = UITexture + .fullImage(MODID, "gui/overlay_button/minus_small"); + public static final UITexture OVERLAY_BUTTON_MINUS_LARGE = UITexture + .fullImage(MODID, "gui/overlay_button/minus_large"); + public static final UITexture OVERLAY_BUTTON_PLUS_SMALL = UITexture + .fullImage(MODID, "gui/overlay_button/plus_small"); + public static final UITexture OVERLAY_BUTTON_PLUS_LARGE = UITexture + .fullImage(MODID, "gui/overlay_button/plus_large"); public static final UITexture OVERLAY_BUTTON_GATE_AND = UITexture.fullImage(MODID, "gui/overlay_button/gate_and"); public static final UITexture OVERLAY_BUTTON_GATE_NAND = UITexture.fullImage(MODID, "gui/overlay_button/gate_nand"); public static final UITexture OVERLAY_BUTTON_GATE_OR = UITexture.fullImage(MODID, "gui/overlay_button/gate_or"); public static final UITexture OVERLAY_BUTTON_GATE_NOR = UITexture.fullImage(MODID, "gui/overlay_button/gate_nor"); public static final UITexture OVERLAY_BUTTON_ANALOG = UITexture.fullImage(MODID, "gui/overlay_button/analog"); public static final UITexture OVERLAY_BUTTON_LOCK = UITexture.fullImage(MODID, "gui/overlay_button/lock"); - public static final UITexture OVERLAY_BUTTON_INPUT_FROM_OUTPUT_SIDE = - UITexture.fullImage(MODID, "gui/overlay_button/input_from_output_side"); - public static final UITexture OVERLAY_BUTTON_VOID_EXCESS = - UITexture.fullImage(MODID, "gui/overlay_button/void_excess"); + public static final UITexture OVERLAY_BUTTON_INPUT_FROM_OUTPUT_SIDE = UITexture + .fullImage(MODID, "gui/overlay_button/input_from_output_side"); + public static final UITexture OVERLAY_BUTTON_VOID_EXCESS = UITexture + .fullImage(MODID, "gui/overlay_button/void_excess"); public static final UITexture OVERLAY_BUTTON_VOID_ALL = UITexture.fullImage(MODID, "gui/overlay_button/void_all"); public static final UITexture OVERLAY_BUTTON_NEI = UITexture.fullImage(MODID, "gui/overlay_button/nei"); /** * Can adjust size as needed. */ - public static final AdaptableUITexture PICTURE_SCREEN_BLACK = - AdaptableUITexture.of(MODID, "gui/picture/screen_black", 16, 16, 2); + public static final AdaptableUITexture PICTURE_SCREEN_BLACK = AdaptableUITexture + .of(MODID, "gui/picture/screen_black", 16, 16, 2); - public static final UITexture PICTURE_RADIATION_WARNING = - UITexture.fullImage(MODID, "gui/picture/radiation_warning"); - public static final UITexture PICTURE_GT_LOGO_17x17_TRANSPARENT = - UITexture.fullImage(MODID, "gui/picture/gt_logo_17x17_transparent"); - public static final UITexture PICTURE_GT_LOGO_17x17_TRANSPARENT_GRAY = - UITexture.fullImage(MODID, "gui/picture/gt_logo_17x17_transparent_gray"); - public static final SteamTexture PICTURE_GT_LOGO_17x17_TRANSPARENT_STEAM = - SteamTexture.fullImage(MODID, "gui/picture/gt_logo_17x17_transparent_%s"); + public static final UITexture PICTURE_RADIATION_WARNING = UITexture + .fullImage(MODID, "gui/picture/radiation_warning"); + public static final UITexture PICTURE_GT_LOGO_17x17_TRANSPARENT = UITexture + .fullImage(MODID, "gui/picture/gt_logo_17x17_transparent"); + public static final UITexture PICTURE_GT_LOGO_17x17_TRANSPARENT_GRAY = UITexture + .fullImage(MODID, "gui/picture/gt_logo_17x17_transparent_gray"); + public static final SteamTexture PICTURE_GT_LOGO_17x17_TRANSPARENT_STEAM = SteamTexture + .fullImage(MODID, "gui/picture/gt_logo_17x17_transparent_%s"); public static final UITexture PICTURE_GT_LOGO_18x18 = UITexture.fullImage(MODID, "gui/picture/gt_logo_18x18"); public static final UITexture PICTURE_GT_LOGO_19x19 = UITexture.fullImage(MODID, "gui/picture/gt_logo_19x19"); public static final UITexture PICTURE_INFORMATION = UITexture.fullImage(MODID, "gui/picture/information"); - public static final UITexture PICTURE_STALLED_ELECTRICITY = - UITexture.fullImage(MODID, "gui/picture/stalled_electricity"); + public static final UITexture PICTURE_STALLED_ELECTRICITY = UITexture + .fullImage(MODID, "gui/picture/stalled_electricity"); public static final UITexture PICTURE_STALLED_STEAM = UITexture.fullImage(MODID, "gui/picture/stalled_steam"); - public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_22_RED = - (width, fromRight) -> UITexture.partly( + public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_22_RED = (width, fromRight) -> UITexture + .partly( MODID, "gui/picture/arrow_22_red", 87, @@ -289,8 +289,8 @@ public class GT_UITextures { 0, fromRight ? 87 : width, 22); - public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_22_BLUE = - (width, fromRight) -> UITexture.partly( + public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_22_BLUE = (width, fromRight) -> UITexture + .partly( MODID, "gui/picture/arrow_22_blue", 87, @@ -299,8 +299,8 @@ public class GT_UITextures { 0, fromRight ? 87 : width, 22); - public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_22_WHITE = - (width, fromRight) -> UITexture.partly( + public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_22_WHITE = (width, fromRight) -> UITexture + .partly( MODID, "gui/picture/arrow_22_white", 87, @@ -309,8 +309,8 @@ public class GT_UITextures { 0, fromRight ? 87 : width, 22); - public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_24_RED = - (width, fromRight) -> UITexture.partly( + public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_24_RED = (width, fromRight) -> UITexture + .partly( MODID, "gui/picture/arrow_24_red", 69, @@ -319,8 +319,8 @@ public class GT_UITextures { 0, fromRight ? 69 : width, 24); - public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_24_BLUE = - (width, fromRight) -> UITexture.partly( + public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_24_BLUE = (width, fromRight) -> UITexture + .partly( MODID, "gui/picture/arrow_24_blue", 69, @@ -329,8 +329,8 @@ public class GT_UITextures { 0, fromRight ? 69 : width, 24); - public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_24_WHITE = - (width, fromRight) -> UITexture.partly( + public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_24_WHITE = (width, fromRight) -> UITexture + .partly( MODID, "gui/picture/arrow_24_white", 69, @@ -344,8 +344,8 @@ public class GT_UITextures { public static final UITexture PICTURE_SLOTS_HOLO_3BY3 = UITexture.fullImage(MODID, "gui/picture/slots_holo_3by3"); public static final UITexture PICTURE_ARROW_DOUBLE = UITexture.fullImage(MODID, "gui/picture/arrow_double"); public static final UITexture PICTURE_SUPER_BUFFER = UITexture.fullImage(MODID, "gui/picture/super_buffer"); - public static final UITexture PICTURE_SQUARE_LIGHT_GRAY = - UITexture.fullImage(MODID, "gui/picture/square_light_gray"); + public static final UITexture PICTURE_SQUARE_LIGHT_GRAY = UITexture + .fullImage(MODID, "gui/picture/square_light_gray"); public static final UITexture PICTURE_GAUGE = UITexture.fullImage(MODID, "gui/picture/gauge"); public static final UITexture PICTURE_ITEM_IN = UITexture.fullImage(MODID, "gui/picture/item_in"); public static final UITexture PICTURE_ITEM_OUT = UITexture.fullImage(MODID, "gui/picture/item_out"); diff --git a/src/main/java/gregtech/api/gui/modularui/GUITextureSet.java b/src/main/java/gregtech/api/gui/modularui/GUITextureSet.java index 13d7eadfee..1bacff886a 100644 --- a/src/main/java/gregtech/api/gui/modularui/GUITextureSet.java +++ b/src/main/java/gregtech/api/gui/modularui/GUITextureSet.java @@ -1,17 +1,19 @@ package gregtech.api.gui.modularui; +import java.util.function.Function; + import com.gtnewhorizons.modularui.api.ModularUITextures; import com.gtnewhorizons.modularui.api.drawable.AdaptableUITexture; import com.gtnewhorizons.modularui.api.drawable.UITexture; import gregtech.api.enums.SteamVariant; -import java.util.function.Function; /** - * Set of textures that is commonly used for GUI but can vary depending on "style" of machines, - * e.g. bronze steam or steel steam. - * <br> This has builder pattern; Textures you didn't specify will fall back to default ones. + * Set of textures that is commonly used for GUI but can vary depending on "style" of machines, e.g. bronze steam or + * steel steam. <br> + * This has builder pattern; Textures you didn't specify will fall back to default ones. */ public class GUITextureSet { + private UITexture mainBackground; private UITexture itemSlot; private UITexture fluidSlot; @@ -27,11 +29,12 @@ public class GUITextureSet { private UITexture gregtechLogo; public static final GUITextureSet DEFAULT = new GUITextureSet() - .setMainBackground(GT_UITextures.BACKGROUND_SINGLEBLOCK_DEFAULT) - .setItemSlot(ModularUITextures.ITEM_SLOT) + .setMainBackground(GT_UITextures.BACKGROUND_SINGLEBLOCK_DEFAULT).setItemSlot(ModularUITextures.ITEM_SLOT) .setFluidSlot(ModularUITextures.FLUID_SLOT) .setCoverTab( - GT_UITextures.TAB_COVER_NORMAL, GT_UITextures.TAB_COVER_HIGHLIGHT, GT_UITextures.TAB_COVER_DISABLED) + GT_UITextures.TAB_COVER_NORMAL, + GT_UITextures.TAB_COVER_HIGHLIGHT, + GT_UITextures.TAB_COVER_DISABLED) .setTitleTab(GT_UITextures.TAB_TITLE, GT_UITextures.TAB_TITLE_DARK, GT_UITextures.TAB_TITLE_ANGULAR) .setGregTechLogo(GT_UITextures.PICTURE_GT_LOGO_17x17_TRANSPARENT); @@ -77,8 +80,8 @@ public class GUITextureSet { return this; } - public GUITextureSet setTitleTab( - AdaptableUITexture titleNormal, AdaptableUITexture titleDark, AdaptableUITexture titleTabAngular) { + public GUITextureSet setTitleTab(AdaptableUITexture titleNormal, AdaptableUITexture titleDark, + AdaptableUITexture titleTabAngular) { this.titleTabNormal = titleNormal; this.titleTabDark = titleDark; this.titleTabAngular = titleTabAngular; diff --git a/src/main/java/gregtech/api/gui/modularui/IDataFollowerWidget.java b/src/main/java/gregtech/api/gui/modularui/IDataFollowerWidget.java index 40ebcea0f4..87833da7b3 100644 --- a/src/main/java/gregtech/api/gui/modularui/IDataFollowerWidget.java +++ b/src/main/java/gregtech/api/gui/modularui/IDataFollowerWidget.java @@ -1,19 +1,21 @@ package gregtech.api.gui.modularui; +import java.util.function.Consumer; +import java.util.function.Function; + import com.gtnewhorizons.modularui.api.widget.Widget; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.util.ISerializableObject; import gregtech.common.gui.modularui.widget.DataControllerWidget; -import java.util.function.Consumer; -import java.util.function.Function; /** - * Widget whose state is controlled by specific data. - * Data can be anything, e.g. {@link ISerializableObject} or machine recipe mode. - * <br> No widgets implementing this interface should not sync; - * Instead, {@link DataControllerWidget} will sync data, either when this widget triggers update on client - * or data update is detected on server. + * Widget whose state is controlled by specific data. Data can be anything, e.g. {@link ISerializableObject} or machine + * recipe mode. <br> + * No widgets implementing this interface should not sync; Instead, {@link DataControllerWidget} will sync data, either + * when this widget triggers update on client or data update is detected on server. + * * @param <T> Data type stored in the parent widget * @param <U> State type stored in this widget * @see DataControllerWidget @@ -22,21 +24,20 @@ import java.util.function.Function; public interface IDataFollowerWidget<T, U> { /** - * Sets function to get widget state from provided data. This function will be called when client receives data - * from server and {@link DataControllerWidget} updates all children, including this widget. + * Sets function to get widget state from provided data. This function will be called when client receives data from + * server and {@link DataControllerWidget} updates all children, including this widget. */ Widget setDataToStateGetter(Function<T, U> dataToStateGetter); /** - * Sets setter called when this widget gets action from player. - * Basically the same functionality with widgets that have getter/setter. + * Sets setter called when this widget gets action from player. Basically the same functionality with widgets that + * have getter/setter. */ Widget setStateSetter(Consumer<U> setter); /** - * Updates state of this widget with provided data. - * On server {@link DataControllerWidget} won't propagate data update to this widget, - * so this method is client-only. + * Updates state of this widget with provided data. On server {@link DataControllerWidget} won't propagate data + * update to this widget, so this method is client-only. */ @SideOnly(Side.CLIENT) void updateState(T data); diff --git a/src/main/java/gregtech/api/gui/modularui/SteamTexture.java b/src/main/java/gregtech/api/gui/modularui/SteamTexture.java index 9e52c0f874..619b19e232 100644 --- a/src/main/java/gregtech/api/gui/modularui/SteamTexture.java +++ b/src/main/java/gregtech/api/gui/modularui/SteamTexture.java @@ -5,8 +5,7 @@ import com.gtnewhorizons.modularui.api.drawable.UITexture; import gregtech.api.enums.SteamVariant; /** - * Wrapper for {@link UITexture}s used to - * ease in choosing between Bronze, Steel and Primitive textures. + * Wrapper for {@link UITexture}s used to ease in choosing between Bronze, Steel and Primitive textures. */ public class SteamTexture { @@ -27,13 +26,21 @@ public class SteamTexture { UITexture.fullImage(mod, String.format(location, SteamVariant.PRIMITIVE))); } - public static SteamTexture adaptableTexture( - String mod, String location, int imageWidth, int imageHeight, int borderWidthPixel) { + public static SteamTexture adaptableTexture(String mod, String location, int imageWidth, int imageHeight, + int borderWidthPixel) { return new SteamTexture( AdaptableUITexture.of( - mod, String.format(location, SteamVariant.BRONZE), imageWidth, imageHeight, borderWidthPixel), + mod, + String.format(location, SteamVariant.BRONZE), + imageWidth, + imageHeight, + borderWidthPixel), AdaptableUITexture.of( - mod, String.format(location, SteamVariant.STEEL), imageWidth, imageHeight, borderWidthPixel), + mod, + String.format(location, SteamVariant.STEEL), + imageWidth, + imageHeight, + borderWidthPixel), AdaptableUITexture.of( mod, String.format(location, SteamVariant.PRIMITIVE), diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java index d5e383ed50..639b402856 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java @@ -1,34 +1,33 @@ package gregtech.api.gui.widgets; -import codechicken.nei.api.API; -import codechicken.nei.api.INEIGuiAdapter; -import gregtech.api.enums.GT_Values; -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.net.GT_Packet_GtTileEntityGuiRequest; -import gregtech.common.GT_Proxy; import java.awt.Rectangle; import java.util.List; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; + import org.lwjgl.opengl.GL11; +import codechicken.nei.api.API; +import codechicken.nei.api.INEIGuiAdapter; +import gregtech.api.enums.GT_Values; +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.net.GT_Packet_GtTileEntityGuiRequest; +import gregtech.common.GT_Proxy; + /** * Let's you access a GregTech IGregTechTileEntity's covers as tabs on the GUI's sides */ public class GT_GuiCoverTabLine extends GT_GuiTabLine { + // Names of the block a cover could be on - private static final String[] SIDES = new String[] { - "GT5U.interface.coverTabs.down", - "GT5U.interface.coverTabs.up", - "GT5U.interface.coverTabs.north", - "GT5U.interface.coverTabs.south", - "GT5U.interface.coverTabs.west", - "GT5U.interface.coverTabs.east" - }; + private static final String[] SIDES = new String[] { "GT5U.interface.coverTabs.down", "GT5U.interface.coverTabs.up", + "GT5U.interface.coverTabs.north", "GT5U.interface.coverTabs.south", "GT5U.interface.coverTabs.west", + "GT5U.interface.coverTabs.east" }; // Not sure there's a point in JIT translation but that's what this is private String[] translatedSides; @@ -38,35 +37,24 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { /** * Let's you access an IGregTechTileEntity's covers as tabs on the GUI's sides * - * @param gui GT_ITabRenderer gui which this tab line attaches to - * @param tabLineLeft left position of the tab line in relation to the gui - * @param tabLineTop top position of the tab line in relation to the gui - * @param tabHeight height of a tab - * @param tabWidth width of a tab - * @param tabSpacing pixels between each tab - * @param xDir whether to extend the line horizontally to the right (NORMAL), - * the left (INVERSE) or not at all (NONE) - * @param yDir whether to extend the line vertically down (NORMAL), up (INVERSE) - * or not at all (NONE) - * @param displayMode whether to display on the left side of the GT_ITabRenderer - * (NORMAL), on it's right side (INVERSE) or not at all (NONE) + * @param gui GT_ITabRenderer gui which this tab line attaches to + * @param tabLineLeft left position of the tab line in relation to the gui + * @param tabLineTop top position of the tab line in relation to the gui + * @param tabHeight height of a tab + * @param tabWidth width of a tab + * @param tabSpacing pixels between each tab + * @param xDir whether to extend the line horizontally to the right (NORMAL), the left (INVERSE) or not at + * all (NONE) + * @param yDir whether to extend the line vertically down (NORMAL), up (INVERSE) or not at all (NONE) + * @param displayMode whether to display on the left side of the GT_ITabRenderer (NORMAL), on it's right side + * (INVERSE) or not at all (NONE) * @param tabBackground the set of textures used to draw this tab line's tab backgrounds - * @param tile The IGregTechTileEntity the covers of which we are accessing - * @param colorization The colorization of the GUI we are adding tabs to + * @param tile The IGregTechTileEntity the covers of which we are accessing + * @param colorization The colorization of the GUI we are adding tabs to */ - public GT_GuiCoverTabLine( - GT_GUIContainerMetaTile_Machine gui, - int tabLineLeft, - int tabLineTop, - int tabHeight, - int tabWidth, - int tabSpacing, - DisplayStyle xDir, - DisplayStyle yDir, - DisplayStyle displayMode, - GT_GuiTabIconSet tabBackground, - IGregTechTileEntity tile, - int colorization) { + public GT_GuiCoverTabLine(GT_GUIContainerMetaTile_Machine gui, int tabLineLeft, int tabLineTop, int tabHeight, + int tabWidth, int tabSpacing, DisplayStyle xDir, DisplayStyle yDir, DisplayStyle displayMode, + GT_GuiTabIconSet tabBackground, IGregTechTileEntity tile, int colorization) { super(gui, 6, tabLineLeft, tabLineTop, tabHeight, tabWidth, tabSpacing, xDir, yDir, displayMode, tabBackground); this.tile = tile; this.colorization = colorization; @@ -89,27 +77,31 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { @Override protected void drawBackground(float parTicks, int mouseX, int mouseY) { // Apply this tile's coloration to draw the background - GL11.glColor3ub((byte) ((colorization >> 16) & 0xFF), (byte) ((colorization >> 8) & 0xFF), (byte) - (colorization & 0xFF)); + GL11.glColor3ub( + (byte) ((colorization >> 16) & 0xFF), + (byte) ((colorization >> 8) & 0xFF), + (byte) (colorization & 0xFF)); super.drawBackground(parTicks, mouseX, mouseY); } @Override protected void tabClicked(int tabId, int mouseButton) { if (mouseButton == 0 && mTabs[tabId].enabled) { - GT_Values.NW.sendToServer(new GT_Packet_GtTileEntityGuiRequest( - this.tile.getXCoord(), - this.tile.getYCoord(), - this.tile.getZCoord(), - tabId + GT_Proxy.GUI_ID_COVER_SIDE_BASE, - this.tile.getWorld().provider.dimensionId, - Minecraft.getMinecraft().thePlayer.getEntityId(), - 0)); + GT_Values.NW.sendToServer( + new GT_Packet_GtTileEntityGuiRequest( + this.tile.getXCoord(), + this.tile.getYCoord(), + this.tile.getZCoord(), + tabId + GT_Proxy.GUI_ID_COVER_SIDE_BASE, + this.tile.getWorld().provider.dimensionId, + Minecraft.getMinecraft().thePlayer.getEntityId(), + 0)); } } /** * Add the cover on this side of the IGregTechTileEntity to the tabs + * * @param side * @param cover */ @@ -121,6 +113,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { /** * Decorate the cover's tooltips according to the side it's on and on whether the tab is enabled or not + * * @param side * @param cover * @param enabled @@ -130,8 +123,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { final List<String> tooltip = cover.getTooltip(Minecraft.getMinecraft().thePlayer, true); tooltip.set( 0, - (enabled ? EnumChatFormatting.UNDERLINE : EnumChatFormatting.DARK_GRAY) - + getSideDescription(side) + (enabled ? EnumChatFormatting.UNDERLINE : EnumChatFormatting.DARK_GRAY) + getSideDescription(side) + (enabled ? EnumChatFormatting.RESET + ": " : ": " + EnumChatFormatting.RESET) + tooltip.get(0)); return tooltip.toArray(new String[0]); @@ -139,6 +131,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { /** * Get the translated name for a side of the IGregTechTileEntity + * * @param side * @return translated name for a side of the IGregTechTileEntity */ @@ -156,6 +149,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { * Hide any NEI slots that would intersect with a cover tab */ static class CoverTabLineNEIHandler extends INEIGuiAdapter { + @Override public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) { final Rectangle neiSlotArea = new Rectangle(x, y, w, h); diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java index 7a57c49515..bfeb84d762 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java @@ -1,16 +1,19 @@ package gregtech.api.gui.widgets; -import codechicken.lib.gui.GuiDraw; -import gregtech.api.interfaces.IGuiScreen; -import gregtech.api.util.GT_UtilityClient; import java.awt.*; import java.util.List; + import net.minecraft.client.Minecraft; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; + import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; +import codechicken.lib.gui.GuiDraw; +import gregtech.api.interfaces.IGuiScreen; +import gregtech.api.util.GT_UtilityClient; + public class GT_GuiFakeItemButton implements IGuiScreen.IGuiElement { private GT_GuiIcon bgIcon; @@ -19,6 +22,7 @@ public class GT_GuiFakeItemButton implements IGuiScreen.IGuiElement { private int xPosition, yPosition; private List<String> itemTooltips; private final GT_GuiTooltip tooltip = new GT_GuiTooltip(null) { + @Override public List<String> getToolTipText() { return itemTooltips; @@ -112,26 +116,24 @@ public class GT_GuiFakeItemButton implements IGuiScreen.IGuiElement { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL12.GL_RESCALE_NORMAL); } - gui.getItemRenderer() - .renderItemAndEffectIntoGUI( - gui.getFontRenderer(), - Minecraft.getMinecraft().getTextureManager(), - item, - xPosition, - yPosition); + gui.getItemRenderer().renderItemAndEffectIntoGUI( + gui.getFontRenderer(), + Minecraft.getMinecraft().getTextureManager(), + item, + xPosition, + yPosition); if (item.getItem() instanceof ItemBlock) GL11.glPopAttrib(); } - if (getMimicSlot()) - if (getBounds().contains(mouseX - gui.getGuiLeft(), mouseY - gui.getGuiTop())) { - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glColorMask(true, true, true, false); - GuiDraw.drawGradientRect(xPosition, yPosition, 16, 16, 0x80ffffff, 0x80ffffff); - GL11.glColorMask(true, true, true, true); - // no glEnable, state will be recovered by glPopAttrib - } + if (getMimicSlot()) if (getBounds().contains(mouseX - gui.getGuiLeft(), mouseY - gui.getGuiTop())) { + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glColorMask(true, true, true, false); + GuiDraw.drawGradientRect(xPosition, yPosition, 16, 16, 0x80ffffff, 0x80ffffff); + GL11.glColorMask(true, true, true, true); + // no glEnable, state will be recovered by glPopAttrib + } GL11.glPopAttrib(); } diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java index 43fbe0711c..01c8671678 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java @@ -1,12 +1,15 @@ package gregtech.api.gui.widgets; -import gregtech.api.interfaces.IGuiIcon; import java.util.Arrays; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.ResourceLocation; +import gregtech.api.interfaces.IGuiIcon; + public enum GT_GuiIcon implements IGuiIcon { + BUTTON_NORMAL(0, 0, 0), BUTTON_DOWN(0, 32, 0), BUTTON_HIGHLIGHT(0, 32 * 2, 0), @@ -52,15 +55,12 @@ public enum GT_GuiIcon implements IGuiIcon { TAB_HIGHLIGHT_BRICK(2, 18, 3 * 20, 18, 20), TAB_DISABLED_BRICK(2, 18 * 2, 3 * 20, 18, 20), TAB_INFO_GRAY(2, 220, 0, 18, 20), - TAB_INFO_BLUE(2, 220 + 18, 0, 18, 20), - ; + TAB_INFO_BLUE(2, 220 + 18, 0, 18, 20),; private static final int T_SIZE = 256; - private static ResourceLocation[] TEXTURES = { - new ResourceLocation("gregtech", "textures/gui/GuiButtons.png"), - new ResourceLocation("gregtech", "textures/gui/GuiCover.png"), - new ResourceLocation("gregtech", "textures/gui/GuiTabs.png"), - }; + private static ResourceLocation[] TEXTURES = { new ResourceLocation("gregtech", "textures/gui/GuiButtons.png"), + new ResourceLocation("gregtech", "textures/gui/GuiCover.png"), + new ResourceLocation("gregtech", "textures/gui/GuiTabs.png"), }; public final int x, y, width, height; public final IGuiIcon overlay; @@ -83,20 +83,13 @@ public enum GT_GuiIcon implements IGuiIcon { this(texID, x, y, width, height, null); } - public static void render( - IGuiIcon icon, double x, double y, double width, double height, double zLevel, boolean doDraw) { + public static void render(IGuiIcon icon, double x, double y, double width, double height, double zLevel, + boolean doDraw) { render(icon, x, y, width, height, zLevel, doDraw, false); } - public static void render( - IGuiIcon icon, - double x, - double y, - double width, - double height, - double zLevel, - boolean doDraw, - boolean flipHoritontally) { + public static void render(IGuiIcon icon, double x, double y, double width, double height, double zLevel, + boolean doDraw, boolean flipHoritontally) { Tessellator tess = Tessellator.instance; if (doDraw) { Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURES[icon.getTexId()]); diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java index fd9a879902..01bbccc599 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java @@ -1,12 +1,16 @@ package gregtech.api.gui.widgets; -import gregtech.api.interfaces.IGuiScreen; import java.awt.Rectangle; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; + import org.lwjgl.opengl.GL11; +import gregtech.api.interfaces.IGuiScreen; + public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElement { + public static final int DEFAULT_WIDTH = 16; public static final int DEFAULT_HEIGHT = 16; @@ -43,8 +47,7 @@ public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElemen if (this.visible) { // moused over - this.field_146123_n = mouseX >= this.xPosition - && mouseY >= this.yPosition + this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + width && mouseY < this.yPosition + height; @@ -57,7 +60,7 @@ public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElemen int x = xPosition; int y = yPosition; if (!this.field_146123_n) { - // GL11.glColor4f(200F/255F, 210F/255F, 1, 1); + // GL11.glColor4f(200F/255F, 210F/255F, 1, 1); } else GL11.glColor4f(1, 1, 1, 1); GT_GuiIcon.render(getButtonTexture(this.field_146123_n), x, y, width, height, 0, true); diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiIconCheckButton.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiIconCheckButton.java index 113b19711b..636ff0bc26 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIconCheckButton.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIconCheckButton.java @@ -3,6 +3,7 @@ package gregtech.api.gui.widgets; import gregtech.api.interfaces.IGuiScreen; public class GT_GuiIconCheckButton extends GT_GuiIconButton { + private final GT_GuiIcon checkedIcon; private final GT_GuiIcon normalIcon; private final String checkedTooltip; @@ -13,15 +14,8 @@ public class GT_GuiIconCheckButton extends GT_GuiIconButton { this(gui, id, x, y, checkedIcon, normalIcon, null, null); } - public GT_GuiIconCheckButton( - IGuiScreen gui, - int id, - int x, - int y, - GT_GuiIcon checkedIcon, - GT_GuiIcon normalIcon, - String checkedTooltip, - String normalTooltip) { + public GT_GuiIconCheckButton(IGuiScreen gui, int id, int x, int y, GT_GuiIcon checkedIcon, GT_GuiIcon normalIcon, + String checkedTooltip, String normalTooltip) { super(gui, id, x, y, normalIcon); this.checkedIcon = checkedIcon; this.normalIcon = normalIcon; diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiIntegerTextBox.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiIntegerTextBox.java index 3e2ac1e296..b2430f7b76 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIntegerTextBox.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIntegerTextBox.java @@ -1,11 +1,14 @@ package gregtech.api.gui.widgets; -import gregtech.api.interfaces.IGuiScreen; import java.awt.*; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiTextField; +import gregtech.api.interfaces.IGuiScreen; + public class GT_GuiIntegerTextBox extends GuiTextField implements IGuiScreen.IGuiElement { + private final int x0, y0; private final IGuiScreen gui; public final int id; @@ -43,8 +46,7 @@ public class GT_GuiIntegerTextBox extends GuiTextField implements IGuiScreen.IGu @Override public boolean textboxKeyTyped(char c, int key) { - if (validChar(c, key) - || c == 1 + if (validChar(c, key) || c == 1 || c == 3 || c == 22 || c == 24 diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiSlotTooltip.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiSlotTooltip.java index 105e919149..015c8c7697 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiSlotTooltip.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiSlotTooltip.java @@ -1,10 +1,13 @@ package gregtech.api.gui.widgets; -import gregtech.api.util.GT_TooltipDataCache.TooltipData; import java.awt.Rectangle; + import net.minecraft.inventory.Slot; +import gregtech.api.util.GT_TooltipDataCache.TooltipData; + public class GT_GuiSlotTooltip extends GT_GuiTooltip { + private final Slot slot; public GT_GuiSlotTooltip(Slot slot, TooltipData data) { diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiSmartTooltip.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiSmartTooltip.java index 2bb28fb929..ffae5c30e6 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiSmartTooltip.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiSmartTooltip.java @@ -1,10 +1,13 @@ package gregtech.api.gui.widgets; -import gregtech.api.util.GT_TooltipDataCache.TooltipData; import java.awt.Rectangle; +import gregtech.api.util.GT_TooltipDataCache.TooltipData; + public class GT_GuiSmartTooltip extends GT_GuiTooltip { + public interface TooltipVisibilityProvider { + boolean shouldShowTooltip(); } diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiTab.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiTab.java index 1bb2f6dbb7..661ed81fce 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiTab.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTab.java @@ -1,19 +1,23 @@ package gregtech.api.gui.widgets; -import gregtech.api.gui.widgets.GT_GuiTabLine.GT_GuiTabIconSet; -import gregtech.api.gui.widgets.GT_GuiTabLine.GT_ITabRenderer; -import gregtech.api.interfaces.IGuiIcon; import java.awt.Rectangle; + import net.minecraft.client.Minecraft; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; + import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; +import gregtech.api.gui.widgets.GT_GuiTabLine.GT_GuiTabIconSet; +import gregtech.api.gui.widgets.GT_GuiTabLine.GT_ITabRenderer; +import gregtech.api.interfaces.IGuiIcon; + /** * A tab to be attached to a tab line */ public class GT_GuiTab { + private static final int SLOT_SIZE = 18; public boolean visible = true, mousedOver, enabled = true; @@ -29,24 +33,17 @@ public class GT_GuiTab { /** * A tab to be attached to a tab line * - * @param gui IGregTechTileEntity the tab line this tab belongs to is attached to - * @param id both the ID and position in the tab line of this tab - * @param bounds bounds of this tab - * @param tabBackground set of background textures - * @param item item to draw atop the background texture, not colored - * @param overlay texture to draw atop the background texture, not colored - * @param tooltipText tooltip of this tab + * @param gui IGregTechTileEntity the tab line this tab belongs to is attached to + * @param id both the ID and position in the tab line of this tab + * @param bounds bounds of this tab + * @param tabBackground set of background textures + * @param item item to draw atop the background texture, not colored + * @param overlay texture to draw atop the background texture, not colored + * @param tooltipText tooltip of this tab * @param flipHorizontally whether to draw this tab on the right side of the IGregTechTileEntity */ - public GT_GuiTab( - GT_ITabRenderer gui, - int id, - Rectangle bounds, - GT_GuiTabIconSet tabBackground, - ItemStack item, - IGuiIcon overlay, - String[] tooltipText, - boolean flipHorizontally) { + public GT_GuiTab(GT_ITabRenderer gui, int id, Rectangle bounds, GT_GuiTabIconSet tabBackground, ItemStack item, + IGuiIcon overlay, String[] tooltipText, boolean flipHorizontally) { this.gui = gui; this.bounds = bounds; this.item = item; @@ -133,13 +130,12 @@ public class GT_GuiTab { GL11.glEnable(GL12.GL_RESCALE_NORMAL); } int margin = (bounds.height - SLOT_SIZE); - gui.getItemRenderer() - .renderItemAndEffectIntoGUI( - gui.getFontRenderer(), - Minecraft.getMinecraft().getTextureManager(), - item, - bounds.x + (this.flipHorizontally ? 0 : margin), - bounds.y + margin); + gui.getItemRenderer().renderItemAndEffectIntoGUI( + gui.getFontRenderer(), + Minecraft.getMinecraft().getTextureManager(), + item, + bounds.x + (this.flipHorizontally ? 0 : margin), + bounds.y + margin); if (item.getItem() instanceof ItemBlock) GL11.glPopAttrib(); diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiTabLine.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiTabLine.java index ff0ccc2ac1..cb94a81dfa 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiTabLine.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTabLine.java @@ -1,20 +1,25 @@ package gregtech.api.gui.widgets; -import gregtech.api.interfaces.IGuiIcon; import java.awt.Rectangle; + import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.ItemStack; + import org.lwjgl.opengl.GL11; +import gregtech.api.interfaces.IGuiIcon; + /** * Draws clickable and configurable tabs on the left or right side of another GUI */ public class GT_GuiTabLine { + /** * Defines a set of textures a tab line can use to render it's tab backgrounds */ public static class GT_GuiTabIconSet { + public IGuiIcon disabled; public IGuiIcon normal; public IGuiIcon highlight; @@ -30,6 +35,7 @@ public class GT_GuiTabLine { * Controls the rendering style of the tab line */ public static enum DisplayStyle { + NONE((byte) 0), NORMAL((byte) 1), INVERSE((byte) -1); @@ -46,10 +52,11 @@ public class GT_GuiTabLine { } /** - * A GUI should implement these methods as well as call the tab line's - * onMouseClicked, onInit and drawTabs for the tab line to attach to it properly. + * A GUI should implement these methods as well as call the tab line's onMouseClicked, onInit and drawTabs for the + * tab line to attach to it properly. */ public interface GT_ITabRenderer { + int getGuiLeft(); int getGuiTop(); @@ -82,32 +89,22 @@ public class GT_GuiTabLine { /** * Draws clickable and configurable tabs on the left or right side of a GT_ITabRenderer * - * @param gui GT_ITabRenderer gui which this tab line attaches to - * @param numTabs number of tab positions in this tab line - * @param tabLineLeft left position of the tab line in relation to the gui - * @param tabLineTop top position of the tab line in relation to the gui - * @param tabHeight height of a tab - * @param tabWidth width of a tab - * @param tabSpacing pixels between each tab - * @param xDir whether to extend the line horizontally to the right (NORMAL), - * the left (INVERSE) or not at all (NONE) - * @param yDir whether to extend the line vertically down (NORMAL), up (INVERSE) - * or not at all (NONE) - * @param displayMode whether to display on the left side of the GT_ITabRenderer - * (NORMAL), on it's right side (INVERSE) or not at all (NONE) + * @param gui GT_ITabRenderer gui which this tab line attaches to + * @param numTabs number of tab positions in this tab line + * @param tabLineLeft left position of the tab line in relation to the gui + * @param tabLineTop top position of the tab line in relation to the gui + * @param tabHeight height of a tab + * @param tabWidth width of a tab + * @param tabSpacing pixels between each tab + * @param xDir whether to extend the line horizontally to the right (NORMAL), the left (INVERSE) or not at + * all (NONE) + * @param yDir whether to extend the line vertically down (NORMAL), up (INVERSE) or not at all (NONE) + * @param displayMode whether to display on the left side of the GT_ITabRenderer (NORMAL), on it's right side + * (INVERSE) or not at all (NONE) * @param tabBackground the set of textures used to draw this tab line's tab backgrounds */ - public GT_GuiTabLine( - GT_ITabRenderer gui, - int numTabs, - int tabLineLeft, - int tabLineTop, - int tabHeight, - int tabWidth, - int tabSpacing, - DisplayStyle xDir, - DisplayStyle yDir, - DisplayStyle displayMode, + public GT_GuiTabLine(GT_ITabRenderer gui, int numTabs, int tabLineLeft, int tabLineTop, int tabHeight, int tabWidth, + int tabSpacing, DisplayStyle xDir, DisplayStyle yDir, DisplayStyle displayMode, GT_GuiTabIconSet tabBackground) { this.gui = gui; this.mTabs = new GT_GuiTab[numTabs]; @@ -124,8 +121,7 @@ public class GT_GuiTabLine { } /** - * Creates a new tab at the specified position with the given parameters. - * This class handles the positioning. + * Creates a new tab at the specified position with the given parameters. This class handles the positioning. * * @param tabId * @param item @@ -167,9 +163,8 @@ public class GT_GuiTabLine { } /** - * Draw the tabs for this tab bar - * GT_ITabRenderer must call this method on drawGuiContainerBackgroundLayer - * or on drawScreen. + * Draw the tabs for this tab bar GT_ITabRenderer must call this method on drawGuiContainerBackgroundLayer or on + * drawScreen. * * @param parTicks * @param mouseX @@ -217,8 +212,7 @@ public class GT_GuiTabLine { } /** - * Call tabClick for every tab that was clicked. - * GT_ITabRenderer must call this method on mouseClicked. + * Call tabClick for every tab that was clicked. GT_ITabRenderer must call this method on mouseClicked. * * @param mouseX * @param mouseY @@ -242,8 +236,7 @@ public class GT_GuiTabLine { protected void tabClicked(int tabId, int mouseButton) {} /** - * Reposition ourselves whenever the GT_ITabRenderer does so. - * GT_ITabRenderer must call this method on Init. + * Reposition ourselves whenever the GT_ITabRenderer does so. GT_ITabRenderer must call this method on Init. */ public void onInit() { for (int i = 0; i < mTabs.length; i++) { @@ -260,8 +253,7 @@ public class GT_GuiTabLine { * @return */ private int getTabX(int tabId) { - return this.gui.getGuiLeft() - + (flipHorizontally ? (gui.getXSize() - tabLineLeft - tabWidth) : tabLineLeft) + return this.gui.getGuiLeft() + (flipHorizontally ? (gui.getXSize() - tabLineLeft - tabWidth) : tabLineLeft) + (tabId * (tabWidth + tabSpacing) * xDir.getValue()); } diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltip.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltip.java index ab755eb2c3..1162630d5e 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltip.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltip.java @@ -1,13 +1,15 @@ package gregtech.api.gui.widgets; -import gregtech.api.util.GT_TooltipDataCache.TooltipData; import java.awt.Rectangle; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; + import org.lwjgl.input.Keyboard; +import gregtech.api.util.GT_TooltipDataCache.TooltipData; + public class GT_GuiTooltip { protected Rectangle bounds; @@ -16,8 +18,8 @@ public class GT_GuiTooltip { public boolean enabled = true; /** - * Used to create a tooltip that will appear over the specified bounds. - * This will initially be a "static" tooltip that doesn't respect verbosity levels or respond to the shift key. + * Used to create a tooltip that will appear over the specified bounds. This will initially be a "static" tooltip + * that doesn't respect verbosity levels or respond to the shift key. * * @param bounds * @param text @@ -28,8 +30,8 @@ public class GT_GuiTooltip { } /** - * Used to create a tooltip that will appear over the specified bounds. - * This will initially be a "dynamic" tooltip that respects verbosity levels and responds to the shift key. + * Used to create a tooltip that will appear over the specified bounds. This will initially be a "dynamic" tooltip + * that respects verbosity levels and responds to the shift key. * * @param bounds * @param data diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltipManager.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltipManager.java index 1c31670071..a74f5adda5 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltipManager.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltipManager.java @@ -2,10 +2,13 @@ package gregtech.api.gui.widgets; import java.util.ArrayList; import java.util.List; + import net.minecraft.client.gui.FontRenderer; public class GT_GuiTooltipManager { + public interface GT_IToolTipRenderer { + int getGuiLeft(); int getGuiTop(); @@ -46,9 +49,7 @@ public class GT_GuiTooltipManager { for (GT_GuiTooltip tip : tips) { // Give the tooltip the opportunity to decide whether they should be enabled tip.onTick(); - if (tip.enabled - && (!tip.isDelayed() || mouseStopped > DELAY) - && tip.getBounds().contains(mouseX, mouseY)) { + if (tip.enabled && (!tip.isDelayed() || mouseStopped > DELAY) && tip.getBounds().contains(mouseX, mouseY)) { tip.updateText(); drawTooltip(tip, mouseX, mouseY, render); break; |