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

When using /execute store or if/unless score, execute sub-commands only run (for each entity), if store/score entity selector finds at least one entity for each execution

XMLWordPrintable

    • Confirmed

      The bug

      This is basically MC-121934, but only for certain cases. Currently known to be affected:

      • /execute store (result|success) entity
      • /execute store (result|success) score
      • /execute (if|unless) score

      Reproduction steps for store, provided by @brianmcn:

      /summon minecraft:pig ~ ~ ~ {NoAI:1b,Tags:["foo","A"]}
      /summon minecraft:pig ~ ~ ~ {NoAI:1b,Tags:["foo","B"]}
      /scoreboard objectives add X dummy
      /scoreboard objectives setdisplay sidebar X
      /scoreboard players set @e[tag=foo] X 42
      /execute as @e[tag=foo] at @s store result score @s[tag=A] X run say hi
      /execute as @e[tag=foo] at @s store result score @s[tag=B] X run say hi
      /execute as @e[tag=foo] at @s store result score @s[tag=foo] X run say hi
      

      Expected behavior: In the last 3 lines, A and B to update the score of each respective pig only, and the final line updates both scores.
      Actual behavior: The first 2 of the last 3 lines fail and only the final line updates both scores.


      Reproduction steps for if/unless score:

      /summon armor_stand ~ ~ ~ {NoGravity:1b,Marker:1b,Tags:[A],CustomName:"\"A1\""}
      /execute at @e[tag=A] run summon armor_stand ~ ~ ~1 {NoGravity:1b,Marker:1b,Tags:[A],CustomName:"\"A2\""}
      /scoreboard objectives add X dummy
      /scoreboard objectives setdisplay sidebar X
      /scoreboard players set @e[tag=A] X 1
      /execute as @e[tag=A] at @s positioned ~ ~ ~1 run say @e[distance=..0.1]
      /execute as @e[tag=A] at @s positioned ~ ~ ~1 if entity @e[tag=A,distance=..0.1,limit=1] run say hi
      /execute as @e[tag=A] at @s positioned ~ ~ ~1 if score @e[tag=A,distance=..0.1,limit=1] X = @s X run say hi
      

      The third to last line is just to ensure the setup is correct, expected (and actual) output is

      [A1] A2
      [A2] 
      

      The second to last line is to demonstrate that 'execute..as..at..if entity' works with a particular selector, it correctly outputs "[A1] hi".

      The final line fails "No entity found". It should succeed exactly as the previous line does, since the scores match (all are 1).


      Code analysis

      Code analysis by brianmcn can be found in this comment.

            dinnerbone [Mojang] Nathan Adams
            Winter_Snake Ryan Smith
            Votes:
            9 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: