ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/data/GeneratorItemModels.java

32 lines
1.1 KiB
Java
Raw Normal View History

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