Posted September 11, 20178 yr So I've continued my goofing around with tutorials to try and get the hang of this, and I've come to the next roadblock. I don't know how to assign a model/image to my item! I've created the item class, added a function to it which will allow me to tell the ClientProxy to register the item model with setCustomModelResourceLocation, but it simply shows up as the black and pink boxes. Any help? ModItem.java public class ModItem extends Item { protected String name; public ModItem(String name) { this.name = name; setName(this, name); } public static void setName(final Item item, final String name) { item.setRegistryName(Reference.MODID, name); item.setUnlocalizedName(item.getRegistryName().toString()); } public void registerModel() { Venture.proxy.registerItemRender(this, 0, this.name); } @Override public ModItem setCreativeTab(CreativeTabs tab) { super.setCreativeTab(tab); return this; } } In ClientProxy.java @Override public void registerItemRender(Item item, int meta, String id) { ModelLoader.setCustomModelResourceLocation( item, meta, new ModelResourceLocation(Reference.PREFIX + id, "inventory") ); } ModItems.java @GameRegistry.ObjectHolder(Reference.MODID) public class ModItems { public static ModIngot ObsidianIngot = new ModIngot("obsidian_ingot"); // ... more items go here public static void registerModels() { ObsidianIngot.registerModel(); } @Mod.EventBusSubscriber(modid = Reference.MODID) public static class RegistrationHandler { public static final Set<Item> ITEMS = new HashSet<>(); @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { final Item[] items = { ObsidianIngot }; final IForgeRegistry<Item> registry = event.getRegistry(); for (final Item item : items) { registry.register(item); ITEMS.add(item); } ModItems.registerModels(); } } } obsidian_ingot in resources/assets/csvm/models/item { "parent": "item/generated", "textures": { "layer0": "csvm:items/obsidian_ingot" } } And yes, I have an obsidian_ingot.png in my assets/csvm/textures/items folder. And honestly, I don't know what the inventory variant is actually for.
September 11, 20178 yr Ok, so 1: ModelLoader.setCustomModelResourceLocation( item, meta, new ModelResourceLocation(Reference.PREFIX + id, "inventory") ); item.getRegistryName(), magic. 2: You're registering your item models at the wrong time. You must use the ModelRegistryEvent. 3: you didn't post the log, so there's still the possibility of several problems: The possibility that the file is in the wrong place / misnamed (despite what you've said) The possibility that the file isn't a valid json file (even though it looks like it) The possibility that the texture is in the wrong place / misnamed Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.