Search in sources :

Example 1 with ExistingFileHelper

use of net.minecraftforge.common.data.ExistingFileHelper in project MinecraftForge by MinecraftForge.

the class RemoveTagDatagenTest method onGatherData.

private void onGatherData(GatherDataEvent event) {
    DataGenerator generator = event.getGenerator();
    ExistingFileHelper helper = event.getExistingFileHelper();
    generator.addProvider(new BlockTagsProvider(generator, MODID, helper) {

        @SuppressWarnings("unchecked")
        @Override
        protected void addTags() {
            this.tag(TEST_TAG).remove(Blocks.DIRT.getRegistryName()).remove(Blocks.OAK_DOOR.getRegistryName(), Blocks.DARK_OAK_DOOR.getRegistryName()).remove(Blocks.ANVIL).remove(Blocks.BASALT, Blocks.POLISHED_BASALT).remove(BlockTags.BEEHIVES).remove(BlockTags.BANNERS, BlockTags.BEDS);
        }
    });
}
Also used : ExistingFileHelper(net.minecraftforge.common.data.ExistingFileHelper) DataGenerator(net.minecraft.data.DataGenerator) BlockTagsProvider(net.minecraft.data.tags.BlockTagsProvider)

Example 2 with ExistingFileHelper

use of net.minecraftforge.common.data.ExistingFileHelper in project Tropicraft by Tropicraft.

the class Tropicraft method gatherData.

private void gatherData(GatherDataEvent event) {
    DataGenerator gen = event.getGenerator();
    ExistingFileHelper existingFileHelper = event.getExistingFileHelper();
    if (event.includeClient()) {
        TropicraftBlockstateProvider blockstates = new TropicraftBlockstateProvider(gen, existingFileHelper);
        gen.addProvider(blockstates);
        gen.addProvider(new TropicraftItemModelProvider(gen, blockstates.getExistingHelper()));
        gen.addProvider(new TropicraftLangProvider(gen));
    }
    if (event.includeServer()) {
        TropicraftBlockTagsProvider blockTags = new TropicraftBlockTagsProvider(gen, existingFileHelper);
        gen.addProvider(blockTags);
        gen.addProvider(new TropicraftItemTagsProvider(gen, blockTags, existingFileHelper));
        gen.addProvider(new TropicraftRecipeProvider(gen));
        gen.addProvider(new TropicraftLootTableProvider(gen));
        gen.addProvider(new TropicraftEntityTypeTagsProvider(gen, existingFileHelper));
        gatherWorldgenData(gen);
    }
}
Also used : TropicraftItemModelProvider(net.tropicraft.core.client.data.TropicraftItemModelProvider) TropicraftBlockstateProvider(net.tropicraft.core.client.data.TropicraftBlockstateProvider) TropicraftLootTableProvider(net.tropicraft.core.common.data.TropicraftLootTableProvider) ExistingFileHelper(net.minecraftforge.common.data.ExistingFileHelper) TropicraftEntityTypeTagsProvider(net.tropicraft.core.common.data.TropicraftEntityTypeTagsProvider) TropicraftBlockTagsProvider(net.tropicraft.core.common.data.TropicraftBlockTagsProvider) DataGenerator(net.minecraft.data.DataGenerator) TropicraftItemTagsProvider(net.tropicraft.core.common.data.TropicraftItemTagsProvider) TropicraftRecipeProvider(net.tropicraft.core.common.data.TropicraftRecipeProvider) TropicraftLangProvider(net.tropicraft.core.client.data.TropicraftLangProvider)

Example 3 with ExistingFileHelper

use of net.minecraftforge.common.data.ExistingFileHelper in project Ceramics by KnightMiner.

the class Ceramics method gatherData.

private void gatherData(GatherDataEvent event) {
    if (event.includeServer()) {
        DataGenerator gen = event.getGenerator();
        ExistingFileHelper helper = event.getExistingFileHelper();
        BlockTagsProvider blockTags = new BlockTagProvider(gen, helper);
        gen.addProvider(blockTags);
        gen.addProvider(new ItemTagProvider(gen, blockTags, helper));
        gen.addProvider(new FluidTagProvider(gen, helper));
        gen.addProvider(new RecipeProvider(gen));
        gen.addProvider(new LootTableProvider(gen));
    }
}
Also used : ExistingFileHelper(net.minecraftforge.common.data.ExistingFileHelper) ItemTagProvider(knightminer.ceramics.datagen.ItemTagProvider) RecipeProvider(knightminer.ceramics.datagen.RecipeProvider) LootTableProvider(knightminer.ceramics.datagen.LootTableProvider) DataGenerator(net.minecraft.data.DataGenerator) BlockTagProvider(knightminer.ceramics.datagen.BlockTagProvider) FluidTagProvider(knightminer.ceramics.datagen.FluidTagProvider) BlockTagsProvider(net.minecraft.data.BlockTagsProvider)

Example 4 with ExistingFileHelper

use of net.minecraftforge.common.data.ExistingFileHelper in project MinecraftForge by MinecraftForge.

the class ForgeMod method gatherData.

public void gatherData(GatherDataEvent event) {
    DataGenerator gen = event.getGenerator();
    if (event.includeServer()) {
        ExistingFileHelper existingFileHelper = event.getExistingFileHelper();
        ForgeBlockTagsProvider blockTags = new ForgeBlockTagsProvider(gen, existingFileHelper);
        gen.addProvider(blockTags);
        gen.addProvider(new ForgeItemTagsProvider(gen, blockTags, existingFileHelper));
        gen.addProvider(new ForgeFluidTagsProvider(gen, existingFileHelper));
        gen.addProvider(new ForgeRecipeProvider(gen));
        gen.addProvider(new ForgeLootTableProvider(gen));
    }
}
Also used : ExistingFileHelper(net.minecraftforge.common.data.ExistingFileHelper) ForgeLootTableProvider(net.minecraftforge.common.data.ForgeLootTableProvider) DataGenerator(net.minecraft.data.DataGenerator) ForgeFluidTagsProvider(net.minecraftforge.common.data.ForgeFluidTagsProvider) ForgeItemTagsProvider(net.minecraftforge.common.data.ForgeItemTagsProvider) ForgeBlockTagsProvider(net.minecraftforge.common.data.ForgeBlockTagsProvider) ForgeRecipeProvider(net.minecraftforge.common.data.ForgeRecipeProvider)

Example 5 with ExistingFileHelper

use of net.minecraftforge.common.data.ExistingFileHelper 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)5 DataGenerator (net.minecraft.data.DataGenerator)4 BlockTagProvider (knightminer.ceramics.datagen.BlockTagProvider)1 FluidTagProvider (knightminer.ceramics.datagen.FluidTagProvider)1 ItemTagProvider (knightminer.ceramics.datagen.ItemTagProvider)1 LootTableProvider (knightminer.ceramics.datagen.LootTableProvider)1 RecipeProvider (knightminer.ceramics.datagen.RecipeProvider)1 BlockTagsProvider (net.minecraft.data.BlockTagsProvider)1 BlockTagsProvider (net.minecraft.data.tags.BlockTagsProvider)1 ForgeBlockTagsProvider (net.minecraftforge.common.data.ForgeBlockTagsProvider)1 ForgeFluidTagsProvider (net.minecraftforge.common.data.ForgeFluidTagsProvider)1 ForgeItemTagsProvider (net.minecraftforge.common.data.ForgeItemTagsProvider)1 ForgeLootTableProvider (net.minecraftforge.common.data.ForgeLootTableProvider)1 ForgeRecipeProvider (net.minecraftforge.common.data.ForgeRecipeProvider)1 GatherDataEvent (net.minecraftforge.forge.event.lifecycle.GatherDataEvent)1 TropicraftBlockstateProvider (net.tropicraft.core.client.data.TropicraftBlockstateProvider)1 TropicraftItemModelProvider (net.tropicraft.core.client.data.TropicraftItemModelProvider)1 TropicraftLangProvider (net.tropicraft.core.client.data.TropicraftLangProvider)1 TropicraftBlockTagsProvider (net.tropicraft.core.common.data.TropicraftBlockTagsProvider)1 TropicraftEntityTypeTagsProvider (net.tropicraft.core.common.data.TropicraftEntityTypeTagsProvider)1