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 ServerboundUseItemPacket implements Packet<ServerGamePacketListener> {
    private InteractionHand hand;
    
    public ServerboundUseItemPacket() {
    }
    
    public ServerboundUseItemPacket(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 ServerGamePacketListener qz) {
        qz.handleUseItem(this);
    }
    
    public InteractionHand getHand() {
        return this.hand;
    }
}
