How to modify attribute data?


#1

I’m relatively new to sponge, so I apologize if this is a stupid question. I’ve been searching over the docs for about an hour, and I can’t seem to find any way to effect attribute data. All I’ve found so far is the data API, which would allow me to change health and movement speed, but not combat effects. I’d like to be able to change a players combat abilities (attack speed, damage, health, armor, knockback) without resorting to potion effects (unless there is some way to prevent gameplay from interacting with effects that I add). Is there a way to either access minecraft attributes or apply these changes in a safe way?


#2

I dont believe so based on this issue i found.


#3

Alright, thanks.


#4

Looking at the wiki with given examples of setting it, it just looks like a nbt tag data?

for items it should be quite easy, just create a DataContainer, Set the ItemName, Count, UnsafeDamage ( Meta) and then nbt as UnsafeData, which seems to be
DataContainer item
item.set(DataQuery.of(“UnsafeDamage”, “AttributeModifiers”), List ) ?


#5

That works, but using raw NBT isn’t recommended in Sponge.

If you’d like the attribute API added, leave a message in the link @MoseMister posted. That helps us know what people want us to focus on.