mojira.dev
MC-125058

"/execute store success" doesn't store 0 when a condition fails

The bug

It seems that if a condition in the execute command fails, then the "success" value is not set to 0 when using execute store success.

How to reproduce

  1. /scoreboard objectives add was_successful dummy
  2. /scoreboard objectives setdisplay sidebar was_successful
  3. Switch to hotbar slot 1

  4. /execute store success score @s was_successful if data entity @s {SelectedItemSlot:0} run say Moo

    ✔ The score was set to 1 as expected

  5. Switch to a different hotbar slot and run the command in step 4 again
    ❌ The score is still 1 even though the condition failed

Linked issues

Comments 7

Confirmed for 1.13.1

Still in 1.14.1 Release

Still in 1.14.2 Pre-Release 1 and 1.14.2 Pre-Release 2

This bug is also present while doing something like /execute store success score @s was_successful run data get entity [<path>]. If no such NBT tag is found, the success stores is 1, while it should be 0.

Affects 1.17.1.
A slightly quicker way to test it uses only these 3 commands:

/scoreboard objectives add was_successful dummy
/scoreboard objectives setdisplay sidebar was_successful
/execute store success score @s was_successful if data entity @s {SelectedItemSlot:0} run say Moo

Observe that the third command only updates your score if your SelectedItemSlot is 0.

Edit: I've updated the description to use this method since it's much more concise.

e.g. /execute store ... run A

Currently, the store subcommand stores the result of command A, rather than the /execute command itself. So, if command A is not executed, there is no success value and result value.

This is reasonable, but sometimes may be counter-intuitive. Though I don't recommend fixing this, it's up to Mojang.

To fix this, brigadier must be changed so that the feedback consumer is called when the /execute command is finished without executing command A.

Simon816

(Unassigned)

Confirmed

Platform

Normal

Commands

/execute-store, command

Minecraft 18w06a, Minecraft 1.13-pre4, Minecraft 18w32a, Minecraft 1.13.1, Minecraft 1.14, ..., 1.21, 1.21 Release Candidate 1, 24w40a, 24w44a, 1.21.4

Retrieved