Jump to content

[1.8] Special item rendering


mGamer426

Recommended Posts

Hi! I made an item, and I want it to render a little special. I want that while you're holding the item, it renders the player's hand, and it renders a particle above it.

That will kinda look like the player holding a particle in his hand. What's hard about this, is making the player's arm rendering while holding the item. And my other problem is I can't figure out what

class to extend or implement to make the renderer. I've never really used IPerspectiveAwareModel, and I think it is not the good way to go. Also, with rendering the player's hand I tried RenderPlayerAPI and it not worked! So, do you have any suggestions?

Link to comment
Share on other sites

Hi, this is quite tricky as the vanilla code causes the hand in first person to move downward out of visible range (or it de-renders completely). You have a few options:

1.) Use the RenderHandEvent to render a new hand in it's place depending on if you are holding an item.

2.) Try to figure a way through the RenderPlayerAPI - not recommended

3.) Use the new modeling system to render the arm and bind the skin to the BakedQuad (arm). (Basically the arm is a part of the item)

 

Here is what I have done for a sword rendering a player arm with it:

First, I made an item (for example a steel sword) through .JSON - [MODEL 1]

Second, I made the same exact item model through .JSON except this model has the arm holding it (keep in mind this arm is a part of the model) - [MODEL 2]

 

Considering above, MODEL 1 is used for third person / gui rendering. MODEL 2 is used for first person rendering (because MODEL 2 has the player arm in it). The way I done this was creating a class with sub-classes within itself - one wrapper class implementing ISmartItemModel, the other wrapper class implementing IPerspectiveAwareModel. ISmartItemModel customizes the model based on NBT data, the IPerspectiveAwareModel customizes the model based on camera transforms (First Person, Third Person, GUI, Head, None). Basically, in IPerspectiveAwareModel, you return a list of faceQuads and generalQuads for what you want to render. In ISmartItemModel, you return an IBakedModel - I return different models based on NBT.

 

Here is a topic of myself solving the similar issue:

http://www.minecraftforge.net/forum/index.php/topic,32309.0.html

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

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.