TheXFactor117 Posted April 16, 2017 Posted April 16, 2017 I am trying to change attributes like attack damage and attack speed of existing items, but I'm wondering what the best way to do this would be. Right now, I can change the values perfectly fine through creating and setting a new NBTTagCompound to the item. However, I'm wondering if this is the best way to do it, or even if it's the only way. I noticed a few limitations, considering it basically rewrites ItemSword's tooltip in favor of a blue text instead, though, with this, the Attack Speed value displayed isn't necessarily correct. Sword's by default have a -2.4 attack speed modifier, but changing the attributes like I did means the number won't get added to the player's base attack speed (which is 4, which would equal 1.6). The Attack Speed gets correctly set but is instead displayed as a negative number, which can be misleading. I've tried changing the tooltip, but retrieving the value in the attribute is hard to get, and when I do retrieve it, it is always the default -2.4. I feel like I'm not doing this right, but if anyone knows a way around this or has a better way of doing it, I would appreciate it. Quote Developer of Levels and Lost Eclipse
Leomelonseeds Posted April 17, 2017 Posted April 17, 2017 Try using attribute modifiers. Quote Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.
TheXFactor117 Posted April 17, 2017 Author Posted April 17, 2017 That's what I'm doing. Manually adding the NBT data to the item seems to override the default AttributeModifiers, which I think is the only way to do this. Quote Developer of Levels and Lost Eclipse
Leomelonseeds Posted April 18, 2017 Posted April 18, 2017 I don't think you need NBT to modify the attributes... I'm not sure, but I do think that this is the only way. Quote Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.
Recommended Posts
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.