Skip to content

Commit

Permalink
🚧 Continue working on updating model providers
Browse files Browse the repository at this point in the history
  • Loading branch information
Autovw committed Dec 27, 2024
1 parent ca843bb commit 41c3049
Show file tree
Hide file tree
Showing 11 changed files with 267 additions and 399 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void onInitializeDataGenerator(FabricDataGenerator generator)
{
FabricDataGenerator.Pack pack = generator.createPack();

pack.addProvider(ModBlockStatesProvider::new);
pack.addProvider(ModModelProvider::new);
pack.addProvider(ModBlockLootTablesProvider::new);
pack.addProvider(ModRecipeProvider::new);

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
package com.autovw.advancednetherite.datagen.providers;

import com.autovw.advancednetherite.core.ModBlocks;
import com.autovw.advancednetherite.core.ModItems;
import com.autovw.advancednetherite.core.util.ModEquipmentAssets;
import net.fabricmc.fabric.api.client.datagen.v1.provider.FabricModelProvider;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.minecraft.client.data.models.BlockModelGenerators;
import net.minecraft.client.data.models.ItemModelGenerators;
import net.minecraft.client.data.models.model.ModelTemplates;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.equipment.EquipmentAsset;

/**
* @author Autovw
*/
public class ModModelProvider extends FabricModelProvider
{
public ModModelProvider(FabricDataOutput dataOutput)
{
super(dataOutput);
}

@Override
public void generateBlockStateModels(BlockModelGenerators generator)
{
generator.createTrivialCube(ModBlocks.NETHERITE_IRON_BLOCK);
generator.createTrivialCube(ModBlocks.NETHERITE_GOLD_BLOCK);
generator.createTrivialCube(ModBlocks.NETHERITE_EMERALD_BLOCK);
generator.createTrivialCube(ModBlocks.NETHERITE_DIAMOND_BLOCK);
}

@Override
public void generateItemModels(ItemModelGenerators generator)
{
itemModel(generator, ModItems.NETHERITE_IRON_INGOT);
itemModel(generator, ModItems.NETHERITE_GOLD_INGOT);
itemModel(generator, ModItems.NETHERITE_EMERALD_INGOT);
itemModel(generator, ModItems.NETHERITE_DIAMOND_INGOT);

armorModel(generator, ModItems.NETHERITE_IRON_HELMET, ModEquipmentAssets.NETHERITE_IRON);
armorModel(generator, ModItems.NETHERITE_IRON_CHESTPLATE, ModEquipmentAssets.NETHERITE_IRON);
armorModel(generator, ModItems.NETHERITE_IRON_LEGGINGS, ModEquipmentAssets.NETHERITE_IRON);
armorModel(generator, ModItems.NETHERITE_IRON_BOOTS, ModEquipmentAssets.NETHERITE_IRON);

armorModel(generator, ModItems.NETHERITE_GOLD_HELMET, ModEquipmentAssets.NETHERITE_GOLD);
armorModel(generator, ModItems.NETHERITE_GOLD_CHESTPLATE, ModEquipmentAssets.NETHERITE_GOLD);
armorModel(generator, ModItems.NETHERITE_GOLD_LEGGINGS, ModEquipmentAssets.NETHERITE_GOLD);
armorModel(generator, ModItems.NETHERITE_GOLD_BOOTS, ModEquipmentAssets.NETHERITE_GOLD);

armorModel(generator, ModItems.NETHERITE_EMERALD_HELMET, ModEquipmentAssets.NETHERITE_EMERALD);
armorModel(generator, ModItems.NETHERITE_EMERALD_CHESTPLATE, ModEquipmentAssets.NETHERITE_EMERALD);
armorModel(generator, ModItems.NETHERITE_EMERALD_LEGGINGS, ModEquipmentAssets.NETHERITE_EMERALD);
armorModel(generator, ModItems.NETHERITE_EMERALD_BOOTS, ModEquipmentAssets.NETHERITE_EMERALD);

armorModel(generator, ModItems.NETHERITE_DIAMOND_HELMET, ModEquipmentAssets.NETHERITE_DIAMOND);
armorModel(generator, ModItems.NETHERITE_DIAMOND_CHESTPLATE, ModEquipmentAssets.NETHERITE_DIAMOND);
armorModel(generator, ModItems.NETHERITE_DIAMOND_LEGGINGS, ModEquipmentAssets.NETHERITE_DIAMOND);
armorModel(generator, ModItems.NETHERITE_DIAMOND_BOOTS, ModEquipmentAssets.NETHERITE_DIAMOND);

toolModel(generator, ModItems.NETHERITE_IRON_AXE);
toolModel(generator, ModItems.NETHERITE_GOLD_AXE);
toolModel(generator, ModItems.NETHERITE_EMERALD_AXE);
toolModel(generator, ModItems.NETHERITE_DIAMOND_AXE);

toolModel(generator, ModItems.NETHERITE_IRON_HOE);
toolModel(generator, ModItems.NETHERITE_GOLD_HOE);
toolModel(generator, ModItems.NETHERITE_EMERALD_HOE);
toolModel(generator, ModItems.NETHERITE_DIAMOND_HOE);

toolModel(generator, ModItems.NETHERITE_IRON_PICKAXE);
toolModel(generator, ModItems.NETHERITE_GOLD_PICKAXE);
toolModel(generator, ModItems.NETHERITE_EMERALD_PICKAXE);
toolModel(generator, ModItems.NETHERITE_DIAMOND_PICKAXE);

toolModel(generator, ModItems.NETHERITE_IRON_SHOVEL);
toolModel(generator, ModItems.NETHERITE_GOLD_SHOVEL);
toolModel(generator, ModItems.NETHERITE_EMERALD_SHOVEL);
toolModel(generator, ModItems.NETHERITE_DIAMOND_SHOVEL);

toolModel(generator, ModItems.NETHERITE_IRON_SWORD);
toolModel(generator, ModItems.NETHERITE_GOLD_SWORD);
toolModel(generator, ModItems.NETHERITE_EMERALD_SWORD);
toolModel(generator, ModItems.NETHERITE_DIAMOND_SWORD);
}

public void itemModel(ItemModelGenerators itemModels, Item item)
{
itemModels.createFlatItemModel(item, ModelTemplates.FLAT_ITEM);
}

public void toolModel(ItemModelGenerators itemModels, Item item)
{
itemModels.createFlatItemModel(item, ModelTemplates.FLAT_HANDHELD_ITEM);
}

public void armorModel(ItemModelGenerators itemModels, Item item, ResourceKey<EquipmentAsset> equipmentKey)
{
itemModels.generateTrimmableItem(item, equipmentKey, equipmentKey.location().getPath(), false);
}
}
2 changes: 1 addition & 1 deletion Forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ minecraft {
mappings channel: 'official', version: minecraft_version
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.

// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

reobf = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ public static void onGatherData(final GatherDataEvent event)
generator.addProvider(event.includeServer(), new ModLootModifierProvider(packOutput, AdvancedNetherite.MOD_ID, lookupProvider));

// client
generator.addProvider(event.includeClient(), new ModBlockStatesProvider(packOutput, AdvancedNetherite.MOD_ID, helper));
generator.addProvider(event.includeClient(), new ModEquipmentAssetProvider(packOutput));
generator.addProvider(event.includeClient(), new ModItemModelProvider(packOutput, AdvancedNetherite.MOD_ID, helper));
generator.addProvider(event.includeClient(), new ModModelProvider(packOutput, AdvancedNetherite.MOD_ID));
}
}

This file was deleted.

Loading

0 comments on commit 41c3049

Please sign in to comment.