Attribute values cannot be stored accurately by /execute store
I've tried multiple different methods, but "execute store result" is unable to read the attribute "generic.movement_speed". Regardless of how I write the command, or where I read it from (Both item attribute modifiers and entity attribute modifiers), the result is always 0, The command's feedback is correct, it lists my current movement speed, but both storages and scoreboards are unable to read the value of my movement speed. All other attributes are fine, giving the correct value
Environment
Windows 10, 1.19.2
Linked Issues
Created Issue:
Movement Speed Attribute not translating into Execute store
I've tried multiple different methods, but "execute store result" is unable to read the attribute "generic.movement_speed". Regardless of how I write the command, or where I read it from (Both item attribute modifiers and entity attribute modifiers), the result is always 0, The command's feedback is correct, it lists my current movement speed, but both storages and scoreboards are unable to read the value of my movement speed. All other attributes are fine, giving the correct value
Environment
Windows 10, 1.19.2
Movement Speed Attribute not translating into Execute storeAttribute values cannot be stored accurately by /execute store
is duplicated by
Thank you for your report!
We're tracking this issue in MC-261025, so this ticket is being resolved and linked as a duplicate.
That ticket has already been resolved as invalid. Please take a look at the parent ticket (MC-261025) and see if an explanation is provided there in the description of the ticket or in the comments for why this issue is invalid.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
Command result is floored (rounded down) before storing, only integer values can be command result values.
If you want to clone the value, use /data modify, or /data get with a scale value.
See also
MC-132503,MC-121824andMC-245583.I've tried that Dhranios... That's how I get percentage values, I have tried the command:
My movement speed value is 0.4. It should return 400.0f, but it returns 0.0f
I'm also trying to pull it from the attribute command, so I don't have to calculate what my speed at any time is (I have upgrades that increases the player's movement speed by 0.02 or 0.01)
You need to put the scale at the end of the attribute command
Thx tryahtar, I did not know that you had to (or even could) place the scale at the end of the command,
But it still feels off to me, Everything else you can place the scale factor in the after the execute store and get the proper value, only the movement speed attribute does this,
Yeah it's a bit weird. But the reason is that commands can only return integers.
For example:
/data modify storage blah blah set value 0.5f /execute store result storage blah blah2 float 1000 run data get storage blah blahJust like /attribute, this won't work because the /data get part of the command must return an integer.
Since there are very few commands that even have access to fractional numbers, the rounding to an integer happens very rarely. When it does, a scale is provided for exactly this purpose.