mojira.dev

Big_Con

Assigned

No issues.

Reported

No issues.

Comments

So the best way I've found to make a motion comparison is to make 3 dummy scoreboards (one for each axis) and have any entity you are comparing store each axis's movement separately in those scoreboards. Then, make the comparison BASED on the scoreboards, rather than raw NBT data. This is accomplished through "/execute as [Target Selector like @e] store result score @s [Scoreboard Name for one of the axis's] run data get entity @s Motion[(0,1, or 2 based on which axis (x, y, or z) you want for this command, make sure the scoreboard name matches)] 100" running in 3 repeating command blocks set to always active, with each command block set to different scoreboards and the different axis's. This way, whenever you want to know if an entity is not moving, it will have an X value of 0, a Y value between -8..0 (due to Minecraft applying downward motion constantly when an entity is on the ground), and a Z value of 0. Of course, you can now target select for this condition and it will only be true when that entity is not moving. If you want more precision you can increase the scale factor at the end of the data get command (I use 100 because it is enough for my purposes), the only difference is that the entity's Y motion will increase by a power of 10, and that allows for less rounding (at a scale of 100 it is -8..0, but at a scale of 1000 it would be technically -79..0 due to the previous number being rounded. The real force downward is -0.0784000015258789, so just round this to your scale). Hopefully, this will help someone else!