Posted October 13, 20204 yr 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 October 13, 20204 yr by urbanxx001
October 13, 20204 yr Author ModItem Class: https://pastebin.com/3ZR4XkXE ModItemEntity Class: https://pastebin.com/9KywYMWr Edited October 13, 20204 yr by urbanxx001
October 13, 20204 yr Author Ah ok I'll take look, thanks! I figured the packet would handle it, but now I realize the one I have is only for spawning. Edited October 13, 20204 yr by urbanxx001
October 14, 20204 yr Author 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 October 14, 20204 yr by urbanxx001
October 14, 20204 yr Author 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 October 14, 20204 yr by urbanxx001
October 14, 20204 yr Author 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 October 15, 20204 yr by urbanxx001
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.