    001    package net.minecraft.src;
    002
    003    public class TileEntityRecordPlayer extends TileEntity
    004    {
    005        /** ID of record which is in Jukebox */
    006        public ItemStack record;
    007
    008        /**
    009         * Reads a tile entity from NBT.
    010         */
    011        public void readFromNBT(NBTTagCompound par1NBTTagCompound)
    012        {
    013            super.readFromNBT(par1NBTTagCompound);
    014
    015            if (par1NBTTagCompound.hasKey("RecordItem"))
    016            {
    017                this.record = ItemStack.loadItemStackFromNBT(par1NBTTagCompound.getCompoundTag("RecordItem"));
    018            }
    019            else
    020            {
    021                this.record = new ItemStack(par1NBTTagCompound.getInteger("Record"), 1, 0);
    022            }
    023        }
    024
    025        /**
    026         * Writes a tile entity to NBT.
    027         */
    028        public void writeToNBT(NBTTagCompound par1NBTTagCompound)
    029        {
    030            super.writeToNBT(par1NBTTagCompound);
    031
    032            if (this.record != null)
    033            {
    034                par1NBTTagCompound.setCompoundTag("RecordItem", this.record.writeToNBT(new NBTTagCompound()));
    035                par1NBTTagCompound.setInteger("Record", this.record.itemID);
    036            }
    037        }
    038    }