Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.16.x] Item Property Override in Tick Method


urbanxx001
 Share

Recommended Posts

During the tick method in an item's entity class, I'm altering the item's custom NBT tags. The tags are being updated, but the method tied to one of them that handles a property override, isn't. (no texture change is seen). The model files are correct, as the override works in a SpecialRecipe class. What could be the issue? Idk if it's related to this by chance (although that deals with capabilities). 

Edited by urbanxx001
Link to comment
Share on other sites

22 hours ago, diesieben07 said:

Look at ItemEntity for how it does it.

After looking at the ItemEntity class as you suggested, it seems to handle syncing with EntityDataManager. However, getShareTag and readShareTag also exist, as well as onEntityItemUpdate in the item class. Which of these would be the best option?

Edited by urbanxx001
Link to comment
Share on other sites

I appreciate all your help. I've created a data key in the entity class which is being updated, but I'm not sure how to link it with the tag in the item class (responsible for the property override). Either that or the key needs to be accessed from the item class too. Alternatively I've tried an if statement in the override method, to detect when an entity is created and tell it to grab a float from the entity class instead. This works, but it updates all modItemEntities in the world as it's not an instance of the current item.

 

ModItemEntity with Data Key https://pastebin.com/TeQMiEKf

Edited by urbanxx001
Link to comment
Share on other sites

Right you can store that in the key... sorry for the stupid questions. All set now.

Edit: Oml I just realized getItem and setItem are the built-in methods for itemstack data 🤦. I've used getItem before but it never occured to me that it was for a data key.

Edited by urbanxx001
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
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.