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
.
Thank you for your report!
After consideration, the issue is being closed as Working as Intended.
Please note, that mechanics of the game may change between updates.
Things such as graphics, sounds, world creation, biomes, redstone, villagers, and animals may not work the same in current versions.
Full Version History – Snapshot Version History – The official Minecraft feedback site
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki