Relative teleports (tp ^ ^ ^, tp ~ ~ ~) works only once in datapack
as an example:
tp @s ^ ^ ^1 <---- works fine
tp @s ^ ^ ^1 <---- doesn't work
tp @s ^ ^ ^1 <---- doesn't work
this inluce using tp in recursive funcion calls.
I attached a simple mc function to demonstrate it, and the ss of the result (white color means where is it to be expected and red is actual position).
[media]This bug was not in version 1.16.2, however in version 21w20a this report (MC-226206) says about similar problem relative to command block.
This works as intended. The position in the command is relative to the context position, i.e. where the function was called from. So if you do
execute positioned 0 0 0 run function ...
, you will end up one block away from 0 0 0. If you want to use the position of @s as the context position, useexecute at @s