Minecraft – the data tag used to check success on a command block

minecraft-java-edition

I need to do test to see if a command block has succeeded but the command in the commandblock does not emit a comparator signal!

Best Answer

Command blocks are of Tile Entity type "Control". According to the wiki:

Control has these additional fields:

  • Command: The command to issue to the server.
  • SuccessCount: Represents the strength of the analog signal output by redstone comparators attached to this command block. Only updated when the command block is activated with a redstone signal.
  • LastOutput: The last line of output generated by the command block. Still stored even if the gamerule commandBlockOutput is false. Appears in the GUI of the block when right-clicked, and includes a timestamp of when the output was produced.
  • TrackOutput: 1 or 0 (true/false) - Unknown.

Since your command does not yield a redstone signal, the only way to detect the outcome of the command block via data tags is to read LastOutput.