package net.minecraft.data;

import net.minecraft.data.info.CommandsReport;
import net.minecraft.data.info.RegistryDumpReport;
import net.minecraft.data.info.BlockListReport;
import net.minecraft.data.structures.NbtToSnbt;
import net.minecraft.data.loot.LootTableProvider;
import net.minecraft.data.advancements.AdvancementProvider;
import net.minecraft.data.recipes.RecipeProvider;
import net.minecraft.data.tags.EntityTypeTagsProvider;
import net.minecraft.data.tags.ItemTagsProvider;
import net.minecraft.data.tags.BlockTagsProvider;
import net.minecraft.data.tags.FluidTagsProvider;
import net.minecraft.data.models.ModelProvider;
import net.minecraft.data.structures.StructureUpdater;
import net.minecraft.data.structures.SnbtToNbt;
import java.io.IOException;
import joptsimple.OptionSet;
import java.nio.file.Path;
import java.util.Collection;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.List;
import java.nio.file.Paths;
import java.io.OutputStream;
import joptsimple.OptionSpec;
import joptsimple.OptionParser;

public class Main {
    public static void main(final String[] arr) throws IOException {
        final OptionParser optionParser2 = new OptionParser();
        final OptionSpec<Void> optionSpec3 = optionParser2.accepts("help", "Show the help menu").forHelp();
        final OptionSpec<Void> optionSpec4 = optionParser2.accepts("server", "Include server generators");
        final OptionSpec<Void> optionSpec5 = optionParser2.accepts("client", "Include client generators");
        final OptionSpec<Void> optionSpec6 = optionParser2.accepts("dev", "Include development tools");
        final OptionSpec<Void> optionSpec7 = optionParser2.accepts("reports", "Include data reports");
        final OptionSpec<Void> optionSpec8 = optionParser2.accepts("validate", "Validate inputs");
        final OptionSpec<Void> optionSpec9 = optionParser2.accepts("all", "Include all generators");
        final OptionSpec<String> optionSpec10 = optionParser2.accepts("output", "Output folder").withRequiredArg().defaultsTo("generated", new String[0]);
        final OptionSpec<String> optionSpec11 = optionParser2.accepts("input", "Input folder").withRequiredArg();
        final OptionSet optionSet12 = optionParser2.parse(arr);
        if (optionSet12.has(optionSpec3) || !optionSet12.hasOptions()) {
            optionParser2.printHelpOn(System.out);
            return;
        }
        final Path path13 = Paths.get(optionSpec10.value(optionSet12));
        final boolean boolean14 = optionSet12.has(optionSpec9);
        final boolean boolean15 = boolean14 || optionSet12.has(optionSpec5);
        final boolean boolean16 = boolean14 || optionSet12.has(optionSpec4);
        final boolean boolean17 = boolean14 || optionSet12.has(optionSpec6);
        final boolean boolean18 = boolean14 || optionSet12.has(optionSpec7);
        final boolean boolean19 = boolean14 || optionSet12.has(optionSpec8);
        final DataGenerator hk20 = createStandardGenerator(path13, optionSet12.<String>valuesOf(optionSpec11).stream().map(string -> Paths.get(string)).collect(Collectors.toList()), boolean15, boolean16, boolean17, boolean18, boolean19);
        hk20.run();
    }
    
    public static DataGenerator createStandardGenerator(final Path path, final Collection<Path> collection, final boolean boolean3, final boolean boolean4, final boolean boolean5, final boolean boolean6, final boolean boolean7) {
        final DataGenerator hk8 = new DataGenerator(path, collection);
        if (boolean3 || boolean4) {
            hk8.addProvider(new SnbtToNbt(hk8).addFilter(new StructureUpdater()));
        }
        if (boolean3) {
            hk8.addProvider(new ModelProvider(hk8));
        }
        if (boolean4) {
            hk8.addProvider(new FluidTagsProvider(hk8));
            final BlockTagsProvider jr9 = new BlockTagsProvider(hk8);
            hk8.addProvider(jr9);
            hk8.addProvider(new ItemTagsProvider(hk8, jr9));
            hk8.addProvider(new EntityTypeTagsProvider(hk8));
            hk8.addProvider(new RecipeProvider(hk8));
            hk8.addProvider(new AdvancementProvider(hk8));
            hk8.addProvider(new LootTableProvider(hk8));
        }
        if (boolean5) {
            hk8.addProvider(new NbtToSnbt(hk8));
        }
        if (boolean6) {
            hk8.addProvider(new BlockListReport(hk8));
            hk8.addProvider(new RegistryDumpReport(hk8));
            hk8.addProvider(new CommandsReport(hk8));
        }
        return hk8;
    }
}
