package common.packet;

import java.io.IOException;

import common.network.PacketBuffer;

public class CPacketPlayerPosLook extends CPacketPlayer
{
    public CPacketPlayerPosLook()
    {
        this.moving = true;
        this.rotating = true;
    }

    public CPacketPlayerPosLook(double playerX, double playerY, double playerZ, float playerYaw, float playerPitch, boolean playerIsOnGround)
    {
        this.x = playerX;
        this.y = playerY;
        this.z = playerZ;
        this.yaw = playerYaw;
        this.pitch = playerPitch;
        this.onGround = playerIsOnGround;
        this.rotating = true;
        this.moving = true;
    }

    public void readPacketData(PacketBuffer buf) throws IOException
    {
        this.x = buf.readDouble();
        this.y = buf.readDouble();
        this.z = buf.readDouble();
        this.yaw = buf.readFloat();
        this.pitch = buf.readFloat();
        super.readPacketData(buf);
    }

    public void writePacketData(PacketBuffer buf) throws IOException
    {
        buf.writeDouble(this.x);
        buf.writeDouble(this.y);
        buf.writeDouble(this.z);
        buf.writeFloat(this.yaw);
        buf.writeFloat(this.pitch);
        super.writePacketData(buf);
    }
}