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 qz) {
        qz.handleContainerAck(this);
    }
    
    @Override
    public void read(final FriendlyByteBuf mg) throws IOException {
        this.containerId = mg.readByte();
        this.uid = mg.readShort();
        this.accepted = (mg.readByte() != 0);
    }
    
    @Override
    public void write(final FriendlyByteBuf mg) throws IOException {
        mg.writeByte(this.containerId);
        mg.writeShort(this.uid);
        mg.writeByte(this.accepted ? 1 : 0);
    }
    
    public int getContainerId() {
        return this.containerId;
    }
    
    public short getUid() {
        return this.uid;
    }
}
