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

Function position refers to executor instead of command origin when not using /execute


    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • Beta, Preview, Beta, Beta, Beta, 1.17.11 Hotfix, Beta, 1.16.220, Beta, 1.8.0, 1.10.0, 1.11.0, 1.13.0, 1.16.100, 1.16.101 Hotfix, 1.17.30, 1.17.32
    • None
    • Confirmed
    • Windows
    • 166539

      The bug

      The following commands are supposed to be indistinguishable:

      /function cmd
      /execute @s ~ ~ ~ function cmd

      However, this is not the case for some functions.
      Consider the following function:

      tp @s ~ ~5 ~
      setblock ~ ~ ~ stone

      The expected behavior this function is that you are teleported 5 blocks up, then stone is placed on the ground where you used to be. If this seems confusing, please understand that relative coordinates are relative to the position the command was run from, not the position of @s. This is well-established and works correctly in many other situations.

      The function works differently depending on if you put /execute @s ~ ~ ~ in front of it, breaking the first assumption. With the /execute, it works correctly, but without it, it fails, teleporting the player ten blocks in the air.

      How to reproduce

      1. Download and open the attached world
      2. /execute @s ~ ~ ~ function teleport_block
      The block was placed on the ground
      3. /function teleport_test
      The block was placed in mid-air

            Nusiq Nusiq
            9 Vote for this issue
            5 Start watching this issue