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 Packet35EntityHeadRotation extends Packet
008 {
009 public int entityId;
010 public byte headRotationYaw;
011
012 public Packet35EntityHeadRotation() {}
013
014 public Packet35EntityHeadRotation(int par1, byte par2)
015 {
016 this.entityId = par1;
017 this.headRotationYaw = par2;
018 }
019
020 /**
021 * Abstract. Reads the raw packet data from the data stream.
022 */
023 public void readPacketData(DataInputStream par1DataInputStream) throws IOException
024 {
025 this.entityId = par1DataInputStream.readInt();
026 this.headRotationYaw = par1DataInputStream.readByte();
027 }
028
029 /**
030 * Abstract. Writes the raw packet data to the data stream.
031 */
032 public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
033 {
034 par1DataOutputStream.writeInt(this.entityId);
035 par1DataOutputStream.writeByte(this.headRotationYaw);
036 }
037
038 /**
039 * Passes this Packet on to the NetHandler for processing.
040 */
041 public void processPacket(NetHandler par1NetHandler)
042 {
043 par1NetHandler.handleEntityHeadRotation(this);
044 }
045
046 /**
047 * Abstract. Return the size of the packet (not counting the header).
048 */
049 public int getPacketSize()
050 {
051 return 5;
052 }
053
054 /**
055 * only false for the abstract Packet class, all real packets return true
056 */
057 public boolean isRealPacket()
058 {
059 return true;
060 }
061
062 /**
063 * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet
064 * class
065 */
066 public boolean containsSameEntityIDAs(Packet par1Packet)
067 {
068 Packet35EntityHeadRotation var2 = (Packet35EntityHeadRotation)par1Packet;
069 return var2.entityId == this.entityId;
070 }
071
072 /**
073 * if this returns false, processPacket is deffered for processReadPackets to handle
074 */
075 public boolean isWritePacket()
076 {
077 return true;
078 }
079 }