    001package net.minecraft.network.packet;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import java.io.DataInputStream;
    006import java.io.DataOutputStream;
    007import java.io.IOException;
    008
    009public class Packet10Flying extends Packet
    010{
    011    /** The player's X position. */
    012    public double xPosition;
    013
    014    /** The player's Y position. */
    015    public double yPosition;
    016
    017    /** The player's Z position. */
    018    public double zPosition;
    019
    020    /** The player's stance. (boundingBox.minY) */
    021    public double stance;
    022
    023    /** The player's yaw rotation. */
    024    public float yaw;
    025
    026    /** The player's pitch rotation. */
    027    public float pitch;
    028
    029    /** True if the client is on the ground. */
    030    public boolean onGround;
    031
    032    /** Boolean set to true if the player is moving. */
    033    public boolean moving;
    034
    035    /** Boolean set to true if the player is rotating. */
    036    public boolean rotating;
    037
    038    public Packet10Flying() {}
    039
    040    @SideOnly(Side.CLIENT)
    041    public Packet10Flying(boolean par1)
    042    {
    043        this.onGround = par1;
    044    }
    045
    046    /**
    047     * Passes this Packet on to the NetHandler for processing.
    048     */
    049    public void processPacket(NetHandler par1NetHandler)
    050    {
    051        par1NetHandler.handleFlying(this);
    052    }
    053
    054    /**
    055     * Abstract. Reads the raw packet data from the data stream.
    056     */
    057    public void readPacketData(DataInputStream par1DataInputStream) throws IOException
    058    {
    059        this.onGround = par1DataInputStream.read() != 0;
    060    }
    061
    062    /**
    063     * Abstract. Writes the raw packet data to the data stream.
    064     */
    065    public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
    066    {
    067        par1DataOutputStream.write(this.onGround ? 1 : 0);
    068    }
    069
    070    /**
    071     * Abstract. Return the size of the packet (not counting the header).
    072     */
    073    public int getPacketSize()
    074    {
    075        return 1;
    076    }
    077
    078    /**
    079     * only false for the abstract Packet class, all real packets return true
    080     */
    081    public boolean isRealPacket()
    082    {
    083        return true;
    084    }
    085
    086    /**
    087     * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet
    088     * class
    089     */
    090    public boolean containsSameEntityIDAs(Packet par1Packet)
    091    {
    092        return true;
    093    }
    094}