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 bpa, final int integer3, final int integer4, final boolean boolean5, final boolean boolean6) {
        this.containerId = integer1;
        this.offers = bpa;
        this.villagerLevel = integer3;
        this.villagerXp = integer4;
        this.showProgress = boolean5;
        this.canRestock = boolean6;
    }
    
    @Override
    public void read(final FriendlyByteBuf mg) throws IOException {
        this.containerId = mg.readVarInt();
        this.offers = MerchantOffers.createFromStream(mg);
        this.villagerLevel = mg.readVarInt();
        this.villagerXp = mg.readVarInt();
        this.showProgress = mg.readBoolean();
        this.canRestock = mg.readBoolean();
    }
    
    @Override
    public void write(final FriendlyByteBuf mg) throws IOException {
        mg.writeVarInt(this.containerId);
        this.offers.writeToStream(mg);
        mg.writeVarInt(this.villagerLevel);
        mg.writeVarInt(this.villagerXp);
        mg.writeBoolean(this.showProgress);
        mg.writeBoolean(this.canRestock);
    }
    
    @Override
    public void handle(final ClientGamePacketListener nl) {
        nl.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;
    }
}
