package net.minecraft.network.protocol.game;

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

public class ServerboundContainerAckPacket implements Packet<ServerGamePacketListener> {
    private int containerId;
    private short uid;
    private boolean accepted;
    
    public ServerboundContainerAckPacket() {
    }
    
    public ServerboundContainerAckPacket(final int integer, final short short2, final boolean boolean3) {
        this.containerId = integer;
        this.uid = short2;
        this.accepted = boolean3;
    }
    
    @Override
    public void handle(final ServerGamePacketListener pl) {
        pl.handleContainerAck(this);
    }
    
    @Override
    public void read(final FriendlyByteBuf kv) throws IOException {
        this.containerId = kv.readByte();
        this.uid = kv.readShort();
        this.accepted = (kv.readByte() != 0);
    }
    
    @Override
    public void write(final FriendlyByteBuf kv) throws IOException {
        kv.writeByte(this.containerId);
        kv.writeShort(this.uid);
        kv.writeByte(this.accepted ? 1 : 0);
    }
    
    public int getContainerId() {
        return this.containerId;
    }
    
    public short getUid() {
        return this.uid;
    }
}
