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

Nested /execute commands can only store success/result once

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 1.13-pre3
    • Minecraft 18w02a, Minecraft 18w19b, Minecraft 1.13-pre1
    • None
    • Community Consensus

      Note that while the report describes an example where multiple execute commands are nested, this also affects single execute commands where one wants to store success and result at the same time, or either of them into multiple targets.


      When stacking /execute multiple commands of which more than one has a store subcommand, only one (the last) store actually takes effect. Reproduction steps:

      1. Set up a flatworld with no entities except for the player
      2. Set up a scoreboard objective and spawn some test entities:

      /summon minecraft:armor_stand
      /summon minecraft:armor_stand ~ ~ ~ {CustomName:"\"Named\""}
      /scoreboard objectives add counter dummy
      /scoreboard objectives setdisplay sidebar counter
      /scoreboard players set @e counter 10
      

      Run the following stacked /execute command which should affect the counter objective for both armor stands and observer that it only updates it for one of the armor stands:

      /execute as @e[name=Named] at @s store success score @s counter run execute as @e[distance=..3,name=!Named] store success score @s counter run say hi
      

      To verify that both store}}s work individually, you can take out one of them and run the command this way (after again setting the {{counter objective for all entities to a value not attainable from the command):

      /scoreboard players set @e counter 10
      /execute as @e[name=Named] at @s store success score @s counter run execute as @e[distance=..3,name=!Named] run say hi
      

      and for the other armor stand:

      /scoreboard players set @e counter 10
      /execute as @e[name=Named] at @s run execute as @e[distance=..3,name=!Named] store success score @s counter run say hi
      

      Note that this may also be an issue when leaving out the run execute in the middle, however it is unclear whether repeated subcommands of /execute are intended to not overwrite each other.

            boq [Mojang] Bartosz Bok
            redstonehelper [Mod] redstonehelper
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: