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

/return run function in combination with a fork and a function that doesn't return has inconsistent behavior


    • Icon: Bug Bug
    • Resolution: Fixed
    • 23w51a
    • 1.20.4 Release Candidate 1, 1.20.4
    • None
    • Community Consensus
    • Commands, Data Packs
    • Normal
    • Platform

      The /return run when applied to a fork and a /function that doesn't return causes different behavior depending whether it is run in chat, inside of a function or using /debug function.

      How to reproduce:
      The attached data pack contains a function called bugtest:test with the following command:

      execute as @e[tag=selected] run return run function bugtest:test2

      The function bugtest:test2 is a small function that just contains the command "say Test" and doesn't return.

      Now spawn multiple entities with the tag "selected", e.g. using the following command:

      summon armor_stand ~ ~ ~ {Tags:["selected"]}

      Then run the following commands:

      1. The command above directly in chat (the one with /return run)
      2. /function bugtest:test
      3. /debug function bugtest:test

      Observed behavior:
      1. and 3. The message "Test" appears for every entity spawned.
      2. The message "Test" appears once and the function returns.

      Expected behavior:
      In all of the cases the message should only be shown once and return since /return run is supposed to always return.

            Unassigned Unassigned
            Rob23 Rob23
            2 Vote for this issue
            3 Start watching this issue