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