aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api/gui')
-rw-r--r--src/main/java/gregtech/api/gui/GT_Container.java559
-rw-r--r--src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java185
-rw-r--r--src/main/java/gregtech/api/gui/GT_Container_1by1.java27
-rw-r--r--src/main/java/gregtech/api/gui/GT_Container_2by2.java30
-rw-r--r--src/main/java/gregtech/api/gui/GT_Container_3by3.java35
-rw-r--r--src/main/java/gregtech/api/gui/GT_Container_4by4.java42
-rw-r--r--src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java254
-rw-r--r--src/main/java/gregtech/api/gui/GT_Container_BasicTank.java72
-rw-r--r--src/main/java/gregtech/api/gui/GT_Container_MaintenanceHatch.java30
-rw-r--r--src/main/java/gregtech/api/gui/GT_Container_MultiMachine.java35
-rw-r--r--src/main/java/gregtech/api/gui/GT_GUIContainer.java72
-rw-r--r--src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java38
-rw-r--r--src/main/java/gregtech/api/gui/GT_GUIContainer_1by1.java29
-rw-r--r--src/main/java/gregtech/api/gui/GT_GUIContainer_2by2.java29
-rw-r--r--src/main/java/gregtech/api/gui/GT_GUIContainer_3by3.java29
-rw-r--r--src/main/java/gregtech/api/gui/GT_GUIContainer_4by4.java29
-rw-r--r--src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java109
-rw-r--r--src/main/java/gregtech/api/gui/GT_GUIContainer_BasicTank.java36
-rw-r--r--src/main/java/gregtech/api/gui/GT_GUIContainer_MaintenanceHatch.java27
-rw-r--r--src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java63
-rw-r--r--src/main/java/gregtech/api/gui/GT_Slot_Armor.java27
-rw-r--r--src/main/java/gregtech/api/gui/GT_Slot_DataOrb.java17
-rw-r--r--src/main/java/gregtech/api/gui/GT_Slot_Holo.java46
-rw-r--r--src/main/java/gregtech/api/gui/GT_Slot_Output.java16
-rw-r--r--src/main/java/gregtech/api/gui/GT_Slot_Render.java22
25 files changed, 1858 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/gui/GT_Container.java b/src/main/java/gregtech/api/gui/GT_Container.java
new file mode 100644
index 0000000000..614d459cb9
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_Container.java
@@ -0,0 +1,559 @@
+package gregtech.api.gui;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_Log;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+import java.util.List;
+
+/**
+ * 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;
+
+ public GT_Container(InventoryPlayer aPlayerInventory, IGregTechTileEntity aTileEntityInventory) {
+
+ mTileEntity = aTileEntityInventory;
+ mPlayerInventory = aPlayerInventory;
+ }
+
+ /**
+ * To add the Slots to your GUI
+ */
+ public void addSlots(InventoryPlayer aPlayerInventory) {
+ //
+ }
+
+ /**
+ * Amount of regular Slots in the GUI (so, non-HoloSlots)
+ */
+ public int getSlotCount() {
+ return 0;
+ }
+
+ /**
+ * Amount of ALL Slots in the GUI including HoloSlots and ArmorSlots, but excluding regular Player Slots
+ */
+ protected final int getAllSlotCount() {
+ if (inventorySlots != null) {
+ if (doesBindPlayerInventory()) return inventorySlots.size() - 36;
+ return inventorySlots.size();
+ }
+ return getSlotCount();
+ }
+
+ /**
+ * Start-Index of the usable Slots (the first non-HoloSlot)
+ */
+ public int getSlotStartIndex() {
+ return 0;
+ }
+
+ public int getShiftClickStartIndex() {
+ return getSlotStartIndex();
+ }
+
+ /**
+ * Amount of Slots in the GUI the player can Shift-Click into. Uses also getSlotStartIndex
+ */
+ public int getShiftClickSlotCount() {
+ return 0;
+ }
+
+ /**
+ * Is Player-Inventory visible?
+ */
+ public boolean doesBindPlayerInventory() {
+ return true;
+ }
+
+ /**
+ * Override this Function with something like "return mTileEntity.isUseableByPlayer(aPlayer);"
+ */
+ @Override
+ public boolean canInteractWith(EntityPlayer aPlayer) {
+ return false;
+ }
+
+ protected void bindPlayerInventory(InventoryPlayer aInventoryPlayer) {
+ for (int i = 0; i < 3; i++) {
+ for (int j = 0; j < 9; j++) {
+ addSlotToContainer(new Slot(aInventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
+ }
+ }
+
+ for (int i = 0; i < 9; i++) {
+ addSlotToContainer(new Slot(aInventoryPlayer, i, 8 + i * 18, 142));
+ }
+ }
+
+ @Override
+ public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) {
+ mTileEntity.markDirty();
+
+ 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;
+ }
+
+ try {
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+
+ ItemStack rStack = null;
+ InventoryPlayer aPlayerInventory = aPlayer.inventory;
+ Slot aSlot;
+ ItemStack tTempStack;
+ int tTempStackSize;
+ ItemStack aHoldStack;
+
+ if ((aShifthold == 0 || aShifthold == 1) && (aMouseclick == 0 || aMouseclick == 1)) {
+ if (aSlotIndex == -999) {
+ if (aPlayerInventory.getItemStack() != null && aSlotIndex == -999) {
+ if (aMouseclick == 0) {
+ aPlayer.dropPlayerItemWithRandomChoice(aPlayerInventory.getItemStack(), true);
+ aPlayerInventory.setItemStack(null);
+ }
+ if (aMouseclick == 1) {
+ aPlayer.dropPlayerItemWithRandomChoice(aPlayerInventory.getItemStack().splitStack(1), true);
+ if (aPlayerInventory.getItemStack().stackSize == 0) {
+ aPlayerInventory.setItemStack(null);
+ }
+ }
+ }
+ } else if (aShifthold == 1) {
+ aSlot = (Slot) this.inventorySlots.get(aSlotIndex);
+ if (aSlot != null && aSlot.canTakeStack(aPlayer)) {
+ tTempStack = this.transferStackInSlot(aPlayer, aSlotIndex);
+ if (tTempStack != null) {
+ rStack = GT_Utility.copy(tTempStack);
+ if (aSlot.getStack() != null && aSlot.getStack().getItem() == tTempStack.getItem()) {
+ slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+ }
+ }
+ } else {
+ if (aSlotIndex < 0) {
+ return null;
+ }
+ aSlot = (Slot) this.inventorySlots.get(aSlotIndex);
+ if (aSlot != null) {
+ tTempStack = aSlot.getStack();
+ ItemStack var13 = aPlayerInventory.getItemStack();
+ if (tTempStack != null) {
+ rStack = GT_Utility.copy(tTempStack);
+ }
+ if (tTempStack == null) {
+ if (var13 != null && aSlot.isItemValid(var13)) {
+ tTempStackSize = aMouseclick == 0 ? var13.stackSize : 1;
+ if (tTempStackSize > aSlot.getSlotStackLimit()) {
+ tTempStackSize = aSlot.getSlotStackLimit();
+ }
+ aSlot.putStack(var13.splitStack(tTempStackSize));
+
+ if (var13.stackSize == 0) {
+ aPlayerInventory.setItemStack((ItemStack) null);
+ }
+ }
+ } else if (aSlot.canTakeStack(aPlayer)) {
+ if (var13 == null) {
+ tTempStackSize = aMouseclick == 0 ? tTempStack.stackSize : (tTempStack.stackSize + 1) / 2;
+ aHoldStack = aSlot.decrStackSize(tTempStackSize);
+ aPlayerInventory.setItemStack(aHoldStack);
+ if (tTempStack.stackSize == 0) {
+ aSlot.putStack((ItemStack) null);
+ }
+ aSlot.onPickupFromSlot(aPlayer, aPlayerInventory.getItemStack());
+ } else if (aSlot.isItemValid(var13)) {
+ if (tTempStack.getItem() == var13.getItem() && tTempStack.getItemDamage() == var13.getItemDamage() && ItemStack.areItemStackTagsEqual(tTempStack, var13)) {
+ tTempStackSize = aMouseclick == 0 ? var13.stackSize : 1;
+ if (tTempStackSize > aSlot.getSlotStackLimit() - tTempStack.stackSize) {
+ tTempStackSize = aSlot.getSlotStackLimit() - tTempStack.stackSize;
+ }
+ if (tTempStackSize > var13.getMaxStackSize() - tTempStack.stackSize) {
+ tTempStackSize = var13.getMaxStackSize() - tTempStack.stackSize;
+ }
+ var13.splitStack(tTempStackSize);
+ if (var13.stackSize == 0) {
+ aPlayerInventory.setItemStack((ItemStack) null);
+ }
+ tTempStack.stackSize += tTempStackSize;
+ } else if (var13.stackSize <= aSlot.getSlotStackLimit()) {
+ aSlot.putStack(var13);
+ aPlayerInventory.setItemStack(tTempStack);
+ }
+ } else if (tTempStack.getItem() == var13.getItem() && var13.getMaxStackSize() > 1 && (!tTempStack.getHasSubtypes() || tTempStack.getItemDamage() == var13.getItemDamage()) && ItemStack.areItemStackTagsEqual(tTempStack, var13)) {
+ tTempStackSize = tTempStack.stackSize;
+
+ if (tTempStackSize > 0 && tTempStackSize + var13.stackSize <= var13.getMaxStackSize()) {
+ var13.stackSize += tTempStackSize;
+ tTempStack = aSlot.decrStackSize(tTempStackSize);
+
+ if (tTempStack.stackSize == 0) {
+ aSlot.putStack((ItemStack) null);
+ }
+
+ aSlot.onPickupFromSlot(aPlayer, aPlayerInventory.getItemStack());
+ }
+ }
+ }
+ aSlot.onSlotChanged();
+ }
+ }
+ } else if (aShifthold == 2 && aMouseclick >= 0 && aMouseclick < 9) {
+ aSlot = (Slot) this.inventorySlots.get(aSlotIndex);
+
+ if (aSlot.canTakeStack(aPlayer)) {
+ tTempStack = aPlayerInventory.getStackInSlot(aMouseclick);
+ boolean var9 = tTempStack == null || aSlot.inventory == aPlayerInventory && aSlot.isItemValid(tTempStack);
+ tTempStackSize = -1;
+
+ if (!var9) {
+ tTempStackSize = aPlayerInventory.getFirstEmptyStack();
+ var9 |= tTempStackSize > -1;
+ }
+
+ if (aSlot.getHasStack() && var9) {
+ aHoldStack = aSlot.getStack();
+ aPlayerInventory.setInventorySlotContents(aMouseclick, aHoldStack);
+
+ if ((aSlot.inventory != aPlayerInventory || !aSlot.isItemValid(tTempStack)) && tTempStack != null) {
+ if (tTempStackSize > -1) {
+ aPlayerInventory.addItemStackToInventory(tTempStack);
+ aSlot.decrStackSize(aHoldStack.stackSize);
+ aSlot.putStack((ItemStack) null);
+ aSlot.onPickupFromSlot(aPlayer, aHoldStack);
+ }
+ } else {
+ aSlot.decrStackSize(aHoldStack.stackSize);
+ aSlot.putStack(tTempStack);
+ aSlot.onPickupFromSlot(aPlayer, aHoldStack);
+ }
+ } else if (!aSlot.getHasStack() && tTempStack != null && aSlot.isItemValid(tTempStack)) {
+ aPlayerInventory.setInventorySlotContents(aMouseclick, (ItemStack) null);
+ aSlot.putStack(tTempStack);
+ }
+ }
+ } 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.stackSize = tTempStack.getMaxStackSize();
+ aPlayerInventory.setItemStack(tTempStack);
+ }
+ }
+ return rStack;
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer aPlayer, int aSlotIndex) {
+ ItemStack stack = null;
+ Slot slotObject = (Slot) inventorySlots.get(aSlotIndex);
+
+ mTileEntity.markDirty();
+
+ //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);
+
+ //TileEntity -> Player
+ if (aSlotIndex < getAllSlotCount()) {
+ if (doesBindPlayerInventory())
+ if (!mergeItemStack(stackInSlot, getAllSlotCount(), getAllSlotCount() + 36, true)) {
+ return null;
+ }
+ //Player -> TileEntity
+ } else if (!mergeItemStack(stackInSlot, getShiftClickStartIndex(), getShiftClickStartIndex() + getShiftClickSlotCount(), false)) {
+ return null;
+ }
+
+ if (stackInSlot.stackSize == 0) {
+ slotObject.putStack(null);
+ } else {
+ slotObject.onSlotChanged();
+ }
+ }
+ return stack;
+ }
+
+ /**
+ * merges provided ItemStack with the first avaliable one in the container/player inventory
+ */
+ @Override
+ protected boolean mergeItemStack(ItemStack aStack, int aStartIndex, int aSlotCount, boolean par4) {
+ boolean var5 = false;
+ int var6 = aStartIndex;
+
+ mTileEntity.markDirty();
+
+ if (par4) {
+ var6 = aSlotCount - 1;
+ }
+
+ Slot var7;
+ ItemStack var8;
+
+ if (aStack.isStackable()) {
+ while (aStack.stackSize > 0 && (!par4 && var6 < aSlotCount || par4 && var6 >= aStartIndex)) {
+ var7 = (Slot) this.inventorySlots.get(var6);
+ var8 = var7.getStack();
+
+ if (!(var7 instanceof GT_Slot_Holo) && !(var7 instanceof GT_Slot_Output) && var8 != null && var8.getItem() == aStack.getItem() && (!aStack.getHasSubtypes() || aStack.getItemDamage() == var8.getItemDamage()) && ItemStack.areItemStackTagsEqual(aStack, var8)) {
+ int var9 = var8.stackSize + aStack.stackSize;
+
+ if (var9 <= aStack.getMaxStackSize()) {
+ aStack.stackSize = 0;
+ var8.stackSize = var9;
+ var7.onSlotChanged();
+ var5 = true;
+ } else if (var8.stackSize < aStack.getMaxStackSize()) {
+ aStack.stackSize -= aStack.getMaxStackSize() - var8.stackSize;
+ var8.stackSize = aStack.getMaxStackSize();
+ var7.onSlotChanged();
+ var5 = true;
+ }
+ }
+
+ if (par4) {
+ --var6;
+ } else {
+ ++var6;
+ }
+ }
+ }
+
+ if (aStack.stackSize > 0) {
+ if (par4) {
+ var6 = aSlotCount - 1;
+ } else {
+ var6 = aStartIndex;
+ }
+
+ while (!par4 && var6 < aSlotCount || par4 && var6 >= aStartIndex) {
+ var7 = (Slot) this.inventorySlots.get(var6);
+ var8 = var7.getStack();
+
+ if (var8 == null) {
+ var7.putStack(GT_Utility.copy(aStack));
+ var7.onSlotChanged();
+ aStack.stackSize = 0;
+ var5 = true;
+ break;
+ }
+
+ if (par4) {
+ --var6;
+ } else {
+ ++var6;
+ }
+ }
+ }
+
+ return var5;
+ }
+
+ @Override
+ protected Slot addSlotToContainer(Slot par1Slot) {
+ try {
+ return super.addSlotToContainer(par1Slot);
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ return par1Slot;
+ }
+
+ @Override
+ public void addCraftingToCrafters(ICrafting par1ICrafting) {
+ try {
+ super.addCraftingToCrafters(par1ICrafting);
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ }
+
+ @Override
+ public List getInventory() {
+ try {
+ return super.getInventory();
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ return null;
+ }
+
+ @Override
+ public void removeCraftingFromCrafters(ICrafting par1ICrafting) {
+ try {
+ super.removeCraftingFromCrafters(par1ICrafting);
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ try {
+ super.detectAndSendChanges();
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ }
+
+ @Override
+ public boolean enchantItem(EntityPlayer par1EntityPlayer, int par2) {
+ try {
+ return super.enchantItem(par1EntityPlayer, par2);
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ return false;
+ }
+
+ @Override
+ public Slot getSlotFromInventory(IInventory par1IInventory, int par2) {
+ try {
+ return super.getSlotFromInventory(par1IInventory, par2);
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ return null;
+ }
+
+ @Override
+ public Slot getSlot(int par1) {
+ try {
+ if (this.inventorySlots.size() > par1) return super.getSlot(par1);
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ return null;
+ }
+
+ @Override
+ public boolean func_94530_a(ItemStack par1ItemStack, Slot par2Slot) {
+ try {
+ return super.func_94530_a(par1ItemStack, par2Slot);
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ return true;
+ }
+
+ @Override
+ protected void retrySlotClick(int par1, int par2, boolean par3, EntityPlayer par4EntityPlayer) {
+ try {
+ super.retrySlotClick(par1, par2, par3, par4EntityPlayer);
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ }
+
+ @Override
+ public void onContainerClosed(EntityPlayer par1EntityPlayer) {
+ try {
+ super.onContainerClosed(par1EntityPlayer);
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ }
+
+ @Override
+ public void onCraftMatrixChanged(IInventory par1IInventory) {
+ try {
+ super.onCraftMatrixChanged(par1IInventory);
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ }
+
+ @Override
+ public void putStackInSlot(int par1, ItemStack par2ItemStack) {
+ try {
+ super.putStackInSlot(par1, par2ItemStack);
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ }
+
+ @Override
+ public void putStacksInSlots(ItemStack[] par1ArrayOfItemStack) {
+ try {
+ super.putStacksInSlots(par1ArrayOfItemStack);
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ }
+
+ @Override
+ public void updateProgressBar(int par1, int par2) {
+ try {
+ super.updateProgressBar(par1, par2);
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ }
+
+ @Override
+ public short getNextTransactionID(InventoryPlayer par1InventoryPlayer) {
+ try {
+ return super.getNextTransactionID(par1InventoryPlayer);
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ return 0;
+ }
+
+ @Override
+ public boolean isPlayerNotUsingContainer(EntityPlayer par1EntityPlayer) {
+ try {
+ return super.isPlayerNotUsingContainer(par1EntityPlayer);
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ return true;
+ }
+
+ @Override
+ public void setPlayerIsPresent(EntityPlayer par1EntityPlayer, boolean par2) {
+ try {
+ super.setPlayerIsPresent(par1EntityPlayer, par2);
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ }
+
+ @Override
+ protected void func_94533_d() {
+ try {
+ super.func_94533_d();
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ }
+
+ @Override
+ public boolean canDragIntoSlot(Slot par1Slot) {
+ try {
+ return super.canDragIntoSlot(par1Slot);
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ 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
new file mode 100644
index 0000000000..c2fa1ab8ad
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java
@@ -0,0 +1,185 @@
+package gregtech.api.gui;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.ICrafting;
+
+import java.util.Iterator;
+
+/**
+ * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
+ * <p/>
+ * The Container I use for all my MetaTileEntities
+ */
+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;
+ private int oActive = 0, oMaxProgressTime = 0, oProgressTime = 0, oEnergy = 0, oSteam = 0, oSteamStorage = 0, oStorage = 0, oOutput = 0, oInput = 0, oID = 0, oDisplayErrorCode = 0, mTimer = 0;
+
+
+ public GT_ContainerMetaTile_Machine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+
+ mTileEntity = aTileEntity;
+
+ if (mTileEntity != null && mTileEntity.getMetaTileEntity() != null) {
+ addSlots(aInventoryPlayer);
+ if (doesBindPlayerInventory()) bindPlayerInventory(aInventoryPlayer);
+ detectAndSendChanges();
+ } else {
+ aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer;
+ }
+ }
+ public GT_ContainerMetaTile_Machine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean doesBindInventory) {
+ super(aInventoryPlayer, aTileEntity);
+ mTileEntity = aTileEntity;
+
+ if (mTileEntity != null && mTileEntity.getMetaTileEntity() != null) {
+ addSlots(aInventoryPlayer);
+ if (doesBindPlayerInventory() && doesBindInventory) bindPlayerInventory(aInventoryPlayer);
+ detectAndSendChanges();
+ } else {
+ aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer;
+ }
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return;
+ mStorage = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getEUCapacity());
+ mEnergy = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getStoredEU());
+ mSteamStorage = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getSteamCapacity());
+ mSteam = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getStoredSteam());
+ mOutput = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getOutputVoltage());
+ mInput = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getInputVoltage());
+ mDisplayErrorCode = mTileEntity.getErrorDisplayID();
+ mProgressTime = mTileEntity.getProgress();
+ mMaxProgressTime = mTileEntity.getMaxProgress();
+ mActive = mTileEntity.isActive() ? 1 : 0;
+ mTimer++;
+
+ Iterator var2 = this.crafters.iterator();
+ while (var2.hasNext()) {
+ ICrafting var1 = (ICrafting) var2.next();
+ if (mTimer % 500 == 10 || oEnergy != mEnergy) {
+ var1.sendProgressBarUpdate(this, 0, mEnergy & 65535);
+ var1.sendProgressBarUpdate(this, 1, mEnergy >>> 16);
+ }
+ if (mTimer % 500 == 10 || oStorage != mStorage) {
+ var1.sendProgressBarUpdate(this, 2, mStorage & 65535);
+ var1.sendProgressBarUpdate(this, 3, mStorage >>> 16);
+ }
+ if (mTimer % 500 == 10 || oOutput != mOutput) {
+ var1.sendProgressBarUpdate(this, 4, mOutput);
+ }
+ if (mTimer % 500 == 10 || oInput != mInput) {
+ var1.sendProgressBarUpdate(this, 5, mInput);
+ }
+ if (mTimer % 500 == 10 || oDisplayErrorCode != mDisplayErrorCode) {
+ var1.sendProgressBarUpdate(this, 6, mDisplayErrorCode);
+ }
+ if (mTimer % 500 == 10 || oProgressTime != mProgressTime) {
+ var1.sendProgressBarUpdate(this, 11, mProgressTime & 65535);
+ var1.sendProgressBarUpdate(this, 12, mProgressTime >>> 16);
+ }
+ if (mTimer % 500 == 10 || oMaxProgressTime != mMaxProgressTime) {
+ var1.sendProgressBarUpdate(this, 13, mMaxProgressTime & 65535);
+ var1.sendProgressBarUpdate(this, 14, mMaxProgressTime >>> 16);
+ }
+ if (mTimer % 500 == 10 || oID != mID) {
+ var1.sendProgressBarUpdate(this, 15, mID);
+ }
+ if (mTimer % 500 == 10 || oActive != mActive) {
+ var1.sendProgressBarUpdate(this, 16, mActive);
+ }
+ if (mTimer % 500 == 10 || oSteam != mSteam) {
+ var1.sendProgressBarUpdate(this, 17, mSteam & 65535);
+ var1.sendProgressBarUpdate(this, 18, mSteam >>> 16);
+ }
+ if (mTimer % 500 == 10 || oSteamStorage != mSteamStorage) {
+ var1.sendProgressBarUpdate(this, 19, mSteamStorage & 65535);
+ var1.sendProgressBarUpdate(this, 20, mSteamStorage >>> 16);
+ }
+ }
+
+ oID = mID;
+ oSteam = mSteam;
+ oInput = mInput;
+ oActive = mActive;
+ oOutput = mOutput;
+ oEnergy = mEnergy;
+ oStorage = mStorage;
+ oSteamStorage = mSteamStorage;
+ oProgressTime = mProgressTime;
+ oMaxProgressTime = mMaxProgressTime;
+ oDisplayErrorCode = mDisplayErrorCode;
+ }
+
+ @SideOnly(Side.CLIENT)
+ @Override
+ public void updateProgressBar(int par1, int par2) {
+ super.updateProgressBar(par1, par2);
+ switch (par1) {
+ case 0:
+ mEnergy = mEnergy & -65536 | par2;
+ break;
+ case 1:
+ mEnergy = mEnergy & 65535 | par2 << 16;
+ break;
+ case 2:
+ mStorage = mStorage & -65536 | par2;
+ break;
+ case 3:
+ mStorage = mStorage & 65535 | par2 << 16;
+ break;
+ case 4:
+ mOutput = par2;
+ break;
+ case 5:
+ mInput = par2;
+ break;
+ case 6:
+ mDisplayErrorCode = par2;
+ break;
+ case 11:
+ mProgressTime = mProgressTime & -65536 | par2;
+ break;
+ case 12:
+ mProgressTime = mProgressTime & 65535 | par2 << 16;
+ break;
+ case 13:
+ mMaxProgressTime = mMaxProgressTime & -65536 | par2;
+ break;
+ case 14:
+ mMaxProgressTime = mMaxProgressTime & 65535 | par2 << 16;
+ break;
+ case 15:
+ mID = par2;
+ break;
+ case 16:
+ mActive = par2;
+ break;
+ case 17:
+ mSteam = mSteam & -65536 | par2;
+ break;
+ case 18:
+ mSteam = mSteam & 65535 | par2 << 16;
+ break;
+ case 19:
+ mSteamStorage = mSteamStorage & -65536 | par2;
+ break;
+ case 20:
+ mSteamStorage = mSteamStorage & 65535 | par2 << 16;
+ break;
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer player) {
+ return mTileEntity.isUseableByPlayer(player);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/api/gui/GT_Container_1by1.java b/src/main/java/gregtech/api/gui/GT_Container_1by1.java
new file mode 100644
index 0000000000..aafa4d9bc9
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_Container_1by1.java
@@ -0,0 +1,27 @@
+package gregtech.api.gui;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Slot;
+
+public class GT_Container_1by1 extends GT_ContainerMetaTile_Machine {
+
+ public GT_Container_1by1(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ addSlotToContainer(new Slot(mTileEntity, 0, 80, 35));
+ }
+
+ @Override
+ public int getSlotCount() {
+ return 1;
+ }
+
+ @Override
+ public int getShiftClickSlotCount() {
+ return 1;
+ }
+}
diff --git a/src/main/java/gregtech/api/gui/GT_Container_2by2.java b/src/main/java/gregtech/api/gui/GT_Container_2by2.java
new file mode 100644
index 0000000000..089c20e335
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_Container_2by2.java
@@ -0,0 +1,30 @@
+package gregtech.api.gui;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Slot;
+
+public class GT_Container_2by2 extends GT_ContainerMetaTile_Machine {
+
+ public GT_Container_2by2(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ addSlotToContainer(new Slot(mTileEntity, 0, 71, 26));
+ addSlotToContainer(new Slot(mTileEntity, 1, 89, 26));
+ addSlotToContainer(new Slot(mTileEntity, 2, 71, 44));
+ addSlotToContainer(new Slot(mTileEntity, 3, 89, 44));
+ }
+
+ @Override
+ public int getSlotCount() {
+ return 4;
+ }
+
+ @Override
+ public int getShiftClickSlotCount() {
+ return 4;
+ }
+}
diff --git a/src/main/java/gregtech/api/gui/GT_Container_3by3.java b/src/main/java/gregtech/api/gui/GT_Container_3by3.java
new file mode 100644
index 0000000000..aa44556ff5
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_Container_3by3.java
@@ -0,0 +1,35 @@
+package gregtech.api.gui;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Slot;
+
+public class GT_Container_3by3 extends GT_ContainerMetaTile_Machine {
+
+ public GT_Container_3by3(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ addSlotToContainer(new Slot(mTileEntity, 0, 62, 17));
+ addSlotToContainer(new Slot(mTileEntity, 1, 80, 17));
+ addSlotToContainer(new Slot(mTileEntity, 2, 98, 17));
+ addSlotToContainer(new Slot(mTileEntity, 3, 62, 35));
+ addSlotToContainer(new Slot(mTileEntity, 4, 80, 35));
+ addSlotToContainer(new Slot(mTileEntity, 5, 98, 35));
+ addSlotToContainer(new Slot(mTileEntity, 6, 62, 53));
+ addSlotToContainer(new Slot(mTileEntity, 7, 80, 53));
+ addSlotToContainer(new Slot(mTileEntity, 8, 98, 53));
+ }
+
+ @Override
+ public int getSlotCount() {
+ return 9;
+ }
+
+ @Override
+ public int getShiftClickSlotCount() {
+ return 9;
+ }
+}
diff --git a/src/main/java/gregtech/api/gui/GT_Container_4by4.java b/src/main/java/gregtech/api/gui/GT_Container_4by4.java
new file mode 100644
index 0000000000..77566a0dc2
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_Container_4by4.java
@@ -0,0 +1,42 @@
+package gregtech.api.gui;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Slot;
+
+public class GT_Container_4by4 extends GT_ContainerMetaTile_Machine {
+
+ public GT_Container_4by4(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ addSlotToContainer(new Slot(mTileEntity, 0, 53, 8));
+ addSlotToContainer(new Slot(mTileEntity, 1, 71, 8));
+ addSlotToContainer(new Slot(mTileEntity, 2, 89, 8));
+ addSlotToContainer(new Slot(mTileEntity, 3, 107, 8));
+ addSlotToContainer(new Slot(mTileEntity, 4, 53, 26));
+ addSlotToContainer(new Slot(mTileEntity, 5, 71, 26));
+ addSlotToContainer(new Slot(mTileEntity, 6, 89, 26));
+ addSlotToContainer(new Slot(mTileEntity, 7, 107, 26));
+ addSlotToContainer(new Slot(mTileEntity, 8, 53, 44));
+ addSlotToContainer(new Slot(mTileEntity, 9, 71, 44));
+ addSlotToContainer(new Slot(mTileEntity, 10, 89, 44));
+ addSlotToContainer(new Slot(mTileEntity, 11, 107, 44));
+ addSlotToContainer(new Slot(mTileEntity, 12, 53, 62));
+ addSlotToContainer(new Slot(mTileEntity, 13, 71, 62));
+ addSlotToContainer(new Slot(mTileEntity, 14, 89, 62));
+ addSlotToContainer(new Slot(mTileEntity, 15, 107, 62));
+ }
+
+ @Override
+ public int getSlotCount() {
+ return 16;
+ }
+
+ @Override
+ public int getShiftClickSlotCount() {
+ return 16;
+ }
+}
diff --git a/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java b/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java
new file mode 100644
index 0000000000..2dbc298d44
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java
@@ -0,0 +1,254 @@
+package gregtech.api.gui;
+
+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 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 java.util.Iterator;
+
+/**
+ * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
+ * <p/>
+ * The Container I use for all my Basic Machines
+ */
+public class GT_Container_BasicMachine extends GT_Container_BasicTank {
+
+ public boolean mFluidTransfer = false, mItemTransfer = false, mStuttering = false;
+
+ public GT_Container_BasicMachine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 8, 63, false, true, 1));
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 26, 63, false, true, 1));
+ addSlotToContainer(new GT_Slot_Render(mTileEntity, 2, 107, 63));
+
+ int tStartIndex = ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).getInputSlot();
+
+ switch (((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mInputSlotCount) {
+ case 0:
+ break;
+ case 1:
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 25));
+ break;
+ case 2:
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 25));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 25));
+ break;
+ case 3:
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 25));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 25));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 25));
+ break;
+ case 4:
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 16));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 16));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 34));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 34));
+ break;
+ case 5:
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 16));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 16));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 16));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 34));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 34));
+ break;
+ case 6:
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 16));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 16));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 16));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 34));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 34));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 34));
+ break;
+ case 7:
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 7));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 7));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 7));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 25));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 25));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 25));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 43));
+ break;
+ case 8:
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 7));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 7));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 7));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 25));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 25));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 25));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 43));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 43));
+ break;
+ default:
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 7));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 7));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 7));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 25));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 25));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 25));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 43));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 43));
+ addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 43));
+ break;
+ }
+
+ tStartIndex = ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).getOutputSlot();
+
+ switch (((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mOutputItems.length) {
+ case 0:
+ break;
+ case 1:
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 25));
+ break;
+ case 2:
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 25));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 25));
+ break;
+ case 3:
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 25));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 25));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 25));
+ break;
+ case 4:
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 16));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 16));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 34));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 34));
+ break;
+ case 5:
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 16));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 16));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 16));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 34));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 34));
+ break;
+ case 6:
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 16));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 16));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 16));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 34));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 34));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 34));
+ break;
+ case 7:
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 7));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 7));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 7));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 25));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 25));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 25));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 43));
+ break;
+ case 8:
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 7));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 7));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 7));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 25));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 25));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 25));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 43));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 43));
+ break;
+ default:
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 7));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 7));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 7));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 25));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 25));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 25));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 43));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 43));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 43));
+ break;
+ }
+
+ addSlotToContainer(new Slot(mTileEntity, 1, 80, 63));
+ addSlotToContainer(new Slot(mTileEntity, 3, 125, 63));
+ addSlotToContainer(new GT_Slot_Render(mTileEntity, tStartIndex++, 53, 63));
+ }
+
+ @Override
+ public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) {
+ switch (aSlotIndex) {
+ case 0:
+ if (mTileEntity.getMetaTileEntity() == null) return null;
+ ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mFluidTransfer = !((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mFluidTransfer;
+ return null;
+ case 1:
+ if (mTileEntity.getMetaTileEntity() == null) return null;
+ ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mItemTransfer = !((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mItemTransfer;
+ return null;
+ default:
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return;
+
+ mFluidTransfer = ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mFluidTransfer;
+ mItemTransfer = ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mItemTransfer;
+ mStuttering = ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mStuttering;
+
+ Iterator var2 = this.crafters.iterator();
+ while (var2.hasNext()) {
+ ICrafting var1 = (ICrafting) var2.next();
+ var1.sendProgressBarUpdate(this, 102, mFluidTransfer ? 1 : 0);
+ var1.sendProgressBarUpdate(this, 103, mItemTransfer ? 1 : 0);
+ var1.sendProgressBarUpdate(this, 104, mStuttering ? 1 : 0);
+ }
+ }
+
+ @Override
+ public void addCraftingToCrafters(ICrafting par1ICrafting) {
+ super.addCraftingToCrafters(par1ICrafting);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void updateProgressBar(int par1, int par2) {
+ super.updateProgressBar(par1, par2);
+ switch (par1) {
+ case 102:
+ mFluidTransfer = (par2 != 0);
+ break;
+ case 103:
+ mItemTransfer = (par2 != 0);
+ break;
+ case 104:
+ mStuttering = (par2 != 0);
+ break;
+ }
+ }
+
+ @Override
+ public int getSlotStartIndex() {
+ return 3;
+ }
+
+ @Override
+ public int getShiftClickStartIndex() {
+ return 3;
+ }
+
+ @Override
+ public int getSlotCount() {
+ return getShiftClickSlotCount() + ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mOutputItems.length + 2;
+ }
+
+ @Override
+ public int getShiftClickSlotCount() {
+ return ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mInputSlotCount;
+ }
+}
diff --git a/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java b/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java
new file mode 100644
index 0000000000..aeb0ef0c45
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java
@@ -0,0 +1,72 @@
+package gregtech.api.gui;
+
+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 net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+
+import java.util.Iterator;
+
+/**
+ * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
+ * <p/>
+ * The Container I use for all my Basic Tanks
+ */
+public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine {
+
+ public int mContent = 0;
+
+ public GT_Container_BasicTank(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ addSlotToContainer(new Slot(mTileEntity, 0, 80, 17));
+ addSlotToContainer(new GT_Slot_Output(mTileEntity, 1, 80, 53));
+ addSlotToContainer(new GT_Slot_Render(mTileEntity, 2, 59, 42));
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return;
+ if (((GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity()).mFluid != null)
+ mContent = ((GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity()).mFluid.amount;
+ else
+ mContent = 0;
+ Iterator var2 = this.crafters.iterator();
+ while (var2.hasNext()) {
+ ICrafting var1 = (ICrafting) var2.next();
+ var1.sendProgressBarUpdate(this, 100, mContent & 65535);
+ var1.sendProgressBarUpdate(this, 101, mContent >>> 16);
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void updateProgressBar(int par1, int par2) {
+ super.updateProgressBar(par1, par2);
+ switch (par1) {
+ case 100:
+ mContent = mContent & -65536 | par2;
+ break;
+ case 101:
+ mContent = mContent & 65535 | par2 << 16;
+ break;
+ }
+ }
+
+ @Override
+ public int getSlotCount() {
+ return 2;
+ }
+
+ @Override
+ public int getShiftClickSlotCount() {
+ return 1;
+ }
+}
diff --git a/src/main/java/gregtech/api/gui/GT_Container_MaintenanceHatch.java b/src/main/java/gregtech/api/gui/GT_Container_MaintenanceHatch.java
new file mode 100644
index 0000000000..5c469f8704
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_Container_MaintenanceHatch.java
@@ -0,0 +1,30 @@
+package gregtech.api.gui;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+
+public class GT_Container_MaintenanceHatch extends GT_ContainerMetaTile_Machine {
+
+ public GT_Container_MaintenanceHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 80, 35, false, false, 1));
+ }
+
+ @Override
+ public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) {
+ if (aSlotIndex != 0) return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ ItemStack tStack = aPlayer.inventory.getItemStack();
+ if (tStack != null) {
+ ((GT_MetaTileEntity_Hatch_Maintenance) mTileEntity.getMetaTileEntity()).onToolClick(tStack, aPlayer);
+ if (tStack.stackSize <= 0) aPlayer.inventory.setItemStack(null);
+ }
+ return null;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/api/gui/GT_Container_MultiMachine.java b/src/main/java/gregtech/api/gui/GT_Container_MultiMachine.java
new file mode 100644
index 0000000000..f5e9a83d19
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_Container_MultiMachine.java
@@ -0,0 +1,35 @@
+package gregtech.api.gui;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Slot;
+
+/**
+ * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
+ * <p/>
+ * The Container I use for all my Basic Machines
+ */
+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) {
+ super(aInventoryPlayer, aTileEntity, bindInventory);
+ }
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ addSlotToContainer(new Slot(mTileEntity, 1, 152, 5));
+ }
+
+ @Override
+ public int getSlotCount() {
+ return 1;
+ }
+
+ @Override
+ public int getShiftClickSlotCount() {
+ return 1;
+ }
+}
diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer.java b/src/main/java/gregtech/api/gui/GT_GUIContainer.java
new file mode 100644
index 0000000000..f53684f10a
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_GUIContainer.java
@@ -0,0 +1,72 @@
+package gregtech.api.gui;
+
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.inventory.Container;
+import net.minecraft.util.ResourceLocation;
+
+/**
+ * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
+ * <p/>
+ * Main GUI-Container-Class which basically contains the Code needed to prevent crashes from improperly Coded Items.
+ */
+public class GT_GUIContainer extends GuiContainer {
+
+ public boolean mCrashed = false;
+
+ public ResourceLocation mGUIbackground;
+
+ public String mGUIbackgroundPath;
+
+ public GT_GUIContainer(Container aContainer, String aGUIbackground) {
+ super(aContainer);
+ mGUIbackground = new ResourceLocation(mGUIbackgroundPath = aGUIbackground);
+ }
+
+ public int getLeft() {
+ return guiLeft;
+ }
+
+ public int getTop() {
+ return guiTop;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ //
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ mc.renderEngine.bindTexture(mGUIbackground);
+ }
+
+ @Override
+ public void drawScreen(int par1, int par2, float par3) {
+ try {
+ super.drawScreen(par1, par2, par3);
+ } catch (Throwable e) {
+ try {
+ Tessellator.instance.draw();
+ } catch (Throwable f) {
+ //
+ }
+ }
+ }
+ /*
+ @Override
+ protected void drawSlotInventory(Slot par1Slot) {
+ try {
+ super.drawSlotInventory(par1Slot);
+ } 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
new file mode 100644
index 0000000000..4c20715e68
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java
@@ -0,0 +1,38 @@
+package gregtech.api.gui;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemDye;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
+ * <p/>
+ * The GUI-Container I use for all my MetaTileEntities
+ */
+public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer {
+
+ public final GT_ContainerMetaTile_Machine mContainer;
+
+ public GT_GUIContainerMetaTile_Machine(GT_ContainerMetaTile_Machine aContainer, String aGUIbackground) {
+ super(aContainer, aGUIbackground);
+ mContainer = aContainer;
+ }
+
+ public GT_GUIContainerMetaTile_Machine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aGUIbackground) {
+ this(new GT_ContainerMetaTile_Machine(aInventoryPlayer, aTileEntity), aGUIbackground);
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ super.drawGuiContainerBackgroundLayer(par1, par2, par3);
+ if (GregTech_API.sColoredGUI && mContainer != null && mContainer.mTileEntity != null) {
+ int tColor = mContainer.mTileEntity.getColorization() & 15;
+ if (tColor >= 0 && tColor < ItemDye.field_150922_c.length) {
+ tColor = ItemDye.field_150922_c[tColor];
+ GL11.glColor4f(((tColor >> 16) & 255) / 255.0F, ((tColor >> 8) & 255) / 255.0F, (tColor & 255) / 255.0F, 1.0F);
+ } else GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ } else GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_1by1.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_1by1.java
new file mode 100644
index 0000000000..29cc403c71
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_1by1.java
@@ -0,0 +1,29 @@
+package gregtech.api.gui;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+
+import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
+
+public class GT_GUIContainer_1by1 extends GT_GUIContainerMetaTile_Machine {
+
+ private final String mName;
+
+ public GT_GUIContainer_1by1(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) {
+ super(new GT_Container_1by1(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "1by1.png");
+ mName = aName;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ fontRendererObj.drawString(mName, 8, 4, 4210752);
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ super.drawGuiContainerBackgroundLayer(par1, par2, par3);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2.java
new file mode 100644
index 0000000000..50653132ce
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2.java
@@ -0,0 +1,29 @@
+package gregtech.api.gui;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+
+import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
+
+public class GT_GUIContainer_2by2 extends GT_GUIContainerMetaTile_Machine {
+
+ private final String mName;
+
+ public GT_GUIContainer_2by2(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) {
+ super(new GT_Container_2by2(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "2by2.png");
+ mName = aName;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ fontRendererObj.drawString(mName, 8, 4, 4210752);
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ super.drawGuiContainerBackgroundLayer(par1, par2, par3);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_3by3.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_3by3.java
new file mode 100644
index 0000000000..de12be9e92
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_3by3.java
@@ -0,0 +1,29 @@
+package gregtech.api.gui;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+
+import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
+
+public class GT_GUIContainer_3by3 extends GT_GUIContainerMetaTile_Machine {
+
+ private final String mName;
+
+ public GT_GUIContainer_3by3(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) {
+ super(new GT_Container_3by3(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "3by3.png");
+ mName = aName;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ fontRendererObj.drawString(mName, 8, 4, 4210752);
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ super.drawGuiContainerBackgroundLayer(par1, par2, par3);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_4by4.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_4by4.java
new file mode 100644
index 0000000000..dd536f41a7
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_4by4.java
@@ -0,0 +1,29 @@
+package gregtech.api.gui;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+
+import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
+
+public class GT_GUIContainer_4by4 extends GT_GUIContainerMetaTile_Machine {
+
+ private final String mName;
+
+ public GT_GUIContainer_4by4(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) {
+ super(new GT_Container_4by4(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "4by4.png");
+ mName = aName;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ fontRendererObj.drawString(mName, 8, 4, 4210752);
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ super.drawGuiContainerBackgroundLayer(par1, par2, par3);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java
new file mode 100644
index 0000000000..5f506bca7b
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java
@@ -0,0 +1,109 @@
+package gregtech.api.gui;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
+
+/**
+ * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
+ * <p/>
+ * The GUI-Container I use for all my Basic Machines
+ * <p/>
+ * As the NEI-RecipeTransferRect Handler can't handle one GUI-Class for all GUIs I needed to produce some dummy-classes which extend this class
+ */
+public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machine {
+
+ public final String mName, mNEI;
+ public final byte mProgressBarDirection, mProgressBarAmount;
+
+ 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) {
+ super(new GT_Container_BasicMachine(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "basicmachines/" + aTextureFile);
+ mProgressBarDirection = aProgressBarDirection;
+ mProgressBarAmount = (byte) Math.max(1, aProgressBarAmount);
+ mName = aName;
+ mNEI = aNEI;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ fontRendererObj.drawString(mName, 8, 4, 4210752);
+ drawTooltip(par1, par2);
+ }
+
+ private void drawTooltip(int x2, int y2) {
+ int xStart = (width - xSize) / 2;
+ int yStart = (height - ySize) / 2;
+ int x = x2 - xStart;
+ int y = y2 - yStart + 5;
+ List<String> list = new ArrayList<String>();
+ if (y >= 67 && y <= 84) {
+ if (x >= 7 && x <= 24) {
+ list.add("Fluid Auto-Output");
+ }
+ if (x >= 25 && x <= 42) {
+ list.add("Item Auto-Output");
+ }
+ }
+ if (!list.isEmpty())
+ drawHoveringText(list, x, y, fontRendererObj);
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ super.drawGuiContainerBackgroundLayer(par1, par2, par3);
+ int x = (width - xSize) / 2;
+ 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 (((GT_Container_BasicMachine) mContainer).mStuttering)
+ drawTexturedModalRect(x + 79, y + 44, 176, 54, 18, 18);
+
+ if (mContainer.mMaxProgressTime > 0) {
+ int tSize = (mProgressBarDirection < 2 ? 20 : 18), tProgress = Math.max(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.
+ case 0:
+ drawTexturedModalRect(x + 78, y + 24, 176, 0, tProgress, 18);
+ break;
+ case 1:
+ drawTexturedModalRect(x + 78 + 20 - tProgress, y + 24, 176 + 20 - tProgress, 0, tProgress, 18);
+ break;
+ case 2:
+ drawTexturedModalRect(x + 78, y + 24, 176, 0, 20, tProgress);
+ break;
+ case 3:
+ drawTexturedModalRect(x + 78, y + 24 + 18 - tProgress, 176, 18 - tProgress, 20, tProgress);
+ break;
+ case 4:
+ tProgress = 20 - tProgress;
+ drawTexturedModalRect(x + 78, y + 24, 176, 0, tProgress, 18);
+ break;
+ case 5:
+ tProgress = 20 - tProgress;
+ drawTexturedModalRect(x + 78 + 20 - tProgress, y + 24, 176 + 20 - tProgress, 0, tProgress, 18);
+ break;
+ case 6:
+ tProgress = 18 - tProgress;
+ drawTexturedModalRect(x + 78, y + 24, 176, 0, 20, tProgress);
+ break;
+ case 7:
+ tProgress = 18 - tProgress;
+ drawTexturedModalRect(x + 78, y + 24 + 18 - tProgress, 176, 18 - tProgress, 20, tProgress);
+ break;
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicTank.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicTank.java
new file mode 100644
index 0000000000..b8b33ebb15
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicTank.java
@@ -0,0 +1,36 @@
+package gregtech.api.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 static gregtech.api.enums.GT_Values.RES_PATH_GUI;
+
+public class GT_GUIContainer_BasicTank extends GT_GUIContainerMetaTile_Machine {
+
+ private final String mName;
+
+ public GT_GUIContainer_BasicTank(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) {
+ super(new GT_Container_BasicTank(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "BasicTank.png");
+ mName = aName;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 4210752);
+ fontRendererObj.drawString(mName, 8, 6, 4210752);
+ if (mContainer != null) {
+ fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
+ fontRendererObj.drawString(GT_Utility.parseNumberToString(((GT_Container_BasicTank) mContainer).mContent), 10, 30, 16448255);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ super.drawGuiContainerBackgroundLayer(par1, par2, par3);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_MaintenanceHatch.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_MaintenanceHatch.java
new file mode 100644
index 0000000000..e827e21fab
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_MaintenanceHatch.java
@@ -0,0 +1,27 @@
+package gregtech.api.gui;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+
+import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
+
+public class GT_GUIContainer_MaintenanceHatch extends GT_GUIContainerMetaTile_Machine {
+
+ public GT_GUIContainer_MaintenanceHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(new GT_Container_MaintenanceHatch(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Maintenance.png");
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ fontRendererObj.drawString("Maintenance Hatch", 8, 4, 4210752);
+ fontRendererObj.drawString("Click with Tool to repair.", 8, 12, 4210752);
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ super.drawGuiContainerBackgroundLayer(par1, par2, par3);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java
new file mode 100644
index 0000000000..2980cd9c1d
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java
@@ -0,0 +1,63 @@
+package gregtech.api.gui;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+
+import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
+
+/**
+ * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
+ * <p/>
+ * The GUI-Container I use for all my Basic Machines
+ * <p/>
+ * As the NEI-RecipeTransferRect Handler can't handle one GUI-Class for all GUIs I needed to produce some dummy-classes which extend this class
+ */
+public class GT_GUIContainer_MultiMachine extends GT_GUIContainerMetaTile_Machine {
+
+ String mName = "";
+
+ 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));
+ mName = aName;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ fontRendererObj.drawString(mName, 10, 8, 16448255);
+
+ if (mContainer != null) {
+ if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 1) != 0)
+ fontRendererObj.drawString("Pipe is loose.", 10, 16, 16448255);
+ if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 2) != 0)
+ fontRendererObj.drawString("Screws are missing.", 10, 24, 16448255);
+ if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 4) != 0)
+ fontRendererObj.drawString("Something is stuck.", 10, 32, 16448255);
+ if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 8) != 0)
+ fontRendererObj.drawString("Platings are dented.", 10, 40, 16448255);
+ if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 16) != 0)
+ fontRendererObj.drawString("Circuitry burned out.", 10, 48, 16448255);
+ if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 32) != 0)
+ fontRendererObj.drawString("That doesn't belong there.", 10, 56, 16448255);
+ if ((((GT_Container_MultiMachine) mContainer).mDisplayErrorCode & 64) != 0)
+ fontRendererObj.drawString("Incomplete Structure.", 10, 64, 16448255);
+
+ if (((GT_Container_MultiMachine) mContainer).mDisplayErrorCode == 0) {
+ if (((GT_Container_MultiMachine) mContainer).mActive == 0) {
+ fontRendererObj.drawString("Hit with Soft Hammer", 10, 16, 16448255);
+ fontRendererObj.drawString("to (re-)start the Machine", 10, 24, 16448255);
+ fontRendererObj.drawString("if it doesn't start.", 10, 32, 16448255);
+ } else {
+ fontRendererObj.drawString("Running perfectly.", 10, 16, 16448255);
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ super.drawGuiContainerBackgroundLayer(par1, par2, par3);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
diff --git a/src/main/java/gregtech/api/gui/GT_Slot_Armor.java b/src/main/java/gregtech/api/gui/GT_Slot_Armor.java
new file mode 100644
index 0000000000..0359884a5e
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_Slot_Armor.java
@@ -0,0 +1,27 @@
+package gregtech.api.gui;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+public class GT_Slot_Armor extends Slot {
+ final int mArmorType;
+ final EntityPlayer mPlayer;
+
+ public GT_Slot_Armor(IInventory par2IInventory, int par3, int par4, int par5, int par6, EntityPlayer aPlayer) {
+ super(par2IInventory, par3, par4, par5);
+ mArmorType = par6;
+ mPlayer = aPlayer;
+ }
+
+ @Override
+ public int getSlotStackLimit() {
+ return 1;
+ }
+
+ @Override
+ public boolean isItemValid(ItemStack aStack) {
+ return aStack != null && aStack.getItem() != null && aStack.getItem().isValidArmor(aStack, mArmorType, 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
new file mode 100644
index 0000000000..28b4d2828c
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_Slot_DataOrb.java
@@ -0,0 +1,17 @@
+package gregtech.api.gui;
+
+import gregtech.api.enums.ItemList;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+public class GT_Slot_DataOrb extends Slot {
+ public GT_Slot_DataOrb(IInventory par1iInventory, int par2, int par3, int par4) {
+ super(par1iInventory, par2, par3, par4);
+ }
+
+ @Override
+ 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_Holo.java b/src/main/java/gregtech/api/gui/GT_Slot_Holo.java
new file mode 100644
index 0000000000..c6b577514b
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_Slot_Holo.java
@@ -0,0 +1,46 @@
+package gregtech.api.gui;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+public class GT_Slot_Holo extends Slot {
+ public final int mSlotIndex;
+ public boolean mCanInsertItem, mCanStackItem;
+ public int mMaxStacksize = 127;
+
+ public GT_Slot_Holo(IInventory par1iInventory, int par2, int par3, int par4, boolean aCanInsertItem, boolean aCanStackItem, int aMaxStacksize) {
+ super(par1iInventory, par2, par3, par4);
+ mCanInsertItem = aCanInsertItem;
+ mCanStackItem = aCanStackItem;
+ mMaxStacksize = aMaxStacksize;
+ mSlotIndex = par2;
+ }
+
+ @Override
+ public boolean isItemValid(ItemStack par1ItemStack) {
+ return mCanInsertItem;
+ }
+
+ @Override
+ public int getSlotStackLimit() {
+ return mMaxStacksize;
+ }
+
+ @Override
+ public boolean getHasStack() {
+ return false;
+ }
+
+ @Override
+ public ItemStack decrStackSize(int par1) {
+ if (!mCanStackItem) return null;
+ return super.decrStackSize(par1);
+ }
+
+ @Override
+ public boolean canTakeStack(EntityPlayer par1EntityPlayer) {
+ return false;
+ }
+}
diff --git a/src/main/java/gregtech/api/gui/GT_Slot_Output.java b/src/main/java/gregtech/api/gui/GT_Slot_Output.java
new file mode 100644
index 0000000000..bf10769f55
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_Slot_Output.java
@@ -0,0 +1,16 @@
+package gregtech.api.gui;
+
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+public class GT_Slot_Output extends Slot {
+ public GT_Slot_Output(IInventory par1iInventory, int par2, int par3, int par4) {
+ super(par1iInventory, par2, par3, par4);
+ }
+
+ @Override
+ public boolean isItemValid(ItemStack par1ItemStack) {
+ return false;
+ }
+}
diff --git a/src/main/java/gregtech/api/gui/GT_Slot_Render.java b/src/main/java/gregtech/api/gui/GT_Slot_Render.java
new file mode 100644
index 0000000000..92927e284e
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_Slot_Render.java
@@ -0,0 +1,22 @@
+package gregtech.api.gui;
+
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+
+public class GT_Slot_Render extends GT_Slot_Holo {
+ public GT_Slot_Render(IInventory par1iInventory, int par2, int par3, int par4) {
+ super(par1iInventory, par2, par3, par4, 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.
+ */
+ @Override
+ public void putStack(ItemStack aStack) {
+ if (inventory instanceof TileEntity && ((TileEntity) inventory).getWorldObj().isRemote) {
+ inventory.setInventorySlotContents(getSlotIndex(), aStack);
+ }
+ onSlotChanged();
+ }
+} \ No newline at end of file