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

execute store sometimes does nothing

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 1.16.5, 21w18a
    • None
    • Independent
    • Unconfirmed

      Some specific commands of `execute store result/success ..` do nothing.

      It is common to emulate an and-gate like this: `execute store result score result foo if score cond_a foo matches 1 if score cond_b foo matches 1`.

      What I expected to happen was...:
      I expect that the variable `cond_a foo` is set to 1 if `cond_a` and `cond_b` both match 1. Otherwise the variable `cond_a foo` should be set to 0.

      What actually happened was...:
      If `cond_a` does not match 1 (aka the first subcommand fails) the value `result` does not get updated at all. This is problematic, because the `result` could be initialized to some arbitrary value other than 0 which will lead to invalid logic.

      Steps to Reproduce:

      1. create a scoreboard object, for example `scoreboard objectives add foo dummy`

      2. set the value `return` of the scoreboard to 1, and the value `zero` to 0: `scoreboard players set result foo 1` and `scoreboard players set zero foo 0`

      3. check if the score `zero` matches 1 and if the score `zero` matches 1 (the second condition can be anything but the first check must fail): `execute store result score result foo if score zero foo matches 1 if score zero foo matches 1`

      4. Notice that the score `result` still has the value 1, even though it should be zero

       

            Unassigned Unassigned
            Inky Inky
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: