Affects Version/s: 188.8.131.52 Beta, 1.16.220
Fix Version/s: None
Platform:Windows 10 - PC
When a function is run with modified coordinates via /execute, it's supposed to run at those coordinates (makes sense). However, instead it repeatedly re-evaluates those coordinates for each command relative to the executing entity, which does not make sense and is very confusing.
Create a function with the following contents
Run the function with the following command:
/execute @p ~ ~1 ~ function whatever
You get teleported one block up.
You get teleported ten blocks up.
This is closely related to MCPE-39785. It might be fixed if bedrock edition finally gets the update aquatic version of /execute.
Currently, the function is treated as if every command had /execute @s ~ ~1 ~ in front of it. Bedrock seems to have a weird notion of function context, containing a sender (@s) and sender-relative re-evaluated coordinates. That is wrong, the correct context is a sender and an absolute context position, from which all commands in the function are sourced. Teleporting the sender should not affect the context position at all, and you can use /execute to explicitly re-sync them.
In other words, the position argument of /execute should be a position, relative to the sender, to run all commands from. Currently it's a position to run all commands from, relative to the sender. That distinction is very important and the cause of this bug.