aboutsummaryrefslogtreecommitdiff
path: root/src/Java/miscutil/core/container
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2016-06-16 03:59:47 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2016-06-16 03:59:47 +1000
commit51d5db94cfafac652a05f6f121ec2521d62aaf5c (patch)
tree8e622e427fa6416b5ca508ed4deb8e10e783f9d1 /src/Java/miscutil/core/container
parentd3f4786befad33f4ec77723bf4470d05f9f862ec (diff)
downloadGT5-Unofficial-51d5db94cfafac652a05f6f121ec2521d62aaf5c.tar.gz
GT5-Unofficial-51d5db94cfafac652a05f6f121ec2521d62aaf5c.tar.bz2
GT5-Unofficial-51d5db94cfafac652a05f6f121ec2521d62aaf5c.zip
Done a lot of work on the NFHG.
Also did some more refactoring beforehand.
Diffstat (limited to 'src/Java/miscutil/core/container')
-rw-r--r--src/Java/miscutil/core/container/Container_NHG.java104
1 files changed, 104 insertions, 0 deletions
diff --git a/src/Java/miscutil/core/container/Container_NHG.java b/src/Java/miscutil/core/container/Container_NHG.java
new file mode 100644
index 0000000000..8baed3f5bd
--- /dev/null
+++ b/src/Java/miscutil/core/container/Container_NHG.java
@@ -0,0 +1,104 @@
+package miscutil.core.container;
+
+import miscutil.core.tileentities.TileEntityNHG;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.inventory.SlotFurnace;
+import net.minecraft.item.ItemStack;
+
+public class Container_NHG extends Container
+{
+ private TileEntityNHG te;
+
+ public static final int INPUT_1 = 0, INPUT_2 = 1, INPUT_3 = 2,
+ INPUT_4 = 3, INPUT_5 = 4, INPUT_6 = 5,
+ INPUT_7 = 6, INPUT_8 = 7, INPUT_9 = 8,
+ INPUT_10 = 9, INPUT_11 = 10, INPUT_12 = 11,
+ INPUT_13 = 12, INPUT_14 = 13, INPUT_15 = 14,
+ INPUT_16 = 15, INPUT_17 = 16, INPUT_18 = 17,
+ OUTPUT = 18;
+
+ private int slotID = 0;
+
+ public Container_NHG(TileEntityNHG te, EntityPlayer player)
+ {
+ this.te = te;
+
+
+ //Fuel Rods A
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < 3; j++)
+ {
+ addSlotToContainer(new Slot(te, slotID++, 8 + j * 18, 17 + i * 18));
+ }
+ }
+ //Fuel Rods B
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < 3; j++)
+ {
+ addSlotToContainer(new Slot(te, slotID++, 116 + j * 18, 17 + i * 18));
+ }
+ }
+
+ //Output
+ addSlotToContainer(new SlotFurnace(player, te, OUTPUT, 80, 53));
+
+ //Inventory
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < 9; j++)
+ {
+ addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
+ }
+ }
+ // Hotbar
+ for (int i = 0; i < 9; i++)
+ {
+ addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
+ }
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw)
+ {
+ ItemStack stack = null;
+ Slot slot = (Slot)inventorySlots.get(slotRaw);
+
+ if (slot != null && slot.getHasStack())
+ {
+ ItemStack stackInSlot = slot.getStack();
+ stack = stackInSlot.copy();
+
+ if (slotRaw < 3 * 9)
+ {
+ if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true))
+ {
+ return null;
+ }
+ }
+ else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false))
+ {
+ return null;
+ }
+
+ if (stackInSlot.stackSize == 0)
+ {
+ slot.putStack((ItemStack)null);
+ }
+ else
+ {
+ slot.onSlotChanged();
+ }
+ }
+ return stack;
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer player)
+ {
+ return te.isUseableByPlayer(player);
+ }
+} \ No newline at end of file