Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-124890

Function positional offset applies repeatedly/too late

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 1.17.0.58 Beta
    • 1.19.10.20 Preview, 1.17.40.23 Beta, 1.17.40.21 Beta, 1.17.0.50 Beta, 1.16.220, 1.17.30, 1.17.32
    • None
    • Confirmed
    • Windows
    • 537173

      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.

            tryashtar [Mod] tryashtar
            Votes:
            2 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: