@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); }
@Override public void readFromNBT(NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); inventory.readFromNBT(tagCompound); }