Posted October 30, 20168 yr I made an item. It shows up in-game, but its textures are missing. Can someone help, please? My directory structure: I am using IntelliJ IDEA 2016.2.5. src/main/resources is a sources root. ExampleMod.java package com.example.examplemod; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.ModelLoaderRegistry; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import org.lwjgl.Sys; @Mod(modid = ExampleMod.MODID, version = ExampleMod.VERSION) public class ExampleMod { public static final String MODID = "examplemod"; public static final String VERSION = "1.0"; public static Item noobItem; @SidedProxy(serverSide = "com.example.examplemod.CommonProxy", clientSide = "com.example.examplemod.ClientProxy") public static CommonProxy proxy; @Mod.Instance(MODID) public static ExampleMod instance; @EventHandler public void preInit(FMLInitializationEvent event) { noobItem = new ItemBase("noobItem"); proxy.initModels(); GameRegistry.register(noobItem); } @EventHandler public void init(FMLInitializationEvent event) { } } ItemBase.java package com.example.examplemod; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; public class ItemBase extends Item { protected String name; public ItemBase(String name) { setUnlocalizedName(name); setRegistryName(name); setCreativeTab(CreativeTabs.MISC); } } ClientProxy.java package com.example.examplemod; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.client.model.ModelLoader; public class ClientProxy extends CommonProxy { @Override public void setModelResourceLocation(Item item, String id) { ModelResourceLocation modelResourceLocation = new ModelResourceLocation("examplemod:" + id, "inventory"); ModelLoader.setCustomModelResourceLocation(item, 0, modelResourceLocation); System.out.println(modelResourceLocation); } @Override public void initModels() { setModelResourceLocation(ExampleMod.noobItem, "noobitem"); } } noobitem.json { "parent": "item/generated", "textures": { "layer0": "examplemod:items/noobitem" } }
October 30, 20168 yr Is it like a block model in your hand or a 2D item model without a texture? There's a difference in that. Also, I don't have my resources folder marked as a sources root, maybe that's the issue? Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
October 30, 20168 yr You should really use getRegistryName() for registering models. It contains your mod ID and registration name already. 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.
October 31, 20168 yr Author Is it like a block model in your hand or a 2D item model without a texture? There's a difference in that. Also, I don't have my resources folder marked as a sources root, maybe that's the issue? In the hand it looks like a block, and on the ground it looks like an oversize spinning block. If src/main/resources is not marked as sources or resources root, it will throw this error right before the title screen: [17:28:00] [Client thread/INFO]: Forge Mod Loader has successfully loaded 4 mods [17:28:00] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:examplemod [17:28:04] [Client thread/INFO]: SoundSystem shutting down... [17:28:04] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com [17:28:04] [sound Library Loader/INFO]: Starting up SoundSystem... [17:28:05] [Thread-10/INFO]: Initializing LWJGL OpenAL [17:28:05] [Thread-10/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [17:28:05] [Thread-10/INFO]: OpenAL initialized. [17:28:05] [sound Library Loader/INFO]: Sound engine started [17:28:10] [Client thread/INFO]: Max texture size: 16384 [17:28:10] [Client thread/INFO]: Created: 512x512 textures-atlas [17:28:11] [Client thread/ERROR]: Exception loading model for variant examplemod:noobItem#inventory for item "examplemod:noobItem", normal location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model examplemod:item/noobItem with loader VanillaLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:317) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:170) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:147) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:132) [simpleReloadableResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:113) [simpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:799) [Minecraft.class:?] at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:340) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:561) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_74] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_74] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_74] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_74] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_74] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_74] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_74] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_74] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_74] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_74] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_74] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_74] at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:?] Caused by: java.io.FileNotFoundException: examplemod:models/item/noobItem.json at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:69) ~[simpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:311) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.access$1100(ModelLoader.java:118) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:868) ~[ModelLoader$VanillaLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 28 more [17:28:11] [Client thread/ERROR]: Exception loading model for variant examplemod:noobItem#inventory for item "examplemod:noobItem", blockstate location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model examplemod:noobItem#inventory with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:325) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:170) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:147) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:132) [simpleReloadableResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:113) [simpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:799) [Minecraft.class:?] at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:340) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:561) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_74] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_74] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_74] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_74] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_74] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_74] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_74] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_74] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_74] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_74] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_74] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_74] at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:?] Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78) ~[ModelBlockDefinition.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1184) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 28 more You should really use getRegistryName() for registering models. It contains your mod ID and registration name already. I changed the ClientProxy class to use getRegistryName(), but it's still not working. package com.example.examplemod; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.client.model.ModelLoader; public class ClientProxy extends CommonProxy { @Override public void setModelResourceLocation(Item item) { ModelResourceLocation modelResourceLocation = new ModelResourceLocation(item.getRegistryName(), "inventory"); ModelLoader.setCustomModelResourceLocation(item, 0, modelResourceLocation); System.out.println(modelResourceLocation); } @Override public void initModels() { setModelResourceLocation(ExampleMod.noobItem); } }
October 31, 20168 yr FileNotFoundException: examplemod:models/item/noobItem.json 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.
October 31, 20168 yr Author FileNotFoundException: examplemod:models/item/noobItem.json I unmarked it as source and resources roots, and the directory tree looks like this now. I also tried renaming noobitem.json to noobItem.json with a capital I, but it seems it still doesn't recognize it. The FileNotFoundException is specifically saying that examplemod:models/item/noobItem.json is nonexistent. Does this mean there is something in Forge running something like new FileInputStream("examplemod:models/item/noobItem.json") ?
October 31, 20168 yr The FileNotFoundException is specifically saying that examplemod:models/item/noobItem.json is nonexistent. Does this mean there is something in Forge running something like new FileInputStream("examplemod:models/item/noobItem.json") ? Given that Minecraft needs to open and read the resource, yes, there is a InputStream involved. It is not passing that exact string though. You should use lower case for your file names and registry names (don't just change one, change them both!) 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.
October 31, 20168 yr Author Okay, so I tested with MinecraftByExample and confirmed that the src/main/resources folder MUST be marked as either source or resources root in order for it to display proper textures and localizations. Also, I added a language file to the assets folder and that applied properly.
October 31, 20168 yr Okay, so I tested with MinecraftByExample and confirmed that the src/main/resources folder MUST be marked as either source or resources root in order for it to display proper textures and localizations. Yes, yes it must. 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.
October 31, 20168 yr Author Alright, so I made a custom block, and here's how it looks: Don't mind the dogecoins, it was from a project abandoned long ago. The blocks are properly textured, but not the ItemBlock. This leads me to believe that there's something wrong with the way I'm doing the item model json. package com.example.examplemod; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.client.model.ModelLoader; public class ClientProxy extends CommonProxy { @Override public void setModelResourceLocation(Item item) { ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); } @Override public void initItemModels() { setModelResourceLocation(ExampleMod.itemDogecoinOre); setModelResourceLocation(ExampleMod.noobItem); } } I'm calling initItemModels() in preInit after I register the items and blocks. There shouldn't be anything wrong with this, should there?
October 31, 20168 yr This is how I register ItemBlocks (that have no variants) private void _registerBlockResources(Block block) { Item item = Item.getItemFromBlock(block); ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(block.getRegistryName(),"normal")); } 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.
October 31, 20168 yr Author I've been banging my head on this for so long, there really shouldn't be anything wrong with my code. Do you think you could just review the entire file to see if there's anything wrong? Here it is: https://drive.google.com/file/d/0Bz7UTEmdVE9CUC05cklXT1h1YmM/view?usp=sharing
October 31, 20168 yr Author You have a method called preInit in your main mod class that subscribes to FMLInitializationEvent . This method does all your registration, but registration must happen during the preInit phase, not init. What do you mean? The registration is happening in preInit. Do you mean it should be called something different?
October 31, 20168 yr Author Your method is called preInit , but it is subscribing to FMLInitializationEvent . The name of event subscriber methods does not matter. Okay, that's the reason I failed. Now the inventory displays work! Thanks!
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.