package com.jenny.compressedblocks; import net.minecraft.data.PackOutput; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraftforge.client.model.generators.ItemModelBuilder; import net.minecraftforge.client.model.generators.ItemModelProvider; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; public class ModItemModelProvider extends ItemModelProvider { public ModItemModelProvider(PackOutput output, ExistingFileHelper existingFileHelper) { super(output, CompressedBlocks.MODID, existingFileHelper); } @Override protected void registerModels() { handheldItem(Tools.ULTRA_PICKAXE); } private ItemModelBuilder saplingItem(RegistryObject item) { return withExistingParent(item.getId().getPath(), new ResourceLocation("item/generated")).texture("layer0", new ResourceLocation(CompressedBlocks.MODID,"block/" + item.getId().getPath())); } private ItemModelBuilder complexBlock(Block block) { return withExistingParent(ForgeRegistries.BLOCKS.getKey(block).getPath(), new ResourceLocation(CompressedBlocks.MODID, "block/" + ForgeRegistries.BLOCKS.getKey(block).getPath())); } public void fenceItem(RegistryObject block, RegistryObject baseBlock) { this.withExistingParent(ForgeRegistries.BLOCKS.getKey(block.get()).getPath(), mcLoc("block/fence_inventory")) .texture("texture", new ResourceLocation(CompressedBlocks.MODID, "block/" + ForgeRegistries.BLOCKS.getKey(baseBlock.get()).getPath())); } public void wallItem(RegistryObject block, RegistryObject baseBlock) { this.withExistingParent(ForgeRegistries.BLOCKS.getKey(block.get()).getPath(), mcLoc("block/wall_inventory")) .texture("wall", new ResourceLocation(CompressedBlocks.MODID, "block/" + ForgeRegistries.BLOCKS.getKey(baseBlock.get()).getPath())); } public void buttonItem(RegistryObject block, RegistryObject baseBlock) { this.withExistingParent(ForgeRegistries.BLOCKS.getKey(block.get()).getPath(), mcLoc("block/button_inventory")) .texture("texture", new ResourceLocation(CompressedBlocks.MODID, "block/" + ForgeRegistries.BLOCKS.getKey(baseBlock.get()).getPath())); } private ItemModelBuilder handheldItem(RegistryObject item) { return withExistingParent(item.getId().getPath(), new ResourceLocation("item/handheld")).texture("layer0", new ResourceLocation(CompressedBlocks.MODID,"item/" + item.getId().getPath())); } private ItemModelBuilder simpleBlockItem(RegistryObject item) { return withExistingParent(item.getId().getPath(), new ResourceLocation("item/generated")).texture("layer0", new ResourceLocation(CompressedBlocks.MODID,"item/" + item.getId().getPath())); } private ItemModelBuilder simpleItem(RegistryObject item) { return withExistingParent(item.getId().getPath(), new ResourceLocation("item/generated")).texture("layer0", new ResourceLocation(CompressedBlocks.MODID,"item/" + item.getId().getPath())); } }