Jump to content

[1.11.2] Dynamic Models For 3D Items


dStreamline

Recommended Posts

Greetings,

 

I'm trying to implement an item that looks different depending on what state it is in. Ideally this would be done with an inventory that changes the stats of the item depending on whats inside of it. My question is this: how does one use this data to change the way the item is rendered?

 

How would you, for example, create a glass jar that you can see inside while holding it? This illustrates my issue perfectly, as this would need to be changed on the fly, and couldn't have all combinations accounted for, and pre-made.

 

Help and feedback is greatly appreciated!

Link to comment
Share on other sites

10 hours ago, jabelar said:

Look at the way compasses do it -- hint they define a "property" which can be used by the main model JSON to redirect to other JSON models.

The Compass way is terribad. It can only determine what model to show based on a float. If you want to do it based on NBT you need to use an ItemMeshDefinition.

https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/industry/item/ItemCastingMold.java#L80-L108

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.

Link to comment
Share on other sites

14 minutes ago, Draco18s said:

The Compass way is terribad. It can only determine what model to show based on a float. If you want to do it based on NBT you need to use an ItemMeshDefinition.

https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/industry/item/ItemCastingMold.java#L80-L108

Compasses just happen to be complicated due to returning an angle property so are good example of how powerful the property system is. But ItemElytra returns a boolean so maybe a simpler example. In both cases, the apply() method returns a value that is used as lookup in your master model JSON file. I have a bit more information about this all in my tutorial tip (look down the page a bit) here: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-quick-tips-gl11-and.html

 

The property system is really simple. You simply apply an override getter that implements an apply() method that returns the possible values, then you create a JSON that maps those "overrides" to specific JSON models. It is very powerful as you can convert things like ItemStack NBT, but you can also process the world (i.e. like ItemCompass) or really look up anything (configurations, capabilities, etc.)

Edited by jabelar

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

Link to comment
Share on other sites

9 minutes ago, jabelar said:

The property system is really simple. You simply apply an override getter that implements an apply() method that returns the possible values, then you create a JSON that maps those "overrides" to specific JSON models. It is very powerful as you can convert things like ItemStack NBT, but you can also process the world (i.e. like ItemCompass) or really look up anything (configurations, capabilities, etc.)

It is still a bad choice when you want to return an Item. Trust me, I did it once. It was not pretty.

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.

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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