package common.packet;

import java.io.IOException;

import common.entity.Entity;
import common.network.IClientPlayer;
import common.network.Packet;
import common.network.PacketBuffer;
import common.world.World;

public class SPacketCamera implements Packet<IClientPlayer>
{
    public int entityId;

    public SPacketCamera()
    {
    }

    public SPacketCamera(Entity entityIn)
    {
        this.entityId = entityIn.getId();
    }
    
    public void readPacketData(PacketBuffer buf) throws IOException
    {
        this.entityId = buf.readVarIntFromBuffer();
    }
    
    public void writePacketData(PacketBuffer buf) throws IOException
    {
        buf.writeVarIntToBuffer(this.entityId);
    }
    
    public void processPacket(IClientPlayer handler)
    {
        handler.handleCamera(this);
    }

    public Entity getEntity(World worldIn)
    {
        return worldIn.getEntityByID(this.entityId);
    }
}
