Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.khufu.stonetitans.gui.container;
- import com.khufu.stonetitans.entity.EntityClone;
- import com.khufu.stonetitans.inventory.InventoryClone;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.entity.player.InventoryPlayer;
- import net.minecraft.inventory.Container;
- import net.minecraft.inventory.IInventory;
- import net.minecraft.inventory.Slot;
- import net.minecraft.item.ItemStack;
- import net.minecraft.world.World;
- public class ContainerClone extends Container {
- private IInventory lowerChestInventory;
- private int numRows;
- public ContainerClone(InventoryPlayer inventory, InventoryClone c_inventory) {
- this.lowerChestInventory = c_inventory;
- this.numRows = c_inventory.getSizeInventory() / 9;
- c_inventory.openInventory();
- int i = (this.numRows - 4) * 18;
- int j;
- int k;
- for (j = 0; j < 3; ++j) {
- for (k = 0; k < 9; ++k) {
- this.addSlotToContainer(new Slot(c_inventory, k + j * 9 + 9, 8 + k * 18, 18 + j * 18 + i));
- }
- }
- for (j = 0; j < 9; ++j) {
- this.addSlotToContainer(new Slot(c_inventory, j, 8 + j * 18, 77 + i));
- }
- for (j = 0; j < 3; ++j) {
- for (k = 0; k < 9; ++k) {
- this.addSlotToContainer(new Slot(inventory, k + j * 9 + 9, 8 + k * 18, 103 + j * 18 + i));
- }
- }
- for (j = 0; j < 9; ++j) {
- this.addSlotToContainer(new Slot(inventory, j, 8 + j * 18, 161 + i));
- }
- }
- public ContainerClone(InventoryClone inventory, boolean b, EntityClone entityClone) {
- // TODO Auto-generated constructor stub
- }
- public boolean canInteractWith(EntityPlayer p_75145_1_) {
- return this.lowerChestInventory.isUseableByPlayer(p_75145_1_);
- }
- @Override
- public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_)
- {
- ItemStack itemstack = null;
- Slot slot = (Slot)this.inventorySlots.get(p_82846_2_);
- if (slot != null && slot.getHasStack())
- {
- ItemStack itemstack1 = slot.getStack();
- itemstack = itemstack1.copy();
- if (p_82846_2_ < this.numRows * 9)
- {
- if (!this.mergeItemStack(itemstack1, this.numRows * 9, this.inventorySlots.size(), true))
- {
- return null;
- }
- }
- else if (!this.mergeItemStack(itemstack1, 0, this.numRows * 9, false))
- {
- return null;
- }
- if (itemstack1.stackSize == 0)
- {
- slot.putStack((ItemStack)null);
- }
- else
- {
- slot.onSlotChanged();
- }
- }
- return itemstack;
- }
- public void onContainerClosed(EntityPlayer p_75134_1_) {
- super.onContainerClosed(p_75134_1_);
- this.lowerChestInventory.closeInventory();
- }
- public IInventory getLowerChestInventory() {
- return this.lowerChestInventory;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement