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

Function positional offset applies repeatedly/too late

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened
    • Resolution: Unresolved
    • Affects Version/s: 1.17.0.50 Beta, 1.16.220
    • Fix Version/s: 1.17.0.58 Beta
    • Labels:
      None
    • Confirmation Status:
      Confirmed
    • Platform:
      Windows 10 - PC
    • ADO:
      537173

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                CHK: