Search in sources :

Example 6 with DataGenerator

use of net.minecraft.data.DataGenerator in project NetherEx by LogicTechCorp.

the class DataGenerationHandler method onDataGathered.

@SubscribeEvent
public static void onDataGathered(GatherDataEvent event) {
    DataGenerator generator = event.getGenerator();
    if (event.includeServer()) {
        generator.addProvider(gatherLootTables(generator));
        generator.addProvider(gatherRecipes(generator));
    }
}
Also used : DataGenerator(net.minecraft.data.DataGenerator) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Example 7 with DataGenerator

use of net.minecraft.data.DataGenerator in project MinecraftForge by MinecraftForge.

the class DataGeneratorTest method gatherData.

@SubscribeEvent
public static void gatherData(GatherDataEvent event) {
    GSON = new GsonBuilder().registerTypeAdapter(Variant.class, new Variant.Deserializer()).registerTypeAdapter(ItemTransforms.class, new ItemTransforms.Deserializer()).registerTypeAdapter(ItemTransform.class, new ItemTransform.Deserializer()).create();
    DataGenerator gen = event.getGenerator();
    if (event.includeClient()) {
        gen.addProvider(new Lang(gen));
        // Let blockstate provider see generated item models by passing its existing file helper
        ItemModelProvider itemModels = new ItemModels(gen, event.getExistingFileHelper());
        gen.addProvider(itemModels);
        gen.addProvider(new BlockStates(gen, itemModels.existingFileHelper));
        gen.addProvider(new SoundDefinitions(gen, event.getExistingFileHelper()));
    }
    if (event.includeServer()) {
        gen.addProvider(new Recipes(gen));
        gen.addProvider(new Tags(gen, event.getExistingFileHelper()));
        gen.addProvider(new Advancements(gen, event.getExistingFileHelper()));
    }
}
Also used : ItemModelProvider(net.minecraftforge.client.model.generators.ItemModelProvider) GsonBuilder(com.google.gson.GsonBuilder) ItemTransforms(net.minecraft.client.renderer.block.model.ItemTransforms) Variant(net.minecraft.client.renderer.block.model.Variant) ItemTransform(net.minecraft.client.renderer.block.model.ItemTransform) DataGenerator(net.minecraft.data.DataGenerator) BlockTags(net.minecraft.tags.BlockTags) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Aggregations

DataGenerator (net.minecraft.data.DataGenerator)7 ExistingFileHelper (net.minecraftforge.common.data.ExistingFileHelper)4 ItemModelProvider (net.minecraftforge.client.model.generators.ItemModelProvider)2 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)2 GsonBuilder (com.google.gson.GsonBuilder)1 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 ItemTransform (net.minecraft.client.renderer.block.model.ItemTransform)1 ItemTransforms (net.minecraft.client.renderer.block.model.ItemTransforms)1 Variant (net.minecraft.client.renderer.block.model.Variant)1 BlockTagsProvider (net.minecraft.data.BlockTagsProvider)1 BlockTagsProvider (net.minecraft.data.tags.BlockTagsProvider)1 BlockTags (net.minecraft.tags.BlockTags)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