package de.ellpeck.actuallyadditions.data; import de.ellpeck.actuallyadditions.common.ActuallyAdditions; import de.ellpeck.actuallyadditions.common.blocks.ActuallyBlocks; import net.minecraft.block.Block; import net.minecraft.data.DataGenerator; import net.minecraftforge.client.model.generators.ExistingFileHelper; import net.minecraftforge.client.model.generators.ItemModelProvider; import net.minecraftforge.client.model.generators.ModelFile; import net.minecraftforge.fml.RegistryObject; public class GeneratorItemModels extends ItemModelProvider { public GeneratorItemModels(DataGenerator generator, ExistingFileHelper existingFileHelper) { super(generator, ActuallyAdditions.MOD_ID, existingFileHelper); } @Override protected void registerModels() { ActuallyBlocks.BLOCKS.getEntries().forEach(this::registerBlockModel); } private void registerBlockModel(RegistryObject block) { String path = block.get().getRegistryName().getPath(); getBuilder(path).parent(new ModelFile.UncheckedModelFile(modLoc("block/" + path))); } @Override public String getName() { return "Item Models"; } }