mirk
-
Posts
37 -
Joined
-
Last visited
Posts posted by mirk
-
-
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
-
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.
-
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 -
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 moreBlock 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"
}
}
} -
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.
-
1 minute ago, Animefan8888 said:
This is not true, all Items are singletons(there is only one shears).
You are comparing and ItemStack to an Item you need to call ItemStack#getItem on your getItemInMainHand
1 minute ago, V0idWa1k3r said:What? Items are singletons.
EntityPlayer#getHeldItemMainhand returns an ItemStack. Items.SHEARS is an Item. ItemStack != Item.
Oh, my bad! I'm still very new to this. I'll stick to asking questions and lurking. ?
-
This won't work because the item you're comparing it to isn't the exact pair of shears Minecraft has in mind.
You could try using the keyword "instanceof", or there's probably a smarter, Forge-friendly way of doing it that I don't know about.
-
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?QuoteWhen 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.
-
-
For those who might run into the same problem: what did you do to fix it?
-
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!
[1.12.2] Cannot load .OBJ file [SOLVED]
in Modder Support
Posted
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.