2013-07-26 21:18:53 -07:00
|
|
|
package tconstruct.inventory;
|
|
|
|
|
|
|
|
|
|
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;
|
2014-02-16 14:23:50 -05:00
|
|
|
import tconstruct.blocks.logic.StencilTableLogic;
|
2013-07-26 21:18:53 -07:00
|
|
|
|
|
|
|
|
public class PatternShaperContainer extends Container
|
|
|
|
|
{
|
|
|
|
|
public StencilTableLogic logic;
|
|
|
|
|
|
|
|
|
|
public PatternShaperContainer(InventoryPlayer inventoryplayer, StencilTableLogic shaper)
|
|
|
|
|
{
|
|
|
|
|
logic = shaper;
|
|
|
|
|
this.addSlotToContainer(new Slot(shaper, 0, 48, 35));
|
|
|
|
|
this.addSlotToContainer(new SlotOnlyTake(shaper, 1, 106, 35));
|
2014-02-16 14:23:50 -05:00
|
|
|
/*
|
|
|
|
|
* for (int i = 0; i < 3; i++) { for (int l = 0; l < 3; l++) {
|
|
|
|
|
* this.addSlotToContainer(new Slot(craftMatrix, l + i * 3, 30 + l * 18,
|
|
|
|
|
* 17 + i * 18)); } }
|
|
|
|
|
*/
|
2013-07-26 21:18:53 -07:00
|
|
|
|
|
|
|
|
/* Player inventory */
|
|
|
|
|
for (int column = 0; column < 3; column++)
|
|
|
|
|
{
|
|
|
|
|
for (int row = 0; row < 9; row++)
|
|
|
|
|
{
|
|
|
|
|
this.addSlotToContainer(new Slot(inventoryplayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int column = 0; column < 9; column++)
|
|
|
|
|
{
|
|
|
|
|
this.addSlotToContainer(new Slot(inventoryplayer, column, 8 + column * 18, 142));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-16 14:23:50 -05:00
|
|
|
/*
|
|
|
|
|
* public void onCraftMatrixChanged(IInventory iinventory) {
|
|
|
|
|
* craftResult.setInventorySlotContents(0,
|
|
|
|
|
* CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj));
|
|
|
|
|
* }
|
|
|
|
|
*/
|
2013-07-26 21:18:53 -07:00
|
|
|
|
2014-02-16 14:23:50 -05:00
|
|
|
/*
|
|
|
|
|
* @Override public void onContainerClosed(EntityPlayer entityplayer) {
|
|
|
|
|
* super.onContainerClosed(entityplayer); if (logic.worldObj.isRemote) {
|
|
|
|
|
* return; } ItemStack itemstack = logic.getStackInSlot(0); if (itemstack !=
|
|
|
|
|
* null) { entityplayer.dropPlayerItem(itemstack); } }
|
|
|
|
|
*/
|
2013-07-26 21:18:53 -07:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean canInteractWith (EntityPlayer entityplayer)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ItemStack transferStackInSlot (EntityPlayer player, int slotID)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
2014-02-16 14:23:50 -05:00
|
|
|
/*
|
|
|
|
|
* ItemStack stack = null; Slot slot =
|
|
|
|
|
* (Slot)this.inventorySlots.get(slotID);
|
|
|
|
|
*
|
|
|
|
|
* if (slot != null && slot.getHasStack()) { ItemStack slotStack =
|
|
|
|
|
* slot.getStack(); stack = slotStack.copy();
|
|
|
|
|
*
|
|
|
|
|
* if (slotID < logic.getSizeInventory()) { if
|
|
|
|
|
* (!this.mergeItemStack(slotStack, logic.getSizeInventory(),
|
|
|
|
|
* this.inventorySlots.size(), true)) { return null; } } else if
|
|
|
|
|
* (!this.mergeItemStack(slotStack, 0, logic.getSizeInventory()-1,
|
|
|
|
|
* false)) { return null; }
|
|
|
|
|
*
|
|
|
|
|
* if (slotStack.stackSize == 0) { slot.putStack((ItemStack)null); }
|
|
|
|
|
* else { slot.onSlotChanged(); } }
|
|
|
|
|
*
|
|
|
|
|
* return stack;
|
|
|
|
|
*/
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
|
|
|
|
|
2014-02-15 00:29:24 -05:00
|
|
|
}
|