package net.minecraft.network.protocol.game;

import net.minecraft.network.PacketListener;
import java.io.IOException;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.InteractionHand;
import net.minecraft.network.protocol.Packet;

public class ClientboundOpenBookPacket implements Packet<ClientGamePacketListener> {
    private InteractionHand hand;
    
    public ClientboundOpenBookPacket() {
    }
    
    public ClientboundOpenBookPacket(final InteractionHand anf) {
        this.hand = anf;
    }
    
    @Override
    public void read(final FriendlyByteBuf mg) throws IOException {
        this.hand = mg.<InteractionHand>readEnum(InteractionHand.class);
    }
    
    @Override
    public void write(final FriendlyByteBuf mg) throws IOException {
        mg.writeEnum(this.hand);
    }
    
    @Override
    public void handle(final ClientGamePacketListener nl) {
        nl.handleOpenBook(this);
    }
    
    public InteractionHand getHand() {
        return this.hand;
    }
}
