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.world.item.ItemStack;
import net.minecraft.network.protocol.Packet;

public class ServerboundEditBookPacket implements Packet<ServerGamePacketListener> {
    private ItemStack book;
    private boolean signing;
    private InteractionHand hand;
    
    public ServerboundEditBookPacket() {
    }
    
    public ServerboundEditBookPacket(final ItemStack bki, final boolean boolean2, final InteractionHand anf) {
        this.book = bki.copy();
        this.signing = boolean2;
        this.hand = anf;
    }
    
    @Override
    public void read(final FriendlyByteBuf mg) throws IOException {
        this.book = mg.readItem();
        this.signing = mg.readBoolean();
        this.hand = mg.<InteractionHand>readEnum(InteractionHand.class);
    }
    
    @Override
    public void write(final FriendlyByteBuf mg) throws IOException {
        mg.writeItem(this.book);
        mg.writeBoolean(this.signing);
        mg.writeEnum(this.hand);
    }
    
    @Override
    public void handle(final ServerGamePacketListener qz) {
        qz.handleEditBook(this);
    }
    
    public ItemStack getBook() {
        return this.book;
    }
    
    public boolean isSigning() {
        return this.signing;
    }
    
    public InteractionHand getHand() {
        return this.hand;
    }
}
