package net.minecraft.network.protocol.game;

import net.minecraft.network.PacketListener;
import net.minecraft.world.level.Level;
import java.io.IOException;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.Entity;
import net.minecraft.network.protocol.Packet;

public class ClientboundRotateHeadPacket implements Packet<ClientGamePacketListener> {
    private int entityId;
    private byte yHeadRot;
    
    public ClientboundRotateHeadPacket() {
    }
    
    public ClientboundRotateHeadPacket(final Entity aom, final byte byte2) {
        this.entityId = aom.getId();
        this.yHeadRot = byte2;
    }
    
    @Override
    public void read(final FriendlyByteBuf mg) throws IOException {
        this.entityId = mg.readVarInt();
        this.yHeadRot = mg.readByte();
    }
    
    @Override
    public void write(final FriendlyByteBuf mg) throws IOException {
        mg.writeVarInt(this.entityId);
        mg.writeByte(this.yHeadRot);
    }
    
    @Override
    public void handle(final ClientGamePacketListener nl) {
        nl.handleRotateMob(this);
    }
    
    public Entity getEntity(final Level bqb) {
        return bqb.getEntity(this.entityId);
    }
    
    public byte getYHeadRot() {
        return this.yHeadRot;
    }
}
