    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 net.minecraft.entity.Entity;
    009
    010    public class Packet19EntityAction extends Packet
    011    {
    012        /** Player ID. */
    013        public int entityId;
    014
    015        /** 1=sneak, 2=normal */
    016        public int state;
    017
    018        public Packet19EntityAction() {}
    019
    020        @SideOnly(Side.CLIENT)
    021        public Packet19EntityAction(Entity par1Entity, int par2)
    022        {
    023            this.entityId = par1Entity.entityId;
    024            this.state = par2;
    025        }
    026
    027        /**
    028         * Abstract. Reads the raw packet data from the data stream.
    029         */
    030        public void readPacketData(DataInputStream par1DataInputStream) throws IOException
    031        {
    032            this.entityId = par1DataInputStream.readInt();
    033            this.state = par1DataInputStream.readByte();
    034        }
    035
    036        /**
    037         * Abstract. Writes the raw packet data to the data stream.
    038         */
    039        public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
    040        {
    041            par1DataOutputStream.writeInt(this.entityId);
    042            par1DataOutputStream.writeByte(this.state);
    043        }
    044
    045        /**
    046         * Passes this Packet on to the NetHandler for processing.
    047         */
    048        public void processPacket(NetHandler par1NetHandler)
    049        {
    050            par1NetHandler.handleEntityAction(this);
    051        }
    052
    053        /**
    054         * Abstract. Return the size of the packet (not counting the header).
    055         */
    056        public int getPacketSize()
    057        {
    058            return 5;
    059        }
    060    }