Jump to content

Recommended Posts

Posted

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.

Developer of Levels and Lost Eclipse

Posted

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.

Developer of Levels and Lost Eclipse

Posted

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.

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.

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.