mojira.dev
MC-192981

Modifying entity attribute modifier values does not properly update nbt data

When using the "/data" command to modify entity attribute modifier amounts, nbt data is not updated/displayed despite returning a "success" when the command is executed. However, the desired value is grabbed when using the "attribute" command. 

How to Reproduce:

Summon a dummy entity with a certain attribute (I chose max_health).

/summon minecraft:armor_stand ~ ~ ~ {Tags:["dummy"],Attributes:[{Base:20.0d,Name:"minecraft:generic.max_health"}]}

Add an attribute modifier of "Amount" 1.0 to max_health using the attribute command (see picture 1 to view the nbt after the attribute command was applied).

/attribute @e[tag=dummy,limit=1] minecraft:generic.max_health modifier add 0a-1a-2a-3a-4a test 1.0 add

Use the data command to modify the modifier "Amount" value to 2.0d (This should return successful).

/data modify entity @e[tag=dummy,limit=1] Attributes[{Name:"minecraft:generic.max_health"}].Modifiers[0].Amount set value 2.0d

Grab the modifier "Amount" value from the entity's nbt using the data command (This should return: 1.0d).

/data get entity @e[tag=dummy,limit=1] Attributes[{Name:"minecraft:generic.max_health"}].Modifiers[0].Amount

Grab the modifier "Amount" value using the attribute command with a scale of 1. This should return 2.0d, which is a discrepancy (see picture 2)

/attribute @e[tag=dummy,limit=1] minecraft:generic.max_health modifier value get 0a-1a-2a-3a-4a 1

Linked issues

Attachments

Comments 2

Can confirm in 20w51a.

I cannot reproduce this issue in Minecraft 1.20.5 pre-release 1.

Jacob Canepa

(Unassigned)

Confirmed

(Unassigned)

1.16.1, 1.16.4, 20w51a, 23w31a

Retrieved