The /attribute
command allows you to apply modifiers of 3 different kinds: add
, multiply
and multiply_base
.
The add
mode behaves exactly like you'd expect. If the current value of the attribute is [{color:#ff8b00}x{color}]
and you want to add [{color:#ff8b00}y{color}]
, the new value will be [{color:#ff8b00}x + y{color}]
.
The issue is with the two other modes, multiply
is not as straightforward. With a name like that, you'd expect the game to multiply the two numbers and set the product as the new value, which would be [{color:#ff8b00}xy{color}]
. However, the game adds the result of the multiplication on top of the current value, making it [{color:#ff8b00}x + xy{color}]
instead. The multiply_base
mode behaves the same, except [{color:#FF8B00}x{color}]
is the base value of the attribute instead of the current one.
Steps to Reproduce:
Run the command
/attribute @s minecraft:generic.attack_damage get
to check the current value of the attribute "Attack Damage"
— The current value is 1.0Run the command
/attribute @s minecraft:generic.attack_damage modifier add 00000000-0000-0000-0000-000000000000 test 2.0 multiply
Check the value of the attribute once again.
Observed Results:
The new value is 3.0
Expected Results:
The new value is 2.0
It appears the functionality never changed (multiply is used for the percentage increase/decrease by, for example, potions), however it makes it misleading.
/attribute @s minecraft:generic.attack_damage modifier add 00000000-0000-0000-0000-000000000000 test 2.0
Results in a +200% attribute modifiers, which is the same as a total of 300%, which matches the behavior observed.If the argument was named "add_multiplication" it'd be a lot clearer.
Currently you will have to use negative values to decrease the amount, which is contradictory to multiplication, where just a value less than 1 does that (x0.5 = /2, not +0.5%).
No ability is lost with the current implementation, but it's a lot less clear and causes confusion due to the modifier operation name not making the fact it's an addition clear.