package net.minecraft.network.protocol.game;

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

public class ServerboundSetCreativeModeSlotPacket implements Packet<ServerGamePacketListener> {
    private int slotNum;
    private ItemStack itemStack;
    
    public ServerboundSetCreativeModeSlotPacket() {
        this.itemStack = ItemStack.EMPTY;
    }
    
    public ServerboundSetCreativeModeSlotPacket(final int integer, final ItemStack bki) {
        this.itemStack = ItemStack.EMPTY;
        this.slotNum = integer;
        this.itemStack = bki.copy();
    }
    
    @Override
    public void handle(final ServerGamePacketListener qz) {
        qz.handleSetCreativeModeSlot(this);
    }
    
    @Override
    public void read(final FriendlyByteBuf mg) throws IOException {
        this.slotNum = mg.readShort();
        this.itemStack = mg.readItem();
    }
    
    @Override
    public void write(final FriendlyByteBuf mg) throws IOException {
        mg.writeShort(this.slotNum);
        mg.writeItem(this.itemStack);
    }
    
    public int getSlotNum() {
        return this.slotNum;
    }
    
    public ItemStack getItem() {
        return this.itemStack;
    }
}
