Jump to content

Recommended Posts

Posted (edited)

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 by mirk
Posted
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.

Posted (edited)

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 by mirk
Posted
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.

Posted

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.

Posted
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.

Posted

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"
            }
     }
}

 

Posted
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.

Posted

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

 

Posted
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.

Posted
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.

Posted (edited)
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 by mirk
Added material path
Posted
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.

Posted

Ta-da!

2018-07-18_22_11_40.png.08830f1217a039e7dd1b0cafe7fd1ca5.png

 

It has some way to go yet, but that's my model, loaded into Minecraft.

Thank you so much for your help, Animefan8888.

Posted
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.

Posted

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.

Posted (edited)
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 by mirk
Replying to Draco18s
Posted
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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Minecraft 1.21.4 requires a new model definition file for each item, which you don't have. These can be created through Data Generation, specifically the ModelProvider, BlockModelGenerators and ItemModelGenerators classes.
    • Hi,  I'm using Forge 47.3.0 for Minecraft 1.20.1 I apologise if this is obvious I am very new to modding for Minecraft. I sucessfully made a mod that launched without errors or crashes (without it doing anything) but in order to add the features I need, I need to add "Custom Portal API [Forge]" as a dependency. However no matter the way I've tried to acheive this, it crashes. I am pretty sure it's not the way I'm putting it in the repositories, the dependencies or the way I'm refrencing it, as I've a hundred diffrent combinations and multiple Maven methods. And on all those diffrent variations I still get this crash: pastebin.com/UhumzZCZ Any tips would be invaluable as I've been loosing my mind over this!
    • Hi, i'm really having problems trying to set the texture to my custom item. I thought i'm doing everything correctly, but all i see is the missing texture block for my item. I am trying this for over a week now and getting really frustrated. The only time i could make the texture work, was when i used an older Forge version (52.0.1) for Minecraft (1.21.4). Was there a fundamental change for textures and models somewhere between versions that i'm missing? I started with Forge 54.1.0 and had this problem, so in my frustration i tried many things: Upgrading to Forge 54.1.1, created multiple new projects, workspaces, redownloaded everything and setting things up multiple times, as it was suggested in an older thread. Therea are no errors in the console logs, but maybe i'm blind, so i pasted the console logs to pastebin anyway: https://pastebin.com/zAM8RiUN The only time i see an error is when i change the models JSON file to an incorrect JSON which makes sense and that suggests to me it is actually reading the JSON file.   I set the github repository to public, i would be so thankful if anyone could take a look and tell me what i did wrong: https://github.com/xLorkin/teleport_pug_forge   As a note: i'm pretty new to modding, this is my first mod ever. But i'm used to programming. I had some up and downs, but through reading the documentation, using google and experimenting, i could solve all other problems. I only started modding for Minecraft because my son is such a big fan and wanted this mod.
    • Please read the FAQ (link in orange bar at top of page), and post logs as described there.
    • Hello fellow Minecrafters! I recently returned to Minecraft and realized I needed a wiki that displays basic information easily and had great user navigation. That’s why I decided to build: MinecraftSearch — a site by a Minecraft fan, for Minecraft fans. Key Features So Far Straight-to-the-Point Info: No extra fluff; just the essentials on items, mobs, recipes, loot and more. Clean & Intuitive Layout: Easy navigation so you spend less time scrolling and more time playing. Optimized Search: Search for anything—items, mobs, blocks—and get results instantly. What I’m Thinking of Adding More data/information: Catch chances for fishing rod, traveling villager trades, biomes info and a lot more. The website is still under development and need a lot more data added. Community Contributions: Potential for user-uploaded tips for items/mobs/blocks in the future. Feature Requests Welcome: Your ideas could shape how the wiki evolves! You can see my roadmap at the About page https://minecraftsearch.com/about I’d love for you to check out MinecraftSearch and see if it helps you find the info you need faster. Feedback is crucial—I want to develop this further based on what the community needs most, so please let me know what you think. Thanks, and happy crafting!
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.