Posted November 21, 20186 yr Hi. I was looking at the logger while the game was loading, and I saw an exception like this: Spoiler > [09:57:02] [main/ERROR] [FML]: Exception loading model for variant minecraft:halfadder_block#inventory, normal location exception: > net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model minecraft:item/halfadder_block with loader VanillaLoader.INSTANCE, skipping > at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?] > at net.minecraftforge.client.model.ModelLoader.func_177590_d(ModelLoader.java:302) ~[ModelLoader.class:?] > at net.minecraft.client.renderer.block.model.ModelBakery.func_177577_b(ModelBakery.java:194) ~[cgb.class:?] > at net.minecraftforge.client.model.ModelLoader.func_177570_a(ModelLoader.java:151) ~[ModelLoader.class:?] > at net.minecraft.client.renderer.block.model.ModelManager.func_110549_a(ModelManager.java:28) [cgc.class:?] > at net.minecraft.client.resources.SimpleReloadableResourceManager.func_110542_a(SimpleReloadableResourceManager.java:121) [cev.class:?] > at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:512) [bib.class:?] > at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:377) [bib.class:?] > at net.minecraft.client.main.Main.main(SourceFile:123) [Main.class:?] > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_191] > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_191] > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_191] > at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_191] > 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:?] > Caused by: java.io.FileNotFoundException: minecraft:models/item/halfadder_block.json > at net.minecraft.client.resources.FallbackResourceManager.func_110536_a(FallbackResourceManager.java:69) ~[cei.class:?] > at net.minecraft.client.resources.SimpleReloadableResourceManager.func_110536_a(SimpleReloadableResourceManager.java:65) ~[cev.class:?] > at net.minecraft.client.renderer.block.model.ModelBakery.func_177594_c(ModelBakery.java:365) ~[cgb.class:?] > at net.minecraftforge.client.model.ModelLoader.access$1400(ModelLoader.java:115) ~[ModelLoader.class:?] > at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:861) ~[ModelLoader$VanillaLoader.class:?] > at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?] > ... 14 more I am getting a lot of exceptions like that, but for some reason the game do not crash and loads fine. The mod works fine too. My question is, why am I getting this exception? What is this "#inventory" thing? And why it reports the error in "minecraft:halfadder_block#inventory" and not "my_modid:halfadder_block#inventory"? I think is not a registering block problem, because i have already find and fixed an exception where it shows the correct modid. The exception was: Spoiler > [09:57:02] [main/ERROR] [FML]: Exception loading model for variant alf_logic_gates:halfadder_block#block_state=5,facing=west > net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model alf_logic_gates:halfadder_block#block_state=5,facing=west with loader VariantLoader.INSTANCE, skipping > at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?] > at net.minecraftforge.client.model.ModelLoader.func_177569_a(ModelLoader.java:235) ~[ModelLoader.class:?] > at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:166) ~[cgb.class:?] > at net.minecraftforge.client.model.ModelLoader.func_188640_b(ModelLoader.java:223) ~[ModelLoader.class:?] > at net.minecraftforge.client.model.ModelLoader.func_177570_a(ModelLoader.java:150) ~[ModelLoader.class:?] > at net.minecraft.client.renderer.block.model.ModelManager.func_110549_a(ModelManager.java:28) [cgc.class:?] > at net.minecraft.client.resources.SimpleReloadableResourceManager.func_110542_a(SimpleReloadableResourceManager.java:121) [cev.class:?] > at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:512) [bib.class:?] > at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:377) [bib.class:?] > at net.minecraft.client.main.Main.main(SourceFile:123) [Main.class:?] > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_191] > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_191] > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_191] > at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_191] > 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:?] > Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException > at net.minecraft.client.renderer.block.model.ModelBlockDefinition.func_188004_c(ModelBlockDefinition.java:83) ~[bvv.class:?] > at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1175) ~[ModelLoader$VariantLoader.class:?] > at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?] > ... 15 more Note it shows "alf_logic_gates:halfadder_block#block_state" (shows the correct modid). How can i fix the incorrect modid? (minecraft: instead of alf_logic_gates:) How can i fix the #inventory exception? My github repo is here. Thanks a lot for your time.
November 21, 20186 yr Author 8 hours ago, diesieben07 said: Problematic code, issue 14. So, what are the proper events that I should use? 8 hours ago, diesieben07 said: Code style, issue 1. Ok, I will look how to change this. 8 hours ago, diesieben07 said: As far as I can tell, you never register any of the blocks that you create here. You must register all blocks during RegistryEvent.Register and you must not instantiate them in a static initializer. So, should I delete this whole class? 8 hours ago, diesieben07 said: AlfBaseBlock / AlfBaseItem is an antipattern. Do not abuse inheritance for code-reuse. In the base block I implement a lot of functionality and logic that is used in all of my blocks, and even I decleare some abstracts methods for this, so I dont see why I should have all of that methods code repeated in all the classes. If made in this way, if I find a bug that it is common in all the blocks, I have to change only one class, not 7. 8 hours ago, diesieben07 said: Either assign values to fields or use @ObjectHolder on them. Doing both does not make sense. I don't know what are you saying here. 8 hours ago, diesieben07 said: As far as I can tell, you are registering models without specifying a resource domain ("mod id") here. Therefor the resource domain defaults to "minecraft". How do I set the resource domain there? 8 hours ago, diesieben07 said: In general your model registration is all over the place, routed through what feels like 5 methods in 3 different files. Why? Basically, this is what happens when you follow like three differents tutorials on how to make a minecraft mod. I just don't know what are the correct way to do the forge stuff. When I got the blocks showing in game, i barely touch this part of the mod, because I don't understand it. How should I structure my mod, the blocks registry and all of the forge stuff? Thanks a lot for the feedback! Edited November 21, 20186 yr by AngheloAlf Question
November 21, 20186 yr 12 minutes ago, AngheloAlf said: In the base block I implement a lot of functionality and logic that is used in all of my blocks, and even I decleare some abstracts methods for this, so I dont see why I should have all of that methods code repeated in all the classes. If made in this way, if I find a bug that it is common in all the blocks, I have to change only one class, not 7. There is already a BlockBase class, it’s called Block. You should extract this functionality to utility methods so that you can extend other Minecraft blocks (a lot Minecraft code uses instanceof checks to specially handle stuff - you will be saving yourself a lot of headache down the track) 14 minutes ago, AngheloAlf said: How should I structure my mod, the blocks registry and all of the forge stuff? I’ve got an example of this here that you might want to look at. You should at least read the README of the repository as it explains some vital stuff About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
November 22, 20186 yr Author 11 hours ago, diesieben07 said: Problematic code, issue 14. Code style, issue 1. As far as I can tell, you never register any of the blocks that you create here. You must register all blocks during RegistryEvent.Register and you must not instantiate them in a static initializer. AlfBaseBlock / AlfBaseItem is an antipattern. Do not abuse inheritance for code-reuse. Either assign values to fields or use @ObjectHolder on them. Doing both does not make sense. As far as I can tell, you are registering models without specifying a resource domain ("mod id") here. Therefor the resource domain defaults to "minecraft". In general your model registration is all over the place, routed through what feels like 5 methods in 3 different files. Why? I think I fixed most of this things. I based myself in the repo from @Cadiboo, and reading a lot the forge docs. One last thing. While moving and deleting a lot of code, I just realized that I weren't registering recipes. How should I register them? Thanks a lot you both! Edited November 22, 20186 yr by AngheloAlf A question
November 22, 20186 yr 55 minutes ago, AngheloAlf said: One last thing. While moving and deleting a lot of code, I just realized that I wasn’t registering recipes. How should I register them? With JSON in /assets/modid/recipes (there’s already an example in my repo) About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
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.