    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005
    006    public class TileEntitySkull extends TileEntity
    007    {
    008        /** Entity type for this skull. */
    009        private int skullType;
    010
    011        /** The skull's rotation. */
    012        private int skullRotation;
    013
    014        /** Extra data for this skull, used as player username by player heads */
    015        private String extraType = "";
    016
    017        /**
    018         * Writes a tile entity to NBT.
    019         */
    020        public void writeToNBT(NBTTagCompound par1NBTTagCompound)
    021        {
    022            super.writeToNBT(par1NBTTagCompound);
    023            par1NBTTagCompound.setByte("SkullType", (byte)(this.skullType & 255));
    024            par1NBTTagCompound.setByte("Rot", (byte)(this.skullRotation & 255));
    025            par1NBTTagCompound.setString("ExtraType", this.extraType);
    026        }
    027
    028        /**
    029         * Reads a tile entity from NBT.
    030         */
    031        public void readFromNBT(NBTTagCompound par1NBTTagCompound)
    032        {
    033            super.readFromNBT(par1NBTTagCompound);
    034            this.skullType = par1NBTTagCompound.getByte("SkullType");
    035            this.skullRotation = par1NBTTagCompound.getByte("Rot");
    036
    037            if (par1NBTTagCompound.hasKey("ExtraType"))
    038            {
    039                this.extraType = par1NBTTagCompound.getString("ExtraType");
    040            }
    041        }
    042
    043        /**
    044         * Overriden in a sign to provide the text.
    045         */
    046        public Packet getDescriptionPacket()
    047        {
    048            NBTTagCompound var1 = new NBTTagCompound();
    049            this.writeToNBT(var1);
    050            return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 4, var1);
    051        }
    052
    053        public void func_82118_a(int par1, String par2Str)
    054        {
    055            this.skullType = par1;
    056            this.extraType = par2Str;
    057        }
    058
    059        public int func_82117_a()
    060        {
    061            return this.skullType;
    062        }
    063
    064        public void func_82116_a(int par1)
    065        {
    066            this.skullRotation = par1;
    067        }
    068
    069        @SideOnly(Side.CLIENT)
    070        public int func_82119_b()
    071        {
    072            return this.skullRotation;
    073        }
    074
    075        public String func_82120_c()
    076        {
    077            return this.extraType;
    078        }
    079    }