@Override public ItemStack slotClick(int slot, int button, int flag, EntityPlayer player) { if (slot == 0 && tile.getStackInSlot(slot) != null) { if (!player.worldObj.isRemote) { tile.setInventorySlotContents(slot, null); tile.checkLockAndUpdate(); this.detectAndSendChanges(); } return null; } return super.slotClick(slot, button, flag, player); }
public CondenserContainer(InventoryPlayer invPlayer, CondenserTile condenser) { tile = condenser; tile.openInventory(); // Item Lock Slot this.addSlotToContainer(new SlotCondenserLock(this, 0, 12, 6)); // Condenser Inventory for (int i = 0; i < 7; i++) for (int j = 0; j < 13; j++) this.addSlotToContainer( new SlotCondenserInput(tile, 1 + j + i * 13, 12 + j * 18, 26 + i * 18)); // Player Inventory for (int i = 0; i < 3; i++) for (int j = 0; j < 9; j++) this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 48 + j * 18, 154 + i * 18)); // Player Hotbar for (int i = 0; i < 9; i++) this.addSlotToContainer(new Slot(invPlayer, i, 48 + i * 18, 212)); }
@Override public void onContainerClosed(EntityPlayer player) { super.onContainerClosed(player); tile.closeInventory(); }