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.trading.MerchantOffers;
import net.minecraft.network.protocol.Packet;

public class ClientboundMerchantOffersPacket implements Packet<ClientGamePacketListener> {
    private int containerId;
    private MerchantOffers offers;
    private int villagerLevel;
    private int villagerXp;
    private boolean showProgress;
    private boolean canRestock;
    
    public ClientboundMerchantOffersPacket() {
    }
    
    public ClientboundMerchantOffersPacket(final int integer1, final MerchantOffers bja, final int integer3, final int integer4, final boolean boolean5, final boolean boolean6) {
        this.containerId = integer1;
        this.offers = bja;
        this.villagerLevel = integer3;
        this.villagerXp = integer4;
        this.showProgress = boolean5;
        this.canRestock = boolean6;
    }
    
    @Override
    public void read(final FriendlyByteBuf kv) throws IOException {
        this.containerId = kv.readVarInt();
        this.offers = MerchantOffers.createFromStream(kv);
        this.villagerLevel = kv.readVarInt();
        this.villagerXp = kv.readVarInt();
        this.showProgress = kv.readBoolean();
        this.canRestock = kv.readBoolean();
    }
    
    @Override
    public void write(final FriendlyByteBuf kv) throws IOException {
        kv.writeVarInt(this.containerId);
        this.offers.writeToStream(kv);
        kv.writeVarInt(this.villagerLevel);
        kv.writeVarInt(this.villagerXp);
        kv.writeBoolean(this.showProgress);
        kv.writeBoolean(this.canRestock);
    }
    
    @Override
    public void handle(final ClientGamePacketListener lw) {
        lw.handleMerchantOffers(this);
    }
    
    public int getContainerId() {
        return this.containerId;
    }
    
    public MerchantOffers getOffers() {
        return this.offers;
    }
    
    public int getVillagerLevel() {
        return this.villagerLevel;
    }
    
    public int getVillagerXp() {
        return this.villagerXp;
    }
    
    public boolean showProgress() {
        return this.showProgress;
    }
    
    public boolean canRestock() {
        return this.canRestock;
    }
}
