package top.r3944realms.lib39.datagen.provider;

import net.minecraft.core.HolderLookup;
import net.minecraft.core.WritableRegistry;
import net.minecraft.data.PackOutput;
import net.minecraft.data.loot.LootTableProvider;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.Identifier;
import net.minecraft.util.ProblemReporter;
import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.ValidationContext;
import org.jetbrains.annotations.NotNull;

import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;

/**
 * The type Simple loot table provider.
 */
public class SimpleLootTableProvider extends LootTableProvider {
    /**
     * Instantiates a new Simple loot table provider.
     *
     * @param output              the output
     * @param subProvidersWrapper the sub providers wrapper
     * @param registries          the registries
     */
    public SimpleLootTableProvider(PackOutput output, @NotNull SubProvidersWrapper subProvidersWrapper, CompletableFuture<HolderLookup.Provider> registries) {
        super(output, Set.of(), subProvidersWrapper.entries, registries);
    }

    /**
     * Instantiates a new Simple loot table provider.
     *
     * @param output              the output
     * @param requiredTables      the required tables
     * @param subProvidersWrapper the sub providers wrapper
     * @param registries          the registries
     */
    public SimpleLootTableProvider(PackOutput output, Set<ResourceKey<LootTable>> requiredTables, @NotNull SubProvidersWrapper subProvidersWrapper, CompletableFuture<HolderLookup.Provider> registries) {
        super(output, requiredTables, subProvidersWrapper.entries, registries);
    }

    @Override
    protected void validate(WritableRegistry<LootTable> writableregistry, ValidationContext validationcontext, ProblemReporter.Collector problemreporter$collector) {
        writableregistry.forEach(lootTable -> lootTable.validate(validationcontext));
    }
}
