CompressedBlocks/src/main/java/com/jenny/compressedblocks/ModItemModelProvider.java
2024-12-31 05:14:38 +01:00

68 lines
3.4 KiB
Java

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<Block> 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> block, RegistryObject<Block> 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> block, RegistryObject<Block> 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> block, RegistryObject<Block> 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> item) {
return withExistingParent(item.getId().getPath(),
new ResourceLocation("item/handheld")).texture("layer0",
new ResourceLocation(CompressedBlocks.MODID,"item/" + item.getId().getPath()));
}
private ItemModelBuilder simpleBlockItem(RegistryObject<Block> 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> item) {
return withExistingParent(item.getId().getPath(),
new ResourceLocation("item/generated")).texture("layer0",
new ResourceLocation(CompressedBlocks.MODID,"item/" + item.getId().getPath()));
}
}