aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/core/container
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/core/container')
-rw-r--r--src/main/java/gtPlusPlus/core/container/Container_BackpackBase.java208
-rw-r--r--src/main/java/gtPlusPlus/core/container/Container_CircuitProgrammer.java190
-rw-r--r--src/main/java/gtPlusPlus/core/container/Container_DecayablesChest.java140
-rw-r--r--src/main/java/gtPlusPlus/core/container/Container_EggBox.java140
-rw-r--r--src/main/java/gtPlusPlus/core/container/Container_FishTrap.java142
-rw-r--r--src/main/java/gtPlusPlus/core/container/Container_Grindle.java160
-rw-r--r--src/main/java/gtPlusPlus/core/container/Container_HeliumGenerator.java193
-rw-r--r--src/main/java/gtPlusPlus/core/container/Container_ModularityTable.java252
-rw-r--r--src/main/java/gtPlusPlus/core/container/Container_PestKiller.java154
-rw-r--r--src/main/java/gtPlusPlus/core/container/Container_ProjectTable.java242
-rw-r--r--src/main/java/gtPlusPlus/core/container/Container_RoundRobinator.java246
-rw-r--r--src/main/java/gtPlusPlus/core/container/Container_SuperJukebox.java251
-rw-r--r--src/main/java/gtPlusPlus/core/container/Container_TradeTable.java223
-rw-r--r--src/main/java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java190
-rw-r--r--src/main/java/gtPlusPlus/core/container/Container_Workbench.java413
-rw-r--r--src/main/java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java377
-rw-r--r--src/main/java/gtPlusPlus/core/container/box/LunchBoxContainer.java13
-rw-r--r--src/main/java/gtPlusPlus/core/container/box/MagicBagContainer.java13
-rw-r--r--src/main/java/gtPlusPlus/core/container/box/ToolBoxContainer.java15
19 files changed, 3562 insertions, 0 deletions
diff --git a/src/main/java/gtPlusPlus/core/container/Container_BackpackBase.java b/src/main/java/gtPlusPlus/core/container/Container_BackpackBase.java
new file mode 100644
index 0000000000..ad76bebe81
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/container/Container_BackpackBase.java
@@ -0,0 +1,208 @@
+package gtPlusPlus.core.container;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+import gtPlusPlus.core.inventories.BaseInventoryBackpack;
+import gtPlusPlus.core.slots.SlotItemBackpackInv;
+
+public class Container_BackpackBase extends Container
+{
+ /** The Item Inventory for this Container, only needed if you want to reference isUseableByPlayer */
+ public final BaseInventoryBackpack inventory;
+
+ /** Using these will make transferStackInSlot easier to understand and implement
+ * INV_START is the index of the first slot in the Player's Inventory, so our
+ * BaseInventoryBackpack's number of slots (e.g. 5 slots is array indices 0-4, so start at 5)
+ * Notice how we don't have to remember how many slots we made? We can just use
+ * BaseInventoryBackpack.INV_SIZE and if we ever change it, the Container updates automatically. */
+ private static final int INV_START = BaseInventoryBackpack.INV_SIZE, INV_END = INV_START+26,
+ HOTBAR_START = INV_END+1, HOTBAR_END = HOTBAR_START+8;
+
+ // If you're planning to add armor slots, put those first like this:
+ // ARMOR_START = BaseInventoryBackpack.INV_SIZE, ARMOR_END = ARMOR_START+3,
+ // INV_START = ARMOR_END+1, and then carry on like above.
+
+ public Container_BackpackBase(final EntityPlayer par1Player, final InventoryPlayer inventoryPlayer, final BaseInventoryBackpack inventoryItem)
+ {
+ this.inventory = inventoryItem;
+
+ int i;
+
+ // ITEM INVENTORY - you'll need to adjust the slot locations to match your texture file
+ // I have them set vertically in columns of 4 to the right of the player model
+ for (i = 0; i < BaseInventoryBackpack.INV_SIZE; ++i)
+ {
+ // You can make a custom Slot if you need different behavior,
+ // such as only certain item types can be put into this slot
+ // We made a custom slot to prevent our inventory-storing item
+ // from being stored within itself, but if you want to allow that and
+ // you followed my advice at the end of the above step, then you
+ // could get away with using the vanilla Slot class
+ this.addSlotToContainer(new SlotItemBackpackInv(this.inventory, i, 80 + (18 * (i/4)), 8 + (18*(i%4))));
+ }
+
+ // If you want, you can add ARMOR SLOTS here as well, but you need to
+ // make a public version of SlotArmor. I won't be doing that in this tutorial.
+ /*
+ for (i = 0; i < 4; ++i)
+ {
+ // These are the standard positions for survival inventory layout
+ this.addSlotToContainer(new SlotArmor(this.player, inventoryPlayer, inventoryPlayer.getSizeInventory() - 1 - i, 8, 8 + i * 18, i));
+ }
+ */
+
+ // PLAYER INVENTORY - uses default locations for standard inventory texture file
+ for (i = 0; i < 3; ++i)
+ {
+ for (int j = 0; j < 9; ++j)
+ {
+ this.addSlotToContainer(new Slot(inventoryPlayer, j + (i * 9) + 9, 8 + (j * 18), 84 + (i * 18)));
+ }
+ }
+
+ // PLAYER ACTION BAR - uses default locations for standard action bar texture file
+ for (i = 0; i < 9; ++i)
+ {
+ this.addSlotToContainer(new Slot(inventoryPlayer, i, 8 + (i * 18), 142));
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(final EntityPlayer entityplayer)
+ {
+ // be sure to return the inventory's isUseableByPlayer method
+ // if you defined special behavior there:
+ return this.inventory.isUseableByPlayer(entityplayer);
+ }
+
+ /**
+ * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that.
+ */
+ @Override
+ public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int index)
+ {
+ ItemStack itemstack = null;
+ final Slot slot = (Slot) this.inventorySlots.get(index);
+
+ if ((slot != null) && slot.getHasStack())
+ {
+ final ItemStack itemstack1 = slot.getStack();
+ itemstack = itemstack1.copy();
+
+ // If item is in our custom Inventory or armor slot
+ if (index < INV_START)
+ {
+ // try to place in player inventory / action bar
+ if (!this.mergeItemStack(itemstack1, INV_START, HOTBAR_END+1, true))
+ {
+ return null;
+ }
+
+ slot.onSlotChange(itemstack1, itemstack);
+ }
+ // Item is in inventory / hotbar, try to place in custom inventory or armor slots
+ else
+ {
+ /*
+ If your inventory only stores certain instances of Items,
+ you can implement shift-clicking to your inventory like this:
+
+ // Check that the item is the right type
+ if (itemstack1.getItem() instanceof ItemCustom)
+ {
+ // Try to merge into your custom inventory slots
+ // We use 'BaseInventoryBackpack.INV_SIZE' instead of INV_START just in case
+ // you also add armor or other custom slots
+ if (!this.mergeItemStack(itemstack1, 0, BaseInventoryBackpack.INV_SIZE, false))
+ {
+ return null;
+ }
+ }
+ // If you added armor slots, check them here as well:
+ // Item being shift-clicked is armor - try to put in armor slot
+ if (itemstack1.getItem() instanceof ItemArmor)
+ {
+ int type = ((ItemArmor) itemstack1.getItem()).armorType;
+ if (!this.mergeItemStack(itemstack1, ARMOR_START + type, ARMOR_START + type + 1, false))
+ {
+ return null;
+ }
+ }
+ Otherwise, you have basically 2 choices:
+ 1. shift-clicking between player inventory and custom inventory
+ 2. shift-clicking between action bar and inventory
+
+ Be sure to choose only ONE of the following implementations!!!
+ */
+ /**
+ * Implementation number 1: Shift-click into your custom inventory
+ */
+ if (index >= INV_START)
+ {
+ // place in custom inventory
+ if (!this.mergeItemStack(itemstack1, 0, INV_START, false))
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Implementation number 2: Shift-click items between action bar and inventory
+ */
+ // item is in player's inventory, but not in action bar
+ if ((index >= INV_START) && (index < HOTBAR_START))
+ {
+ // place in action bar
+ if (!this.mergeItemStack(itemstack1, HOTBAR_START, HOTBAR_END+1, false))
+ {
+ return null;
+ }
+ }
+ // item in action bar - place in player inventory
+ else if ((index >= HOTBAR_START) && (index < (HOTBAR_END+1)))
+ {
+ if (!this.mergeItemStack(itemstack1, INV_START, INV_END+1, false))
+ {
+ return null;
+ }
+ }
+ }
+
+ if (itemstack1.stackSize == 0)
+ {
+ slot.putStack((ItemStack) null);
+ }
+ else
+ {
+ slot.onSlotChanged();
+ }
+
+ if (itemstack1.stackSize == itemstack.stackSize)
+ {
+ return null;
+ }
+
+ slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
+ }
+
+ return itemstack;
+ }
+
+ /**
+ * You should override this method to prevent the player from moving the stack that
+ * opened the inventory, otherwise if the player moves it, the inventory will not
+ * be able to save properly
+ */
+ @Override
+ public ItemStack slotClick(final int slot, final int button, final int flag, final EntityPlayer player) {
+ // this will prevent the player from interacting with the item that opened the inventory:
+ if ((slot >= 0) && (this.getSlot(slot) != null) && (this.getSlot(slot).getStack() == player.getHeldItem())) {
+ return null;
+ }
+ return super.slotClick(slot, button, flag, player);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/container/Container_CircuitProgrammer.java b/src/main/java/gtPlusPlus/core/container/Container_CircuitProgrammer.java
new file mode 100644
index 0000000000..d8ce521fb5
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/container/Container_CircuitProgrammer.java
@@ -0,0 +1,190 @@
+package gtPlusPlus.core.container;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.inventories.InventoryCircuitProgrammer;
+import gtPlusPlus.core.slots.SlotIntegratedCircuit;
+import gtPlusPlus.core.slots.SlotNoInput;
+import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer;
+
+public class Container_CircuitProgrammer extends Container {
+
+ protected TileEntityCircuitProgrammer tile_entity;
+ public final InventoryCircuitProgrammer inventoryChest;
+
+ private final World worldObj;
+ private final int posX;
+ private final int posY;
+ private final int posZ;
+
+ public static final int SLOT_OUTPUT = 25;
+
+ public static int StorageSlotNumber = 26; // Number of slots in storage area
+ public static int InventorySlotNumber = 36; // Inventory Slots (Inventory
+ // and Hotbar)
+ public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All
+ // slots
+
+ public Container_CircuitProgrammer(final InventoryPlayer inventory, final TileEntityCircuitProgrammer te) {
+ this.tile_entity = te;
+ this.inventoryChest = te.getInventory();
+
+ int var6;
+ int var7;
+ this.worldObj = te.getWorldObj();
+ this.posX = te.xCoord;
+ this.posY = te.yCoord;
+ this.posZ = te.zCoord;
+ Logger.INFO("1");
+
+ int o = 0;
+
+ // Storage Side
+ /*for (var6 = 0; var6 < 3; var6++) {
+ for (var7 = 0; var7 < 5; var7++) {
+ this.addSlotToContainer(new SlotIntegratedCircuit(o, this.inventoryChest, o, 44 + (var7 * 18), 15 + (var6 * 18)));
+ o++;
+ }
+ }*/
+
+
+ int xStart = 8;
+ int yStart = 5;
+
+ try {
+ //0
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart, yStart));
+ //1-10
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+18));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+18));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+18));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+18));
+ //11-20
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+18));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+18));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+36));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+36));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+36));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+36));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+36));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+36));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+54));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+54));
+ //21-24
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+54));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+54));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+54));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+54));
+ Logger.INFO("2");
+
+ //Add Output
+ this.addSlotToContainer(new SlotNoInput(this.inventoryChest, SLOT_OUTPUT, xStart+(8*18), yStart+54));
+ o++;
+ Logger.INFO("3");
+
+
+
+ // Player Inventory
+ for (var6 = 0; var6 < 3; ++var6) {
+ for (var7 = 0; var7 < 9; ++var7) {
+ this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18)));
+ }
+ }
+ // Player Hotbar
+ for (var6 = 0; var6 < 9; ++var6) {
+ this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142));
+ }
+
+
+
+ Logger.INFO("4");
+ }
+ catch (Throwable t) {}
+
+ }
+
+ @Override
+ public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold,
+ final EntityPlayer aPlayer) {
+
+ if (!aPlayer.worldObj.isRemote) {
+ if ((aSlotIndex == 999) || (aSlotIndex == -999)) {
+ // Utils.LOG_WARNING("??? - "+aSlotIndex);
+ }
+ }
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+
+ @Override
+ public void onContainerClosed(final EntityPlayer par1EntityPlayer) {
+ super.onContainerClosed(par1EntityPlayer);
+ }
+
+ @Override
+ public boolean canInteractWith(final EntityPlayer par1EntityPlayer) {
+ if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockCircuitProgrammer) {
+ return false;
+ }
+
+ return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D;
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) {
+ ItemStack var3 = null;
+ final Slot var4 = (Slot) this.inventorySlots.get(par2);
+
+ if ((var4 != null) && var4.getHasStack()) {
+ final ItemStack var5 = var4.getStack();
+ var3 = var5.copy();
+
+ /*
+ * if (par2 == 0) { if (!this.mergeItemStack(var5,
+ * InOutputSlotNumber, FullSlotNumber, true)) { return null; }
+ *
+ * var4.onSlotChange(var5, var3); } else if (par2 >=
+ * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if
+ * (!this.mergeItemStack(var5, InventoryOutSlotNumber,
+ * FullSlotNumber, false)) { return null; } } else if (par2 >=
+ * InventoryOutSlotNumber && par2 < FullSlotNumber) { if
+ * (!this.mergeItemStack(var5, InOutputSlotNumber,
+ * InventoryOutSlotNumber, false)) { return null; } } else if
+ * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber,
+ * false)) { return null; }
+ */
+
+ if (var5.stackSize == 0) {
+ var4.putStack((ItemStack) null);
+ } else {
+ var4.onSlotChanged();
+ }
+
+ if (var5.stackSize == var3.stackSize) {
+ return null;
+ }
+
+ var4.onPickupFromSlot(par1EntityPlayer, var5);
+ }
+
+ return var3;
+ }
+
+ // Can merge Slot
+ @Override
+ public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) {
+ return super.func_94530_a(p_94530_1_, p_94530_2_);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/container/Container_DecayablesChest.java b/src/main/java/gtPlusPlus/core/container/Container_DecayablesChest.java
new file mode 100644
index 0000000000..5bc384cd29
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/container/Container_DecayablesChest.java
@@ -0,0 +1,140 @@
+package gtPlusPlus.core.container;
+
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.inventories.Inventory_DecayablesChest;
+import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+public class Container_DecayablesChest extends Container {
+
+ protected TileEntityDecayablesChest tile_entity;
+ public final Inventory_DecayablesChest inventoryChest;
+
+ private final World worldObj;
+ private final int posX;
+ private final int posY;
+ private final int posZ;
+
+ public static int StorageSlotNumber = 15; // Number of slots in storage area
+ public static int InventorySlotNumber = 36; // Inventory Slots (Inventory
+ // and Hotbar)
+ public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All
+ // slots
+
+ private final int[] slotStorage = new int[15];
+
+ public Container_DecayablesChest(final InventoryPlayer inventory, final TileEntityDecayablesChest te) {
+ this.tile_entity = te;
+ this.inventoryChest = te.getInventory();
+ te.openInventory();
+
+ int var6;
+ int var7;
+ this.worldObj = te.getWorldObj();
+ this.posX = te.xCoord;
+ this.posY = te.yCoord;
+ this.posZ = te.zCoord;
+
+ int o = 0;
+
+ // Storage Side
+ for (var6 = 0; var6 < 3; var6++) {
+ for (var7 = 0; var7 < 5; var7++) {
+ this.slotStorage[o] = o;
+ this.addSlotToContainer(new Slot(this.inventoryChest, o++, 44 + (var7 * 18), 15 + (var6 * 18)));
+ }
+ }
+
+ // Player Inventory
+ for (var6 = 0; var6 < 3; ++var6) {
+ for (var7 = 0; var7 < 9; ++var7) {
+ this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18)));
+ }
+ }
+
+ // Player Hotbar
+ for (var6 = 0; var6 < 9; ++var6) {
+ this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142));
+ }
+
+ }
+
+ @Override
+ public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold,
+ final EntityPlayer aPlayer) {
+
+ if (!aPlayer.worldObj.isRemote) {
+ if ((aSlotIndex == 999) || (aSlotIndex == -999)) {
+ // Utils.LOG_WARNING("??? - "+aSlotIndex);
+ }
+ }
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+
+ @Override
+ public void onContainerClosed(final EntityPlayer par1EntityPlayer) {
+ super.onContainerClosed(par1EntityPlayer);
+ tile_entity.closeInventory();
+ }
+
+ @Override
+ public boolean canInteractWith(final EntityPlayer par1EntityPlayer) {
+ if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockDecayablesChest) {
+ return false;
+ }
+
+ return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D;
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) {
+ ItemStack var3 = null;
+ final Slot var4 = (Slot) this.inventorySlots.get(par2);
+
+ if ((var4 != null) && var4.getHasStack()) {
+ final ItemStack var5 = var4.getStack();
+ var3 = var5.copy();
+
+ /*
+ * if (par2 == 0) { if (!this.mergeItemStack(var5,
+ * InOutputSlotNumber, FullSlotNumber, true)) { return null; }
+ *
+ * var4.onSlotChange(var5, var3); } else if (par2 >=
+ * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if
+ * (!this.mergeItemStack(var5, InventoryOutSlotNumber,
+ * FullSlotNumber, false)) { return null; } } else if (par2 >=
+ * InventoryOutSlotNumber && par2 < FullSlotNumber) { if
+ * (!this.mergeItemStack(var5, InOutputSlotNumber,
+ * InventoryOutSlotNumber, false)) { return null; } } else if
+ * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber,
+ * false)) { return null; }
+ */
+
+ if (var5.stackSize == 0) {
+ var4.putStack((ItemStack) null);
+ } else {
+ var4.onSlotChanged();
+ }
+
+ if (var5.stackSize == var3.stackSize) {
+ return null;
+ }
+
+ var4.onPickupFromSlot(par1EntityPlayer, var5);
+ }
+
+ return var3;
+ }
+
+ // Can merge Slot
+ @Override
+ public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) {
+ return super.func_94530_a(p_94530_1_, p_94530_2_);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/container/Container_EggBox.java b/src/main/java/gtPlusPlus/core/container/Container_EggBox.java
new file mode 100644
index 0000000000..c4396cca6f
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/container/Container_EggBox.java
@@ -0,0 +1,140 @@
+package gtPlusPlus.core.container;
+
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.inventories.Inventory_EggBox;
+import gtPlusPlus.core.tileentities.general.TileEntityEggBox;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+public class Container_EggBox extends Container {
+
+ protected TileEntityEggBox tile_entity;
+ public final Inventory_EggBox inventoryChest;
+
+ private final World worldObj;
+ private final int posX;
+ private final int posY;
+ private final int posZ;
+
+ public static int StorageSlotNumber = 15; // Number of slots in storage area
+ public static int InventorySlotNumber = 36; // Inventory Slots (Inventory
+ // and Hotbar)
+ public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All
+ // slots
+
+ private final int[] slotStorage = new int[15];
+
+ public Container_EggBox(final InventoryPlayer inventory, final TileEntityEggBox te) {
+ this.tile_entity = te;
+ this.inventoryChest = te.getInventory();
+ te.openInventory();
+
+ int var6;
+ int var7;
+ this.worldObj = te.getWorldObj();
+ this.posX = te.xCoord;
+ this.posY = te.yCoord;
+ this.posZ = te.zCoord;
+
+ int o = 0;
+
+ // Storage Side
+ for (var6 = 0; var6 < 3; var6++) {
+ for (var7 = 0; var7 < 5; var7++) {
+ this.slotStorage[o] = o;
+ this.addSlotToContainer(new Slot(this.inventoryChest, o++, 44 + (var7 * 18), 15 + (var6 * 18)));
+ }
+ }
+
+ // Player Inventory
+ for (var6 = 0; var6 < 3; ++var6) {
+ for (var7 = 0; var7 < 9; ++var7) {
+ this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18)));
+ }
+ }
+
+ // Player Hotbar
+ for (var6 = 0; var6 < 9; ++var6) {
+ this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142));
+ }
+
+ }
+
+ @Override
+ public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold,
+ final EntityPlayer aPlayer) {
+
+ if (!aPlayer.worldObj.isRemote) {
+ if ((aSlotIndex == 999) || (aSlotIndex == -999)) {
+ // Utils.LOG_WARNING("??? - "+aSlotIndex);
+ }
+ }
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+
+ @Override
+ public void onContainerClosed(final EntityPlayer par1EntityPlayer) {
+ super.onContainerClosed(par1EntityPlayer);
+ tile_entity.closeInventory();
+ }
+
+ @Override
+ public boolean canInteractWith(final EntityPlayer par1EntityPlayer) {
+ if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockEggBox) {
+ return false;
+ }
+
+ return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D;
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) {
+ ItemStack var3 = null;
+ final Slot var4 = (Slot) this.inventorySlots.get(par2);
+
+ if ((var4 != null) && var4.getHasStack()) {
+ final ItemStack var5 = var4.getStack();
+ var3 = var5.copy();
+
+ /*
+ * if (par2 == 0) { if (!this.mergeItemStack(var5,
+ * InOutputSlotNumber, FullSlotNumber, true)) { return null; }
+ *
+ * var4.onSlotChange(var5, var3); } else if (par2 >=
+ * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if
+ * (!this.mergeItemStack(var5, InventoryOutSlotNumber,
+ * FullSlotNumber, false)) { return null; } } else if (par2 >=
+ * InventoryOutSlotNumber && par2 < FullSlotNumber) { if
+ * (!this.mergeItemStack(var5, InOutputSlotNumber,
+ * InventoryOutSlotNumber, false)) { return null; } } else if
+ * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber,
+ * false)) { return null; }
+ */
+
+ if (var5.stackSize == 0) {
+ var4.putStack((ItemStack) null);
+ } else {
+ var4.onSlotChanged();
+ }
+
+ if (var5.stackSize == var3.stackSize) {
+ return null;
+ }
+
+ var4.onPickupFromSlot(par1EntityPlayer, var5);
+ }
+
+ return var3;
+ }
+
+ // Can merge Slot
+ @Override
+ public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) {
+ return super.func_94530_a(p_94530_1_, p_94530_2_);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/container/Container_FishTrap.java b/src/main/java/gtPlusPlus/core/container/Container_FishTrap.java
new file mode 100644
index 0000000000..a2f44441d9
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/container/Container_FishTrap.java
@@ -0,0 +1,142 @@
+package gtPlusPlus.core.container;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.inventories.InventoryFishTrap;
+import gtPlusPlus.core.slots.SlotNoInput;
+import gtPlusPlus.core.tileentities.general.TileEntityFishTrap;
+
+public class Container_FishTrap extends Container {
+
+ protected TileEntityFishTrap tile_entity;
+ public final InventoryFishTrap inventoryChest;
+
+ private final World worldObj;
+ private final int posX;
+ private final int posY;
+ private final int posZ;
+
+ public static int StorageSlotNumber = 15; // Number of slots in storage area
+ public static int InventorySlotNumber = 36; // Inventory Slots (Inventory
+ // and Hotbar)
+ public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All
+ // slots
+
+ private final int[] slotStorage = new int[15];
+
+ public Container_FishTrap(final InventoryPlayer inventory, final TileEntityFishTrap te) {
+ this.tile_entity = te;
+ this.inventoryChest = te.getInventory();
+
+ te.openInventory();
+ int var6;
+ int var7;
+ this.worldObj = te.getWorldObj();
+ this.posX = te.xCoord;
+ this.posY = te.yCoord;
+ this.posZ = te.zCoord;
+
+ int o = 0;
+
+ // Storage Side
+ for (var6 = 0; var6 < 3; var6++) {
+ for (var7 = 0; var7 < 5; var7++) {
+ this.slotStorage[o] = o;
+ this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, 44 + (var7 * 18), 15 + (var6 * 18)));
+ }
+ }
+
+ // Player Inventory
+ for (var6 = 0; var6 < 3; ++var6) {
+ for (var7 = 0; var7 < 9; ++var7) {
+ this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18)));
+ }
+ }
+
+ // Player Hotbar
+ for (var6 = 0; var6 < 9; ++var6) {
+ this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142));
+ }
+
+ }
+
+ @Override
+ public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold,
+ final EntityPlayer aPlayer) {
+
+ if (!aPlayer.worldObj.isRemote) {
+ if ((aSlotIndex == 999) || (aSlotIndex == -999)) {
+ // Utils.LOG_WARNING("??? - "+aSlotIndex);
+ }
+ }
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+
+ @Override
+ public void onContainerClosed(final EntityPlayer par1EntityPlayer) {
+ super.onContainerClosed(par1EntityPlayer);
+ tile_entity.closeInventory();
+ }
+
+ @Override
+ public boolean canInteractWith(final EntityPlayer par1EntityPlayer) {
+ if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockFishTrap) {
+ return false;
+ }
+
+ return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D;
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) {
+ ItemStack var3 = null;
+ final Slot var4 = (Slot) this.inventorySlots.get(par2);
+
+ if ((var4 != null) && var4.getHasStack()) {
+ final ItemStack var5 = var4.getStack();
+ var3 = var5.copy();
+
+ /*
+ * if (par2 == 0) { if (!this.mergeItemStack(var5,
+ * InOutputSlotNumber, FullSlotNumber, true)) { return null; }
+ *
+ * var4.onSlotChange(var5, var3); } else if (par2 >=
+ * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if
+ * (!this.mergeItemStack(var5, InventoryOutSlotNumber,
+ * FullSlotNumber, false)) { return null; } } else if (par2 >=
+ * InventoryOutSlotNumber && par2 < FullSlotNumber) { if
+ * (!this.mergeItemStack(var5, InOutputSlotNumber,
+ * InventoryOutSlotNumber, false)) { return null; } } else if
+ * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber,
+ * false)) { return null; }
+ */
+
+ if (var5.stackSize == 0) {
+ var4.putStack((ItemStack) null);
+ } else {
+ var4.onSlotChanged();
+ }
+
+ if (var5.stackSize == var3.stackSize) {
+ return null;
+ }
+
+ var4.onPickupFromSlot(par1EntityPlayer, var5);
+ }
+
+ return var3;
+ }
+
+ // Can merge Slot
+ @Override
+ public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) {
+ return super.func_94530_a(p_94530_1_, p_94530_2_);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/container/Container_Grindle.java b/src/main/java/gtPlusPlus/core/container/Container_Grindle.java
new file mode 100644
index 0000000000..4ab79322c9
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/container/Container_Grindle.java
@@ -0,0 +1,160 @@
+package gtPlusPlus.core.container;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+import gtPlusPlus.core.inventories.BaseInventoryGrindle;
+import gtPlusPlus.core.slots.SlotDataStick;
+
+public class Container_Grindle extends Container {
+ /**
+ * The Item Inventory for this Container, only needed if you want to reference
+ * isUseableByPlayer
+ */
+ public final BaseInventoryGrindle inventory;
+