mojira.dev
MC-95680

/stats (CommandStats) doesn't work for MinecartCommandBlocks

A MinecartCommandBlock with CommandStats does not update the given scoreboard objective upon executing the command, whether it is successful or not.

Steps to reproduce:

1. Create a new score:

/scoreboard objectives add myscore dummy

2. Set the display of this score:

/scoreboard objectives setdisplay sidebar myscore

3. Initialize your score:

/scoreboard players set @p myscore 0

4. Summon a MinecartCommandBlock:

/summon MinecartCommandBlock ~ ~ ~

5. Use the /stats command to populate the MinecartCommandBlock's CommandStats:

/stats entity @e[type=MinecartCommandBlock,r=1] set SuccessCount @p myscore

6. Confirm the CommandStats exist and are correct:

/entitydata @e[type=MinecartCommandBlock,r=1] \{}

7. Enter a command you know will succeed into the MinecartCommandBlock, such as:

say Hello world!

8. Run the MinecartCommandBlock (e.g. by pushing it on to a powered activator rail) and notice that your score does not change.

Current workaround:
Oddly enough, it does work if you have the MinecartCommandBlock execute the original command through itself:

execute @e[type=MinecartCommandBlock,r=0] ~ ~ ~ say Hello world!

However, in order for this workaround to be reliable you must give the MinecartCommandBlock a unique custom name and execute the command through this name. Even so, this should not be necessary as the MinecartCommandBlock is the entity who is invoking the command in the first place. The CommandStats should update the respective score(s) without having to use the otherwise redundant execute command.

Comments 6

Cannot confirm. Score changes as expected.

Confirmed, does not work via the /stats command instantly but relogging does fix it. Directly applying the CommandStats (as I did at first) does work right away:

/summon MinecartCommandBlock ~ ~1 ~ {CommandStats:{SuccessCountName:"@p",SuccessCountObjective:"OBJ"},Command:"testfor @e"}

Also unable to remove any triggers on a minecart command block via /stats (relogging does not fix).

Confirmed for 16w04a.

Confirmed for 1.9 pre-3.

Confirmed for 1.9.4. As Skylinerw suggests, it would seem the MinecartCommandBlock must be reloaded before CommandStats applied via /stats will be realized.

I wouldn't say this is a priority issue, considering it's possible to summon the entity with CommandStats already in-place (and that most players probably already do this). Nonetheless, it is a bug.

Can confirm for MC 1.12.1.

No longer relevant in 1.13

Arcensoth

(Unassigned)

Confirmed

Minecraft 1.8.9, Minecraft 16w02a, Minecraft 16w04a, Minecraft 1.9 Pre-Release 3, Minecraft 1.9.4, Minecraft 1.10.2, Minecraft 1.12.1

Retrieved