Posted July 17, 20187 yr I'm having some trouble getting my .OBJ file into Minecraft. I've got the OBJLoader.INSTANCE.addDomain() going. It fails to open the file, because for some reason, it keeps trying to load a .JSON file. I'm stepping through the code and it fails in ModelLoader.getModelLocation(), I think. How do I successfully load a .OBJ file? For reference, here's my block state file. Spoiler { "forge_marker": 1, "defaults": { "textures": { "all": "momcraft:blocks/models/magic_node.obj" } }, "variants": { "normal": { "model": "momcraft:blocks/models/magic_node.obj" }, "inventory": { "model": "momcraft:blocks/models/magic_node.obj" } } } I hope I got these BBS tags right. Any help is massively appreciated! Edited July 19, 20187 yr by mirk
July 18, 20187 yr change OBJ should be a png as this is a texture and not a model, and the model not obj should be json
July 18, 20187 yr 12 hours ago, mirk said: "textures": { "all": "momcraft:blocks/models/magic_node.obj" } Why is your texture an .obj file? 1 hour ago, Naturix said: and the model not obj should be json No. 12 hours ago, mirk said: "model": "momcraft:blocks/models/magic_node.obj" When a model is looked up in the game the blocks/models/ path is added automatically. With your path the game tries to look for the model at momcraft:blocks/models/blocks/models/magic_node.obj which is incorrect. Just specify your path as momcraft:magic_node.obj similar to how I do here.
July 18, 20187 yr Author Okay, I've changed the texture path. So to load an .OBJ file, I change it to a .JSON? What should be in this new .JSON? Quote When a model is looked up in the game the blocks/models/ path is added automatically. With your path the game tries to look for the model at momcraft:blocks/models/blocks/models/magic_node.obj which is incorrect. Just specify your path as momcraft:magic_node.obj similar to how I do here. Alright, so I've done this, fixed an error that I got, and it's now throwing an exception when loading the model. Looks like I've got the right path, now, at least. Edited July 18, 20187 yr by mirk
July 18, 20187 yr 1 hour ago, mirk said: Alright, so I've done this, fixed an error that I got, and it's now throwing an exception when loading the model. Looks like I've got the right path, now, at least. Do still need help if so post the exception. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 18, 20187 yr Author Alrighty, so I've done some more investigation, and I think it's failing because it's trying to open magic_node.obj.json. I'm not sure why this is happening.
July 18, 20187 yr 28 minutes ago, mirk said: Alrighty, so I've done some more investigation, and I think it's failing because it's trying to open magic_node.obj.json. I'm not sure why this is happening. We can't help without actual information. Post your blockstate and your log that has the exception. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 18, 20187 yr Author Ah, of course. Sorry about that. Log with the exception: Spoiler [20:27:02] [main/ERROR] [FML]: Exception loading model for variant momcraft:magic_node#normal for blockstate "momcraft:magic_node" net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model momcraft:magic_node#normal with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:237) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:153) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:225) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:152) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:559) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_171] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_171] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_171] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_171] 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_171] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_171] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_171] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_171] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?] Caused by: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model momcraft:block/magic_node.obj with loader VanillaLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.<init>(ModelLoader.java:667) ~[ModelLoader$WeightedRandomModel.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1183) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 21 more Caused by: java.io.FileNotFoundException: momcraft:models/block/magic_node.obj.json at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:69) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:334) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.access$1600(ModelLoader.java:117) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:870) ~[ModelLoader$VanillaLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.<init>(ModelLoader.java:667) ~[ModelLoader$WeightedRandomModel.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1183) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 21 more Block state: Spoiler { "forge_marker": 1, "defaults": { "textures": { "all": "momcraft:magic_node.png" } }, "variants": { "normal": { "model": "momcraft:magic_node.obj" }, "inventory": { "model": "momcraft:magic_node.obj" } } }
July 18, 20187 yr 26 minutes ago, mirk said: Block state: Your model path should not have ".obj at the end of it" And your texture path should not have the ".png" at the end of it. These will be automatically appended. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 18, 20187 yr Author Okay, so I took those out, but it's still not very happy about these model files. Did I perhaps do something wrong exporting them from Blender? Is there a guide to doing this? Here's the console log: Spoiler [21:05:14] [main/ERROR] [FML]: Exception loading model for variant momcraft:magic_node#normal for blockstate "momcraft:magic_node" net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model momcraft:magic_node#normal with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:237) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:153) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:225) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:152) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:559) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_171] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_171] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_171] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_171] 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_171] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_171] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_171] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_171] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?] Caused by: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model momcraft:block/magic_node with loader VanillaLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.<init>(ModelLoader.java:667) ~[ModelLoader$WeightedRandomModel.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1183) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 21 more Caused by: java.io.FileNotFoundException: momcraft:models/block/magic_node.json at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:69) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:334) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.access$1600(ModelLoader.java:117) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:870) ~[ModelLoader$VanillaLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.<init>(ModelLoader.java:667) ~[ModelLoader$WeightedRandomModel.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1183) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 21 more
July 18, 20187 yr 2 minutes ago, mirk said: Is there a guide to doing this? There is a forge docs page for models and it includes .obj files. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 18, 20187 yr Author 2 minutes ago, Animefan8888 said: There is a forge docs page for models and it includes .obj files. I've given that a read, but I was hoping for something a little more in-depth and Blender-related. Do I triangulate the model? My model has several meshes: does this affect the import process? Do I use the "Objects as OBJ groups" option in Blender's .OBJ exporter? Sorry for all of the questions, I'm mostly just venting my frustrations at this point.
July 18, 20187 yr 1 minute ago, mirk said: I've given that a read, but I was hoping for something a little more in-depth and Blender-related. Do I triangulate the model? My model has several meshes: does this affect the import process? Do I use the "Objects as OBJ groups" option in Blender's .OBJ exporter? Sorry for all of the questions, I'm mostly just venting my frustrations at this point. I am unsure as to the process of exporting and making the model myself. But I believe that if it was finding your file it would be throwing a different exception our way, than the one that specifies a json file. Could you post the file path to your .obj and .mtl file and show the code where you call OBJLoader.addDomain also add the .obj extension back to your blockstate file according to the docs that is the correct way to do that. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 18, 20187 yr Author 26 minutes ago, Animefan8888 said: I am unsure as to the process of exporting and making the model myself. But I believe that if it was finding your file it would be throwing a different exception our way, than the one that specifies a json file. Could you post the file path to your .obj and .mtl file and show the code where you call OBJLoader.addDomain also add the .obj extension back to your blockstate file according to the docs that is the correct way to do that. Alright, so I've put the .obj back into the blockstates file. This is in my MoMCraft.java file, my main mod file. I'm not sure if this is the right place to do it or not. Spoiler @EventHandler public void init(FMLInitializationEvent event) { OBJLoader.INSTANCE.addDomain(MODID); } And the path to my model and material is simply: assets/momcraft/models/block/magic_node.obj assets/momcraft/models/block/magic_node.mtl Edited July 18, 20187 yr by mirk Added material path
July 18, 20187 yr 3 minutes ago, mirk said: This is in my MoMCraft.java file, my main mod file. I'm not sure if this is the right place to do it or not. Do this in FMLPreInitializationEvent instead. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 18, 20187 yr Author Ta-da! It has some way to go yet, but that's my model, loaded into Minecraft. Thank you so much for your help, Animefan8888.
July 18, 20187 yr 2 minutes ago, mirk said: Thank you so much for your help, Animefan8888. No problem, glad I could help. Also it will look weird if you model protrudes outside of a 1 block space into another blocks, so you may wanna shrink it a little. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 18, 20187 yr And change the block type to not be a full, opaque cube so it doesn't create holes in the world. 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.
July 18, 20187 yr Author 16 minutes ago, Animefan8888 said: No problem, glad I could help. Also it will look weird if you model protrudes outside of a 1 block space into another blocks, so you may wanna shrink it a little. Yeah, I'm going to scale it down a bit, it's a bit extra at the moment. I think the missing texture is actually a problem in Blender, because I have no idea how to use it properly. 8 minutes ago, Draco18s said: And change the block type to not be a full, opaque cube so it doesn't create holes in the world. Yes, that too! I was following a tutorial that was teaching about opaque cubes and stuff, so I just left it in like a dingus. Edited July 18, 20187 yr by mirk Replying to Draco18s
July 18, 20187 yr 6 minutes ago, mirk said: Blender I have no idea how to use it properly. No one does. 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.