Search in sources :

Example 1 with GatherDataEvent

use of net.minecraftforge.forge.event.lifecycle.GatherDataEvent in project MinecraftForge by MinecraftForge.

the class DatagenModLoader method begin.

public static void begin(final Set<String> mods, final Path path, final Collection<Path> inputs, Collection<Path> existingPacks, Set<String> existingMods, final boolean serverGenerators, final boolean clientGenerators, final boolean devToolGenerators, final boolean reportsGenerator, final boolean structureValidator, final boolean flat, final String assetIndex, final File assetsDir) {
    if (mods.contains("minecraft") && mods.size() == 1)
        return;
    LOGGER.info("Initializing Data Gatherer for mods {}", mods);
    runningDataGen = true;
    Bootstrap.bootStrap();
    dataGeneratorConfig = new GatherDataEvent.DataGeneratorConfig(mods, path, inputs, serverGenerators, clientGenerators, devToolGenerators, reportsGenerator, structureValidator, flat);
    ModLoader.get().gatherAndInitializeMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), () -> {
    });
    if (!mods.contains("forge")) {
        // If we aren't generating data for forge, automatically add forge as an existing so mods can access forge's data
        existingMods.add("forge");
    }
    existingFileHelper = new ExistingFileHelper(existingPacks, existingMods, structureValidator, assetIndex, assetsDir);
    ModLoader.get().runEventGenerator(mc -> new GatherDataEvent(mc, dataGeneratorConfig.makeGenerator(p -> dataGeneratorConfig.isFlat() ? p : p.resolve(mc.getModId()), dataGeneratorConfig.getMods().contains(mc.getModId())), dataGeneratorConfig, existingFileHelper));
    dataGeneratorConfig.runAll();
}
Also used : ExistingFileHelper(net.minecraftforge.common.data.ExistingFileHelper) GatherDataEvent(net.minecraftforge.forge.event.lifecycle.GatherDataEvent)

Aggregations

ExistingFileHelper (net.minecraftforge.common.data.ExistingFileHelper)1 GatherDataEvent (net.minecraftforge.forge.event.lifecycle.GatherDataEvent)1