aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/gui
diff options
context:
space:
mode:
authorGlodBlock <60341015+GlodBlock@users.noreply.github.com>2021-09-27 15:39:31 +0800
committerGitHub <noreply@github.com>2021-09-27 15:39:31 +0800
commit097438be70486735a8940dd5ce4e9484b6d951af (patch)
tree90f26b34d5059eb9858d9c82aabbd5373638acfa /src/main/java/gregtech/api/gui
parenta0a77f0b9868a4ca8a3df8ae8d50b4dcfb4030db (diff)
parent92433a5b85bb2fcca541ac25ca4033fac24f841e (diff)
downloadGT5-Unofficial-097438be70486735a8940dd5ce4e9484b6d951af.tar.gz
GT5-Unofficial-097438be70486735a8940dd5ce4e9484b6d951af.tar.bz2
GT5-Unofficial-097438be70486735a8940dd5ce4e9484b6d951af.zip
Merge pull request #1 from GlodBlock/fix-crack-recipe-check
Fix crack recipe check
Diffstat (limited to 'src/main/java/gregtech/api/gui')
-rw-r--r--src/main/java/gregtech/api/gui/GT_Container.java12
-rw-r--r--src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java2
-rw-r--r--src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java26
-rw-r--r--src/main/java/gregtech/api/gui/GT_Container_BasicTank.java211
-rw-r--r--src/main/java/gregtech/api/gui/GT_Container_MaintenanceHatch.java2
-rw-r--r--src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java9
-rw-r--r--src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java20
-rw-r--r--src/main/java/gregtech/api/gui/GT_GUICover.java15
-rw-r--r--src/main/java/gregtech/api/gui/GT_Slot_DataOrb.java2
-rw-r--r--src/main/java/gregtech/api/gui/GT_Slot_Render.java2
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java2
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiIconCheckButton.java1
12 files changed, 281 insertions, 23 deletions
diff --git a/src/main/java/gregtech/api/gui/GT_Container.java b/src/main/java/gregtech/api/gui/GT_Container.java
index 4ce583cff5..e00759bf24 100644
--- a/src/main/java/gregtech/api/gui/GT_Container.java
+++ b/src/main/java/gregtech/api/gui/GT_Container.java
@@ -26,6 +26,7 @@ public class GT_Container extends Container {
mTileEntity = aTileEntityInventory;
mPlayerInventory = aPlayerInventory;
+ mTileEntity.openInventory();
}
/**
@@ -141,7 +142,7 @@ public class GT_Container extends Container {
if (aSlot != null && aSlot.canTakeStack(aPlayer)) {
tTempStack = this.transferStackInSlot(aPlayer, aSlotIndex);
if (tTempStack != null) {
- rStack = GT_Utility.copy(tTempStack);
+ rStack = GT_Utility.copyOrNull(tTempStack);
if (aSlot.getStack() != null && aSlot.getStack().getItem() == tTempStack.getItem()) {
slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
}
@@ -156,7 +157,7 @@ public class GT_Container extends Container {
tTempStack = aSlot.getStack();
ItemStack var13 = aPlayerInventory.getItemStack();
if (tTempStack != null) {
- rStack = GT_Utility.copy(tTempStack);
+ rStack = GT_Utility.copyOrNull(tTempStack);
}
if (tTempStack == null) {
if (var13 != null && aSlot.isItemValid(var13)) {
@@ -252,7 +253,7 @@ public class GT_Container extends Container {
} 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.copy(aSlot.getStack());
+ tTempStack = GT_Utility.copyOrNull(aSlot.getStack());
tTempStack.stackSize = tTempStack.getMaxStackSize();
aPlayerInventory.setItemStack(tTempStack);
}
@@ -270,7 +271,7 @@ public class GT_Container extends Container {
//null checks and checks if the item can be stacked (maxStackSize > 1)
if (getSlotCount() > 0 && slotObject != null && slotObject.getHasStack() && !(slotObject instanceof GT_Slot_Holo)) {
ItemStack stackInSlot = slotObject.getStack();
- stack = GT_Utility.copy(stackInSlot);
+ stack = GT_Utility.copyOrNull(stackInSlot);
//TileEntity -> Player
if (aSlotIndex < getAllSlotCount()) {
@@ -468,6 +469,7 @@ public class GT_Container extends Container {
public void onContainerClosed(EntityPlayer par1EntityPlayer) {
try {
super.onContainerClosed(par1EntityPlayer);
+ mTileEntity.closeInventory();
} catch (Throwable e) {
e.printStackTrace(GT_Log.err);
}
@@ -556,4 +558,4 @@ public class GT_Container extends Container {
}
return true;
}
-} \ No newline at end of file
+}
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 33bdec53e1..5903550a91 100644
--- a/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java
+++ b/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java
@@ -209,4 +209,4 @@ public class GT_ContainerMetaTile_Machine extends GT_Container {
public String trans(String aKey, String aEnglish) {
return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_" + aKey, aEnglish, false);
}
-} \ No newline at end of file
+}
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 7e14061d2f..5d2a9321c4 100644
--- a/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java
+++ b/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java
@@ -4,11 +4,16 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
+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;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine.OTHER_SLOT_COUNT;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
@@ -179,17 +184,30 @@ public class GT_Container_BasicMachine extends GT_Container_BasicTank {
@Override
public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) {
+ GT_MetaTileEntity_BasicMachine machine = (GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity();
+ if (machine == null) return null;
+ ItemStack tResultStack;
switch (aSlotIndex) {
case 0:
- if (mTileEntity.getMetaTileEntity() == null) return null;
- ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mFluidTransfer = !((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mFluidTransfer;
+ machine.mFluidTransfer = !machine.mFluidTransfer;
return null;
case 1:
if (mTileEntity.getMetaTileEntity() == null) return null;
- ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mItemTransfer = !((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mItemTransfer;
+ machine.mItemTransfer = !machine.mItemTransfer;
return null;
default:
- return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ if (aSlotIndex == OTHER_SLOT_COUNT + 1 + machine.mInputSlotCount + machine.mOutputItems.length && aMouseclick < 2) {
+ if (mTileEntity.isClientSide()) {
+ // see parent class slotClick for an explanation on why doing this
+ GT_MetaTileEntity_BasicTank tTank = (GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity();
+ tTank.setFillableStack(GT_Utility.getFluidFromDisplayStack(tTank.getStackInSlot(2)));
+ }
+ GT_MetaTileEntity_BasicTank tTank = (GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity();
+ IFluidAccess tFillableAccess = IFluidAccess.from(tTank, true);
+ return handleFluidSlotClick(tFillableAccess, aPlayer, aMouseclick == 0, true, true);
+ } else {
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, 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 c80874eef4..12878b6a04 100644
--- a/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java
+++ b/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java
@@ -4,9 +4,15 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
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;
import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ChatComponentText;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidContainerItem;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
@@ -29,6 +35,174 @@ public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine {
}
@Override
+ public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) {
+ if (aSlotIndex == 2 && aMouseclick < 2) {
+ if (mTileEntity.isClientSide()) {
+ /*
+ * 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
+ */
+ GT_MetaTileEntity_BasicTank tTank = (GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity();
+ tTank.setDrainableStack(GT_Utility.getFluidFromDisplayStack(tTank.getStackInSlot(2)));
+ }
+ GT_MetaTileEntity_BasicTank tTank = (GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity();
+ IFluidAccess tDrainableAccess = IFluidAccess.from(tTank, false);
+ return handleFluidSlotClick(tDrainableAccess, aPlayer, aMouseclick == 0, true, !tTank.isDrainableStackSeparate());
+ }
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+
+ 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;
+ FluidStack tInputFluid = aFluidAccess.get();
+ FluidStack tFluidHeld = GT_Utility.getFluidForFilledItem(tStackSizedOne, true);
+ if (tFluidHeld != null && tFluidHeld.amount <= 0)
+ tFluidHeld = null;
+ if (tInputFluid == null) {
+ // tank empty, consider fill only from now on
+ if (!aCanFill)
+ // cannot fill and nothing to take, bail out
+ return null;
+ if (tFluidHeld == null)
+ // no fluid to fill
+ return null;
+ return fillFluid(aFluidAccess, aPlayer, tFluidHeld, aProcessFullStack);
+ }
+ // tank not empty, both action possible
+ if (tFluidHeld != null && tInputFluid.amount < aFluidAccess.getCapacity()) {
+ // both nonnull and have space left for filling.
+ if (aCanFill)
+ // actually both pickup and fill is reasonable, but I'll go with fill here
+ return fillFluid(aFluidAccess, aPlayer, tFluidHeld, aProcessFullStack);
+ if (!aCanDrain)
+ // cannot take AND cannot fill, why make this call then?
+ return null;
+ // the slot does not allow filling, so try take some
+ return drainFluid(aFluidAccess, aPlayer, aProcessFullStack);
+ } else {
+ // cannot fill and there is something to take
+ if (!aCanDrain)
+ // but the slot does not allow taking, so bail out
+ return null;
+ return drainFluid(aFluidAccess, aPlayer, aProcessFullStack);
+ }
+ }
+
+ protected static ItemStack drainFluid(IFluidAccess aFluidAccess, EntityPlayer aPlayer, boolean aProcessFullStack) {
+ FluidStack tTankStack = aFluidAccess.get();
+ if (tTankStack == null) return null;
+ ItemStack tStackHeld = aPlayer.inventory.getItemStack();
+ ItemStack tStackSizedOne = GT_Utility.copyAmount(1, tStackHeld);
+ if (tStackSizedOne == null || tStackHeld.stackSize == 0) return null;
+ int tOriginalFluidAmount = tTankStack.amount;
+ ItemStack tFilledContainer = GT_Utility.fillFluidContainer(tTankStack, tStackSizedOne, true, false);
+ if (tFilledContainer == null && tStackSizedOne.getItem() instanceof IFluidContainerItem) {
+ IFluidContainerItem tContainerItem = (IFluidContainerItem) tStackSizedOne.getItem();
+ int tFilledAmount = tContainerItem.fill(tStackSizedOne, tTankStack, true);
+ if (tFilledAmount > 0) {
+ tFilledContainer = tStackSizedOne;
+ tTankStack.amount -= tFilledAmount;
+ }
+ }
+ if (tFilledContainer != null) {
+ 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
+ */
+ int tAdditionalParallel = Math.min(tStackHeld.stackSize - 1, tTankStack.amount / tFilledAmount);
+ tTankStack.amount -= tFilledAmount * tAdditionalParallel;
+ tFilledContainer.stackSize += tAdditionalParallel;
+ }
+ replaceCursorItemStack(aPlayer, tFilledContainer);
+ }
+ if (tTankStack.amount <= 0)
+ aFluidAccess.set(null);
+ return tFilledContainer;
+ }
+
+ 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();
+ ItemStack tStackSizedOne = GT_Utility.copyAmount(1, tStackHeld);
+ if (tStackSizedOne == null)
+ return null;
+
+ int tFreeSpace = aFluidAccess.getCapacity() - (aFluidAccess.get() != null ? aFluidAccess.get().amount : 0);
+ if (tFreeSpace <= 0)
+ // no space left
+ return null;
+
+ // find out how much fluid can be taken
+ // some cells cannot be partially filled
+ ItemStack tStackEmptied = null;
+ int tAmountTaken = 0;
+ if (tFreeSpace >= aFluidHeld.amount) {
+ // fully accepted - try take it from item now
+ // IFluidContainerItem is intentionally not checked here. it will be checked later
+ tStackEmptied = GT_Utility.getContainerForFilledItem(tStackSizedOne, false);
+ tAmountTaken = aFluidHeld.amount;
+ }
+ if (tStackEmptied == null && tStackSizedOne.getItem() instanceof IFluidContainerItem) {
+ // either partially accepted, or is IFluidContainerItem
+ IFluidContainerItem container = (IFluidContainerItem) tStackSizedOne.getItem();
+ FluidStack tDrained = container.drain(tStackSizedOne, tFreeSpace, true);
+ if (tDrained != null && tDrained.amount > 0) {
+ // something is actually drained - change the cell and drop it to player
+ tStackEmptied = tStackSizedOne;
+ tAmountTaken = tDrained.amount;
+ }
+ }
+ if (tStackEmptied == null)
+ // somehow the cell refuse to give out that amount of fluid, no op then
+ return null;
+
+ // find out how many fill can we do
+ // same round down behavior as above
+ // however here the fluid stack is not changed at all, so the exact code will slightly differ
+ int tParallel = aProcessFullStack ? Math.min(tFreeSpace / tAmountTaken, tStackHeld.stackSize) : 1;
+ if (aFluidAccess.get() == null) {
+ FluidStack tNewFillableStack = aFluidHeld.copy();
+ tNewFillableStack.amount = tAmountTaken * tParallel;
+ aFluidAccess.set(tNewFillableStack);
+ } else {
+ aFluidAccess.get().amount += tAmountTaken * tParallel;
+ }
+ tStackEmptied.stackSize = tParallel;
+ replaceCursorItemStack(aPlayer, tStackEmptied);
+ return tStackEmptied;
+ }
+
+ private static void replaceCursorItemStack(EntityPlayer aPlayer, ItemStack tStackResult) {
+ int tStackResultMaxStackSize = tStackResult.getMaxStackSize();
+ while (tStackResult.stackSize > tStackResultMaxStackSize) {
+ aPlayer.inventory.getItemStack().stackSize -= tStackResultMaxStackSize;
+ GT_Utility.addItemToPlayerInventory(aPlayer, tStackResult.splitStack(tStackResultMaxStackSize));
+ }
+ if (aPlayer.inventory.getItemStack().stackSize == tStackResult.stackSize) {
+ // every cell is mutated. it could just stay on the cursor.
+ aPlayer.inventory.setItemStack(tStackResult);
+ } else {
+ // some cells not mutated. The mutated cells must go into the inventory
+ // or drop into the world if there isn't enough space.
+ ItemStack tStackHeld = aPlayer.inventory.getItemStack();
+ tStackHeld.stackSize -= tStackResult.stackSize;
+ GT_Utility.addItemToPlayerInventory(aPlayer, tStackResult);
+ }
+ }
+
+ @Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return;
@@ -66,4 +240,41 @@ public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine {
public int getShiftClickSlotCount() {
return 1;
}
+
+ protected interface IFluidAccess {
+ void set(FluidStack stack);
+ FluidStack get();
+ int getCapacity();
+ static IFluidAccess from(GT_MetaTileEntity_BasicTank aTank, boolean aIsFillableStack) {
+ return new BasicTankFluidAccess(aTank, aIsFillableStack);
+ }
+ }
+
+ static class BasicTankFluidAccess implements IFluidAccess {
+ private final GT_MetaTileEntity_BasicTank mTank;
+ private final boolean mIsFillableStack;
+
+ public BasicTankFluidAccess(GT_MetaTileEntity_BasicTank aTank, boolean aIsFillableStack) {
+ this.mTank = aTank;
+ this.mIsFillableStack = aIsFillableStack;
+ }
+
+ @Override
+ public void set(FluidStack stack) {
+ if (mIsFillableStack)
+ mTank.setFillableStack(stack);
+ else
+ mTank.setDrainableStack(stack);
+ }
+
+ @Override
+ public FluidStack get() {
+ return mIsFillableStack ? mTank.getFillableStack() : mTank.getDrainableStack();
+ }
+
+ @Override
+ public int getCapacity() {
+ return mTank.getCapacity();
+ }
+ }
}
diff --git a/src/main/java/gregtech/api/gui/GT_Container_MaintenanceHatch.java b/src/main/java/gregtech/api/gui/GT_Container_MaintenanceHatch.java
index c8a70e71f2..c3758486ba 100644
--- a/src/main/java/gregtech/api/gui/GT_Container_MaintenanceHatch.java
+++ b/src/main/java/gregtech/api/gui/GT_Container_MaintenanceHatch.java
@@ -29,4 +29,4 @@ public class GT_Container_MaintenanceHatch extends GT_ContainerMetaTile_Machine
}
return null;
}
-} \ No newline at end of file
+}
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 532ce85146..7fd4f9f0b2 100644
--- a/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java
+++ b/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java
@@ -27,7 +27,9 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer {
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
- if (GregTech_API.sColoredGUI && mContainer != null && mContainer.mTileEntity != null) {
+ if (GregTech_API.sMachineMetalGUI) {
+ GL11.glColor3ub((byte) Dyes.MACHINE_METAL.mRGBa[0], (byte) Dyes.MACHINE_METAL.mRGBa[1], (byte) Dyes.MACHINE_METAL.mRGBa[2]);
+ } else if (GregTech_API.sColoredGUI && mContainer != null && mContainer.mTileEntity != null) {
byte colorByte = mContainer.mTileEntity.getColorization();
Dyes color;
if (colorByte != -1)
@@ -35,7 +37,8 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer {
else
color = Dyes.MACHINE_METAL;
GL11.glColor3ub((byte) color.mRGBa[0], (byte) color.mRGBa[1], (byte) color.mRGBa[2]);
- } else
+ } else {
GL11.glColor3ub((byte) 255, (byte) 255, (byte) 255);
+ }
}
-} \ No newline at end of file
+}
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 3bb802fcf7..bd28bb11e9 100644
--- a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java
+++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java
@@ -1,6 +1,7 @@
package gregtech.api.gui;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_Bronze;
import net.minecraft.entity.player.InventoryPlayer;
import java.util.ArrayList;
@@ -23,6 +24,8 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin
public final byte
mProgressBarDirection,
mProgressBarAmount;
+ public final boolean
+ mRenderAutoOutputSlots;
public GT_GUIContainer_BasicMachine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile, String aNEI) {
this(aInventoryPlayer, aTileEntity, aName, aTextureFile, aNEI, (byte) 0, (byte) 1);
@@ -34,12 +37,15 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin
mProgressBarAmount = (byte) Math.max(1, aProgressBarAmount);
mName = aName;
mNEI = aNEI;
+ mRenderAutoOutputSlots = !(aTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_BasicMachine_Bronze);
}
@Override
public void drawScreen(int par1, int par2, float par3) {
super.drawScreen(par1, par2, par3);
- drawTooltip(par1, par2);
+ if (mRenderAutoOutputSlots){
+ drawTooltip(par1, par2);
+ }
}
@Override
@@ -72,10 +78,12 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin
int y = (height - ySize) / 2;
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
if (mContainer != null) {
- if (((GT_Container_BasicMachine) mContainer).mFluidTransfer)
- drawTexturedModalRect(x + 7, y + 62, 176, 18, 18, 18);
- if (((GT_Container_BasicMachine) mContainer).mItemTransfer)
- drawTexturedModalRect(x + 25, y + 62, 176, 36, 18, 18);
+ if (mRenderAutoOutputSlots){
+ if (((GT_Container_BasicMachine) mContainer).mFluidTransfer)
+ drawTexturedModalRect(x + 7, y + 62, 176, 18, 18, 18);
+ if (((GT_Container_BasicMachine) mContainer).mItemTransfer)
+ drawTexturedModalRect(x + 25, y + 62, 176, 36, 18, 18);
+ }
if (((GT_Container_BasicMachine) mContainer).mStuttering)
drawTexturedModalRect(x + 79, y + 44, 176, 54, 18, 18);
@@ -115,4 +123,4 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin
}
}
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/gregtech/api/gui/GT_GUICover.java b/src/main/java/gregtech/api/gui/GT_GUICover.java
index f1232c9432..2e9d082ebf 100644
--- a/src/main/java/gregtech/api/gui/GT_GUICover.java
+++ b/src/main/java/gregtech/api/gui/GT_GUICover.java
@@ -154,6 +154,7 @@ public abstract class GT_GUICover extends GuiScreen implements GT_IToolTipRender
}
}
+ @Override
public void mouseClicked(int x, int y, int button) {
for (GT_GuiIntegerTextBox tBox : textBoxes) {
boolean hadFocus = tBox.isFocused();
@@ -195,7 +196,7 @@ public abstract class GT_GUICover extends GuiScreen implements GT_IToolTipRender
return;
}
}
- if (textBoxes.size() > 0 )
+ if (!textBoxes.isEmpty())
setFocusedTextBox(textBoxes.get(0));
return;
}
@@ -226,15 +227,19 @@ public abstract class GT_GUICover extends GuiScreen implements GT_IToolTipRender
* Button
*/
+ @Override
public void actionPerformed(GuiButton button) {
selectedButton = button;
}
+ @Override
public void clearSelectedButton() {
selectedButton = null;
}
+ @Override
public GuiButton getSelectedButton(){return selectedButton;}
+ @Override
public void buttonClicked(GuiButton button) {
}
@@ -247,10 +252,17 @@ public abstract class GT_GUICover extends GuiScreen implements GT_IToolTipRender
textBox.setFocused(textBox.equals(boxToFocus) && textBox.isEnabled());
}
}
+
+ /**
+ * Given textbox's value might have changed.
+ */
public void applyTextBox(GT_GuiIntegerTextBox box) {
}
+ /**
+ * Reset the given textbox to the last valid value, <b>NOT</b> 0.
+ */
public void resetTextBox(GT_GuiIntegerTextBox box) {
}
@@ -295,6 +307,7 @@ public abstract class GT_GUICover extends GuiScreen implements GT_IToolTipRender
return gui_height;
}
+ @Override
public RenderItem getItemRenderer() {
return itemRender;
}
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 28b4d2828c..ae30f3a5bb 100644
--- a/src/main/java/gregtech/api/gui/GT_Slot_DataOrb.java
+++ b/src/main/java/gregtech/api/gui/GT_Slot_DataOrb.java
@@ -14,4 +14,4 @@ public class GT_Slot_DataOrb extends Slot {
public boolean isItemValid(ItemStack aStack) {
return ItemList.Tool_DataOrb.isStackEqual(aStack, false, true);
}
-} \ No newline at end of file
+}
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 92927e284e..270c758536 100644
--- a/src/main/java/gregtech/api/gui/GT_Slot_Render.java
+++ b/src/main/java/gregtech/api/gui/GT_Slot_Render.java
@@ -19,4 +19,4 @@ public class GT_Slot_Render extends GT_Slot_Holo {
}
onSlotChanged();
}
-} \ No newline at end of file
+}
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 e081c4227d..91f611b9b6 100644
--- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java
+++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java
@@ -27,6 +27,7 @@ public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElemen
gui.addElement(this);
}
+ @Override
public void onInit() {
if (tooltip != null)
gui.addToolTip(tooltip);
@@ -39,6 +40,7 @@ public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElemen
drawButton(Minecraft.getMinecraft(), mouseX, mouseY);
}
+ @Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
if (this.tooltip != null)
this.tooltip.enabled = 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 4e6fd86f55..010ac78654 100644
--- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIconCheckButton.java
+++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIconCheckButton.java
@@ -12,6 +12,7 @@ public class GT_GuiIconCheckButton extends GT_GuiIconButton {
this.normalIcon = normalIcon;
}
+ @Override
public GT_GuiIcon getButtonTexture(boolean mouseOver) {
if (!enabled)
return GT_GuiIcon.BUTTON_DISABLED;