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 ClientboundContainerSetSlotPacket implements Packet<ClientGamePacketListener> {
    private int containerId;
    private int slot;
    private ItemStack itemStack;
    
    public ClientboundContainerSetSlotPacket() {
        this.itemStack = ItemStack.EMPTY;
    }
    
    public ClientboundContainerSetSlotPacket(final int integer1, final int integer2, final ItemStack bki) {
        this.itemStack = ItemStack.EMPTY;
        this.containerId = integer1;
        this.slot = integer2;
        this.itemStack = bki.copy();
    }
    
    @Override
    public void handle(final ClientGamePacketListener nl) {
        nl.handleContainerSetSlot(this);
    }
    
    @Override
    public void read(final FriendlyByteBuf mg) throws IOException {
        this.containerId = mg.readByte();
        this.slot = mg.readShort();
        this.itemStack = mg.readItem();
    }
    
    @Override
    public void write(final FriendlyByteBuf mg) throws IOException {
        mg.writeByte(this.containerId);
        mg.writeShort(this.slot);
        mg.writeItem(this.itemStack);
    }
    
    public int getContainerId() {
        return this.containerId;
    }
    
    public int getSlot() {
        return this.slot;
    }
    
    public ItemStack getItem() {
        return this.itemStack;
    }
}
