Function positional offset applies repeatedly/too late
The bug
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.
How to reproduce
Create a function with the following contents
tp @s ~ ~ ~ tp @s ~ ~ ~ tp @s ~ ~ ~ tp @s ~ ~ ~ tp @s ~ ~ ~ tp @s ~ ~ ~ tp @s ~ ~ ~ tp @s ~ ~ ~ tp @s ~ ~ ~ tp @s ~ ~ ~
Run the function with the following command:
/execute @p ~ ~1 ~ function whatever
Expected result
You get teleported one block up.
Actual result
You get teleported ten blocks up.
Notes
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.
2021-04-13, 05:02 AM
2022-05-26, 06:05 AM
2022-05-26, 06:05 AM
2
0
537173