    001package net.minecraft.network.packet;
    002
    003import java.io.DataInputStream;
    004import java.io.DataOutputStream;
    005import java.io.IOException;
    006import net.minecraft.entity.Entity;
    007
    008public class Packet18Animation extends Packet
    009{
    010    /** The entity ID, in this case it's the player ID. */
    011    public int entityId;
    012    public int animate;
    013
    014    public Packet18Animation() {}
    015
    016    public Packet18Animation(Entity par1Entity, int par2)
    017    {
    018        this.entityId = par1Entity.entityId;
    019        this.animate = par2;
    020    }
    021
    022    /**
    023     * Abstract. Reads the raw packet data from the data stream.
    024     */
    025    public void readPacketData(DataInputStream par1DataInputStream) throws IOException
    026    {
    027        this.entityId = par1DataInputStream.readInt();
    028        this.animate = par1DataInputStream.readByte();
    029    }
    030
    031    /**
    032     * Abstract. Writes the raw packet data to the data stream.
    033     */
    034    public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
    035    {
    036        par1DataOutputStream.writeInt(this.entityId);
    037        par1DataOutputStream.writeByte(this.animate);
    038    }
    039
    040    /**
    041     * Passes this Packet on to the NetHandler for processing.
    042     */
    043    public void processPacket(NetHandler par1NetHandler)
    044    {
    045        par1NetHandler.handleAnimation(this);
    046    }
    047
    048    /**
    049     * Abstract. Return the size of the packet (not counting the header).
    050     */
    051    public int getPacketSize()
    052    {
    053        return 5;
    054    }
    055}