-1

I am want to get position of the player at every game tick. Then using position of player at tick n and tick n+1 we can calculate speed of player at anytime. The problem i am facing is how do i get the position of player at any game tick as a variable in .json file or .mcfunction file to perform an operation.(In Minecraft Java edition )

0

You could save the nbt of the player's position in nbt storage using the data command and at each new tick look at the difference in the two values (the saved and the current player data) so it would be like this.

'difference calculator'
'nbt save'

Using scoreboards would be better if it works. With scoreboards it looks something like this.

'difference calculator'
/execute as @a at @s store result score @s pastpos run data get entity 'position directory'

I hope this helps.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.