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