Jump to content

[1.7.10] What would be the most effective way to render hats on players


FuzeIII

Recommended Posts

Hi ! I'm making a hat mod pretty much like iChun's hats mod, but I have trouble figuring how to render properly a hat on the player's head.

 

I want the player to pick a hat and display it on his head. Here's what I tried and the problems I've encountered:

 

  • Directly render hat's model on player during RenderPlayerEvent, it works but I've trouble syncing what hat the player picked with all the players on the map, I've considered sending packets, but I wonder how I could do that effectively. Plus the hat would render strangely when in multiplayer.
  • Spawning an entity on the player and rendering the hat model on this entity. The problem here is that when the player disconnects, the Entity may not despawn. The other problem I have is simply that the Entity won't render and I don't know why (I've correctly setup a renderer for my entity). Plus I'm afraid spawning an entity for every hat could cause some lag issues, .

 

I took a look at iChun's code on github, it seems like it spawns entities on the player, but I can't figure out how to do that correctly.

 

If anyone has any idea :)

Link to comment
Share on other sites

Can't you just extend helmets to make hats? Just treat them like custom cloth (leather) helmets, and even let them offer that small bit of protection (and apply a few enchantments).

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

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.