When using a command with the motion NBT tag, such as @a[nbt={Motion:[0d,0d,0d]}], a command block does not appear to check player's motion.
Using a single player world, I have a repeating command block set to always active with the command: execute if entity @a[nbt={Motion:[0d,0d,0d]}] I then attached a comparator next to it to see when it is successful or not. When I am not moving, the comparator is active as expected indicating it found a player with a motion of 0 (me). However, when I start moving so that I have a motion unequal to 0, the comparator never turns off as expected since it should not be finding a player with a motion of 0.
Linked issues
Comments 3
Oh, you are completely correct. I tested it in a few versions and they all worked how you said. Thank you for the explanation as to why too, I appreciate it. Have a good day!
For anyone who finds this later, use a scoreboard with a objective tracking how far a player has walked and then just test when it changes.
Thank you for your report!
We're tracking this issue in MC-73887, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
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:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – ✍️ Feedback and Suggestions – 📖 Game Wiki
-- I am a bot. This action was performed automagically! Please report any issues in Discord or Reddit
This is intended due to NBT list matching.
Motion:[0d,0d,0d]
is the exact same asMotion:[0d]
– both will succeed as long as the list has a single zero in it. For example, if you're not moving vertically, your Y motion will be zero and the NBT check will pass. Same asMotion:[0d,0d,0d,0d,0d,0d,0d,0d,0d,0d]
.