Jump to content

[1.8] Help! Render item model with dynamic texture layer


Cleverpanda

Recommended Posts

I need to render an Item that will have two layers but layer 0 will not be known until the item is used.

ISmartItemModel looks like how to do it , but I just don't understand how. I've already checked out TheGreyGhost's github examples 11 ans 15, And I don't see how to use them for this purpose.

 

Essentially, what I want, Is if I have the first texture as my item, and the second texture is the texture of something like this.helditem(), I want the game to render it as the last texture.

H64pXrs.png

 

I also need to do something similar for a bow that needs to render different arrow types.

 

How can I do this?

Thanks.

Link to comment
Share on other sites

Well, if it were me, I'd render the different models using ISmartItemModel. There is a method that is called when the item is being rendered in the world - handleItemState(ItemStack itemStack) - you can use this to return different models based on itemstack info such as NBT, stack size, etc. Use te ModelBakeEvent to use ISmartItemModel to wrap ModResourceLocations. Take a look at MinecraftByExample by TGG as well as some other posts on the Forge Forum here on ISmartItemModel. I particularly have a post as well as some others.

 

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

Link to comment
Share on other sites

Hi

 

If both of those two layers are json models, i.e. you don't need to generate layer 0 texel by texel, then you can just merge the two together using a technique similar to the mbe05 CompositeModel - i.e. retrieve the IBakedModel for each of the two items, and concatenate their generalQuads together.  ISmartItemModel and handleItemStack will get you there, like EverythingGames suggested.

 

If you need to generate an item model from a dynamic texture, that's harder.  ItemModelGenerator can do that for you, but you would need to put your texture into the texture map somehow.  I think it should be possible using OpenGL to write to the texture sheet but I've only done that on a texture sheet I created myself.  Let us know if you need that path...

 

-TGG

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.

Announcements



×
×
  • Create New...

Important Information

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