Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-273079

`/return run execute <fork>` stops forking early

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Works As Intended
    • None
    • 1.20.6, 1.21 Pre-Release 4
    • None
    • Confirmed
    • (Unassigned)

      Enter the following command with multiple entities in the world:

      /return run execute as @e run say hi
      

      I expect that to completely evaluate everything to the right of the return before returning, as it would in a normal programming language, saying "hi" for each entity. Instead, it only says "hi" once, acting the same as the following command which does work as expected:

      /execute as @e run return run say hi
      

      This bug does not occur when execute as @e run say hi is moved into a function:

      return run function test:test
      
      # function test:test
      execute as @e run say hi
      

      This says "hi" for each entity as expected. The first command should behave the same; moving a command to another function and calling the function instead of running the command generally shouldn't change any behavior.

      Edit:
      This behavior is documented in https://www.minecraft.net/en-us/article/minecraft-snapshot-23w41a:

      The changelog lists two related bullet points above. The latter point was undone due to the behavior being confusing, since return run implies it will always run the command to the right of it and then end the calling function with the same result as the command it ran. But I suspect that rule was simply neglected for the former related point when the latter point was fixed, since it's not as common for people to use return run execute.

            Unassigned Unassigned
            GrantGryczan Grant Gryczan
            Votes:
            10 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: