    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005    import java.io.DataInputStream;
    006    import java.io.DataOutputStream;
    007    import java.io.IOException;
    008    import java.util.List;
    009
    010    public class Packet40EntityMetadata extends Packet
    011    {
    012        public int entityId;
    013        private List metadata;
    014
    015        public Packet40EntityMetadata() {}
    016
    017        public Packet40EntityMetadata(int par1, DataWatcher par2DataWatcher, boolean par3)
    018        {
    019            this.entityId = par1;
    020
    021            if (par3)
    022            {
    023                this.metadata = par2DataWatcher.func_75685_c();
    024            }
    025            else
    026            {
    027                this.metadata = par2DataWatcher.unwatchAndReturnAllWatched();
    028            }
    029        }
    030
    031        /**
    032         * Abstract. Reads the raw packet data from the data stream.
    033         */
    034        public void readPacketData(DataInputStream par1DataInputStream) throws IOException
    035        {
    036            this.entityId = par1DataInputStream.readInt();
    037            this.metadata = DataWatcher.readWatchableObjects(par1DataInputStream);
    038        }
    039
    040        /**
    041         * Abstract. Writes the raw packet data to the data stream.
    042         */
    043        public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
    044        {
    045            par1DataOutputStream.writeInt(this.entityId);
    046            DataWatcher.writeObjectsInListToStream(this.metadata, par1DataOutputStream);
    047        }
    048
    049        /**
    050         * Passes this Packet on to the NetHandler for processing.
    051         */
    052        public void processPacket(NetHandler par1NetHandler)
    053        {
    054            par1NetHandler.handleEntityMetadata(this);
    055        }
    056
    057        /**
    058         * Abstract. Return the size of the packet (not counting the header).
    059         */
    060        public int getPacketSize()
    061        {
    062            return 5;
    063        }
    064
    065        @SideOnly(Side.CLIENT)
    066        public List getMetadata()
    067        {
    068            return this.metadata;
    069        }
    070    }