Jump to content

Recommended Posts

Posted

I've made a new block loosely based on the properties of redstone wire, except it doesn't transmit power, it just emits light. (The idea is that it's placeable glowstone dust.) The block works fine... but the model doesn't.

 

I effectively just copies the blockstate and block model files from redstone dust, and then changed the parents, etc. to my namespaced files instead of Minecraft's (still using Minecraft's textures, though). The model doesn't load, and instead I'm getting this error in the console for every block state:

 

[23:56:00] [main/ERROR] [FML]: Exception loading model for variant placeables:block_glowstone_dust#east=up,north=up,south=none,west=side for blockstate "placeables:block_glowstone_dust[east=up,north=up,south=none,west=side]"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model placeables:block_glowstone_dust#east=up,north=up,south=none,west=side with loader VariantLoader.INSTANCE, skipping
...
Caused by: java.lang.IllegalStateException: vanilla model 'net.minecraft.client.renderer.block.model.ModelBlock@3ed50b5f' can't have non-vanilla parent
	at net.minecraftforge.client.model.ModelLoader$VanillaModelWrapper.getTextures(ModelLoader.java:395) ~[ModelLoader$VanillaModelWrapper.class:?]
...

 

What I don't understand is that it's *not* a vanilla model, and there are no references to vanilla models in its blockstate or model files. Besides, the error even says it's using a VariantLoader and not a VanillaLoader, so how does this error make any sense? I'm clearly misunderstanding something about either terminology or the model loading process here.

 

You can look at my assets folder (and of course the code) at the repo/branch here: https://github.com/IceMetalPunk/Placeables/tree/glowstone-placeable/src/main/resources/assets/placeables

 

I've never had an issue like this before... then again, I never copied/pasted vanilla models and state files before, either, so I assume that's where the problem lies somewhere...

Whatever Minecraft needs, it is most likely not yet another tool tier.

Posted (edited)

I presume it's due to lines like these:

https://github.com/IceMetalPunk/Placeables/blob/glowstone-placeable/src/main/resources/assets/placeables/models/block/block_glowstone_dust_side0.json#L2

But as to why that error or how to fix it? I have no idea.

Edited by Draco18s

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
3 minutes ago, Draco18s said:

In other words, this isn't a common error, and the error message itself is entirely unhelpful and slightly inaccurate? Well, that's wonderful and super useful... >_<

Whatever Minecraft needs, it is most likely not yet another tool tier.

Posted

That is a bit of a wierd error. I guess you might have a typo somewhere related to the parents -- I didn't go through all your asset files to check, but the ones I checked looked fine.

 

Out of curiosity, since it looks like you're copying most of the redstone stuff, does the error go away if you make vanilla redstone models the parent?

 

Another thought is maybe something about the way you're registering your models is wrong?

 

If I look at the ModelLoader class code, I see that this particular error happens if the parent is not an instance of VanillaModelWrapper based on the IModel returned from the ModelLoaderRegistry. So you need to figure out how logically that happens. 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted
1 minute ago, jabelar said:

That is a bit of a wierd error. I guess you might have a typo somewhere related to the parents -- I didn't go through all your asset files to check, but the ones I checked looked fine.

 

Out of curiosity, since it looks like you're copying most of the redstone stuff, does the error go away if you make vanilla redstone models the parent?

 

Another thought is maybe something about the way you're registering your models is wrong?

 

If I look at the ModelLoader class code, I see that this particular error happens if the parent is not an instance of VanillaModelWrapper based on the IModel returned from the ModelLoaderRegistry. So you need to figure out how logically that happens. 

... *facepalm* . Okay, well, in copying my model registry code to show you, I did notice something... I'm not actually registering the models directly. I was under the impression that the only thing required to register models, other than having the proper registry names set, was only needed for items. In this case, there is no item form of the block (the "item form" is just vanilla glowstone dust).

So if there's more needed to register a block model, what exactly is it? All the tutorials I've found are for older versions, and they all only register item models directly anyway...

Whatever Minecraft needs, it is most likely not yet another tool tier.

Posted

Registry stuff is something that @Draco18shas done a lot of work on so he's probably your best bet to clarify.

 

But assuming you're already doing the registration using the registry events, then it is fairly straight forward. I don't have a lot of time to explain and there are several ways to organize your registration. For example, for my own reasons I don't use the ObjectHolder annotation. But perhaps looking at one of my mods might give you some ideas: https://github.com/jabelar/ExampleMod-1.12/blob/master/src/main/java/com/blogspot/jabelarminecraft/examplemod/init/ModBlocks.java

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Block models are loaded automagically.

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)
17 minutes ago, jabelar said:

Registry stuff is something that @Draco18shas done a lot of work on so he's probably your best bet to clarify.

 

But assuming you're already doing the registration using the registry events, then it is fairly straight forward. I don't have a lot of time to explain and there are several ways to organize your registration. For example, for my own reasons I don't use the ObjectHolder annotation. But perhaps looking at one of my mods might give you some ideas: https://github.com/jabelar/ExampleMod-1.12/blob/master/src/main/java/com/blogspot/jabelarminecraft/examplemod/init/ModBlocks.java

It looks like you're just registering the item block as well? Your registerBlockModel method is this:

 

ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(parBlock), parMetaData,
new ModelResourceLocation(MainMod.MODID + ":" + parBlock.getUnlocalizedName().substring(5), "inventory"));

So if the block doesn't have an item form, obviously that won't work or be applicable, right? (As a test, I gave the block an item form and registered its model accordingly, and lo and behold, the same error still occurs.)

 

9 minutes ago, Draco18s said:

Block models are loaded automagically.


That's what I thought... which means the error is somewhere else.... >_<

 

*EDIT* I'm slowly working my way through the stacktrace and code to hunt this down... so far I've made it to the VariantLoader's instantiation of a new MultipartModel in its loadModel() method... still looking further...

Edited by IceMetalPunk

Whatever Minecraft needs, it is most likely not yet another tool tier.

Posted (edited)
10 minutes ago, IceMetalPunk said:

So if the block doesn't have an item form, obviously that won't work or be applicable, right? (As a test, I gave the block an item form and registered its model accordingly, and lo and behold, the same error still occurs.)

 

I'm not confident but I think you need the item form for things like displaying in the inventory, or holding in your hand to place it. So from that perspective most useable blocks should have an item form.  However, as you mentioned I think you get a different error if the item form is the issue.

 

I would try to make the parents of your models the redstone vanilla parents to see if the behavior changes.

Edited by jabelar

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Sure, but in this case, the item form of this block is just vanilla glowstone, so it doesn't need its own itemBlock.

Anyway, I've solved the problem... and as you might expect, it was caused by a simple typo on my part. In one model file, I had the parent's namespace as "placebales" instead of "placeables". That got lost in the multitude of errors that appeared as a result, but after some debugging and some well-placed breakpoints, I finally fixed it.

 

Thanks to both of you for your help! :)

Whatever Minecraft needs, it is most likely not yet another tool tier.

Posted
5 minutes ago, IceMetalPunk said:

Anyway, I've solved the problem... and as you might expect, it was caused by a simple typo on my part. In one model file, I had the parent's namespace as "placebales" instead of "placeables".

This is my main complaint about JSON files -- your IDE really can't help with typos. If you're as old as me, when I was programming in the 1970s, there wasn't really any IDE and so when doing regular coding typos like these would drive programmers crazy. Nowadays, in the Java code it is really hard to make an actual typo as the IDE is so good at instantly flagging suspect code. With JSON however, it's like going backwards 40 years to when a single misplaced letter can drive you crazy for days (literally).

 

JSON is a useful format but I must admit I dread the moving of code-based logic into the JSON files as Forge seems to be doing a lot lately.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted
1 minute ago, jabelar said:

This is my main complaint about JSON files -- your IDE really can't help with typos. If you're as old as me, when I was programming in the 1970s, there wasn't really any IDE and so when doing regular coding typos like these would drive programmers crazy. Nowadays, in the Java code it is really hard to make an actual typo as the IDE is so good at instantly flagging suspect code. With JSON however, it's like going backwards 40 years to when a single misplaced letter can drive you crazy for days (literally).

 

JSON is a useful format but I must admit I dread the moving of code-based logic into the JSON files as Forge seems to be doing a lot lately.

To be fair, Mojang themselves are doing a lot of that. #BlameDinnerbone :P

I wouldn't mind it, if there were some sort of dedicated IDE that can parse and catch these things inside the Minecraft-specific JSON files. But of course, there's almost no chance of Minecraft modding becoming popular enough for anyone to spend time making such a thing.

Whatever Minecraft needs, it is most likely not yet another tool tier.

Posted
8 hours ago, IceMetalPunk said:

new ModelResourceLocation(MainMod.MODID + ":" + parBlock.getUnlocalizedName().substring(5), "inventory")

This is disgusting. Do this instead:

new ModelResourceLocation(parBlock.getRegistryName(), "inventory")

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
12 hours ago, Draco18s said:

This is disgusting. Do this instead:

new ModelResourceLocation(parBlock.getRegistryName(), "inventory")

I'm not doing that... that was a quote of jabelar's code that I was referencing for clarification... The code I'm using is this:

 

ModelResourceLocation model = new ModelResourceLocation(this.getRegistryName(), "inventory");
ModelLoader.registerItemVariants(this.itemBlock, model);
ModelLoader.setCustomModelResourceLocation(this.itemBlock, 0, model);

 

Whatever Minecraft needs, it is most likely not yet another tool tier.

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



×
×
  • Create New...

Important Information

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