Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

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]

You should look into ways to merge 2 images together, mods like dense ores do it adding non vanilla ores to the dense ore version

"you seem to be THE best modder I've seen imo."

~spynathan

 

ლ(́◉◞౪◟◉‵ლ

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

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.