    001package net.minecraft.network.packet;
    002
    003import java.io.DataInputStream;
    004import java.io.DataOutputStream;
    005import java.io.IOException;
    006
    007public class Packet30Entity extends Packet
    008{
    009    /** The ID of this entity. */
    010    public int entityId;
    011
    012    /** The X axis relative movement. */
    013    public byte xPosition;
    014
    015    /** The Y axis relative movement. */
    016    public byte yPosition;
    017
    018    /** The Z axis relative movement. */
    019    public byte zPosition;
    020
    021    /** The X axis rotation. */
    022    public byte yaw;
    023
    024    /** The Y axis rotation. */
    025    public byte pitch;
    026
    027    /** Boolean set to true if the entity is rotating. */
    028    public boolean rotating = false;
    029
    030    public Packet30Entity() {}
    031
    032    public Packet30Entity(int par1)
    033    {
    034        this.entityId = par1;
    035    }
    036
    037    /**
    038     * Abstract. Reads the raw packet data from the data stream.
    039     */
    040    public void readPacketData(DataInputStream par1DataInputStream) throws IOException
    041    {
    042        this.entityId = par1DataInputStream.readInt();
    043    }
    044
    045    /**
    046     * Abstract. Writes the raw packet data to the data stream.
    047     */
    048    public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
    049    {
    050        par1DataOutputStream.writeInt(this.entityId);
    051    }
    052
    053    /**
    054     * Passes this Packet on to the NetHandler for processing.
    055     */
    056    public void processPacket(NetHandler par1NetHandler)
    057    {
    058        par1NetHandler.handleEntity(this);
    059    }
    060
    061    /**
    062     * Abstract. Return the size of the packet (not counting the header).
    063     */
    064    public int getPacketSize()
    065    {
    066        return 4;
    067    }
    068
    069    public String toString()
    070    {
    071        return "Entity_" + super.toString();
    072    }
    073
    074    /**
    075     * only false for the abstract Packet class, all real packets return true
    076     */
    077    public boolean isRealPacket()
    078    {
    079        return true;
    080    }
    081
    082    /**
    083     * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet
    084     * class
    085     */
    086    public boolean containsSameEntityIDAs(Packet par1Packet)
    087    {
    088        Packet30Entity packet30entity = (Packet30Entity)par1Packet;
    089        return packet30entity.entityId == this.entityId;
    090    }
    091}