TransWikia.com

Why does my third command block still run even though a command before failed?

Arqade Asked by vain_alibi on March 17, 2021

I am on Windows 10 1.16.1 Minecraft
I have a line of three command blocks:
An unconditional impulse that needs redstone,
A conditional chain that is always active,
An unconditional chain that is always active

Impulse
Unconditional
Needs Redstone

Command Input:
testforblock 68 5 21 redstone_block

Previous Output:
The block at 68,5,21 is Air (expected: Block of Redstone).

Chain
Conditional
Always Active

Command Input:
tag @p add Blue

Previous Output:
Added tag 'Blue' to Vain Alibi

Chain
Unconditional
Always Active

Command Input:
execute @e[type = armor_stand, name = "Blue Room"] ~ ~ ~ title @p actionbar You've chosen §6Kapkan

Previous Output:
Title command successfully executed

After powering the impulse, I don’t get the tag added to me, as expected because the impulse fails, and the first chain is conditional, but somehow the title from the second chain still shows. I can confirm that the block the first command block is searching for is NOT there, and that when I check my tags afterwards, I do NOT get the tag. Though somehow the title still shows, does anybody know how this is possible?

One Answer

When a conditional chain command block doesn’t run (like your test example), it doesn’t stop the entire command chain, it merely skips the command and moved on to the next step. So this is what happens:

  1. /testforblock 68 5 21 redstone_block
    
    Fails, the block is Air.
  2. /tag @p add Blue
    
    Does not run. The first command block failed, but moving onto the next step anyway.
  3. execute @e[type = armor_stand, name = "Blue Room"] ~ ~ ~ title @p actionbar You've chosen §6Kapkan
    
    Runs. This command block is not conditional, so it always runs.

In your case, you’ll need to make the 3rd command block conditional so that it doesn’t run if the 1st one fails.

Correct answer by ExpertCoder14 on March 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP