@Override public void update() { super.update(); if (!hasElement() && !inventory.isEmpty()) { int slot = inventory.getFirstValidSlot(); ItemStack stack = inventory.getStackInSlot(slot); setElement(BlockData.rod); if (stack.stackTagCompound != null) { getPElementTile().readFromNBT(stack.stackTagCompound); } if (!tileEntity.getWorldObj().isRemote) { inventory.decrStackSize(slot, 1); } } }
@Override public void writeToNBT(NBTTagCompound tagCompound) { super.writeToNBT(tagCompound); inventory.writeToNBT(tagCompound); }
public void transferElementToInventory() { if (!tileEntity.getWorldObj().isRemote) { inventory.addStackToInventory(getElementStack()); } }
public boolean canTransfer() { ItemStack stack = getElementStack(); if (CompareUtil.compareIDs(stack, ItemData.rod.item)) { return inventory.canInsert(getElementStack()); } else return false; }
@Override public void readFromNBT(NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); inventory.readFromNBT(tagCompound); }