package top.r3944realms.lib39.datagen.provider;

import net.minecraft.data.loot.LootTableProvider;
import net.minecraft.data.loot.LootTableSubProvider;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSet;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import top.r3944realms.lib39.datagen.provider.subprovider.BlockLootTables;

import java.util.ArrayList;
import java.util.List;

/**
 * The type Sub providers wrapper.
 */
public class SubProvidersWrapper {
    /**
     * The Entries.
     */
    public List<LootTableProvider.SubProviderEntry> entries = new ArrayList<>();

    /**
     * Instantiates a new Sub providers wrapper.
     */
    public SubProvidersWrapper() {}

    /**
     * Add entry sub providers wrapper.
     *
     * @param entry the entry
     * @return the sub providers wrapper
     */
    public SubProvidersWrapper addEntry(LootTableProvider.SubProviderEntry entry) {
        entries.add(entry);
        return this;
    }

    /**
     * Add entry sub providers wrapper.
     *
     * @param subProvider the sub provider
     * @param subParamSet the sub param set
     * @return the sub providers wrapper
     */
    public SubProvidersWrapper addEntry(LootTableSubProvider subProvider, LootContextParamSet subParamSet) {
        entries.add(new LootTableProvider.SubProviderEntry(() -> subProvider, subParamSet));
        return this;
    }

    /**
     * Add block entry sub providers wrapper.
     *
     * @param blockLootTables the block loot tables
     * @return the sub providers wrapper
     */
    public SubProvidersWrapper addBlockEntry(BlockLootTables blockLootTables) {
        entries.add(new LootTableProvider.SubProviderEntry(() -> blockLootTables, LootContextParamSets.BLOCK));
        return this;
    }

}
