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 ajk) {
        this.hand = ajk;
    }
    
    @Override
    public void read(final FriendlyByteBuf kv) throws IOException {
        this.hand = kv.<InteractionHand>readEnum(InteractionHand.class);
    }
    
    @Override
    public void write(final FriendlyByteBuf kv) throws IOException {
        kv.writeEnum(this.hand);
    }
    
    @Override
    public void handle(final ClientGamePacketListener lw) {
        lw.handleOpenBook(this);
    }
    
    public InteractionHand getHand() {
        return this.hand;
    }
}
