-
Bug
-
Resolution: Unresolved
-
None
-
1.21.4, 25w02a
-
None
-
Community Consensus
-
Commands
The bug
Some commands, such as /data get, will round decimals down as their result. Other commands, such as /attribute ... get, will truncate decimals to a whole number, resulting in an inconsistency for handling negative numbers.
Steps to reproduce
- Summon a cow with a maximum health of 7.3
/summon cow ~ ~ ~ {attributes: [{id: "minecraft:max_health", base: 7.3d}]} - Create a scoreboard
/scoreboard objectives add MC-279197 dummy /scoreboard objectives setdisplay sidebar MC-279197
- Attempt to store the maximum health via /data and /attribute
/execute store result score data_get MC-279197 run data get entity @n[type=cow] attributes[{id: "minecraft:max_health"}].base -1 /execute store result score attribute_get MC-279197 run attribute @n[type=cow] minecraft:max_health get -1 - Take note as to whether these two commands have consistent behavior for rounding negative numbers.
Observed results
/data rounds the result down to -8, while /attribute truncates the result to -7.
Expected results
The results of /data and /attribute should be the same, both being -7 or -8.
Additional notes
Relates to MC-276879.
If this issue can be considered valid, I would be glad to provide more information about other related commands.
- relates to
-
MC-276879 Floats are truncated when cast to longs with /data, all other cases round down
- Open