mojira.dev
MC-87122

Chain command blocks can not be triggered twice from seperate chains

Introduction

I know that it is intended that one chain can not infinitely run itself over and over again in one tick. This report is not about this fact but rather about a problem which is caused indirectly by the way the "loop problem" is solved.
This report is somehow also about resource saving map making.

Problem

Imagine you have two different chains both doing something different but triggering the same command at the end.

Here is an example:

CCB

CCB3

CCB

CCB1

CCB2

Key:

  • CCB: chain command block without command

  • CCB#: chain command block with command

CCB1: /scoreboard players set @p[name=Notch] test 1
CCB2: /scoreboard players set @p[name=Dinnerbone] test 2
CCB3: /say @a[score_test_min=1]

Chains:

  1. CCB1 -> CCB -> CCB3

  2. CCB2 -> CCB -> CCB3

I know this example is pretty simple but it shows that this would need only 3 command blocks. However at the moment this is not possible and you would need two seperate chains both containing one exact command: /say @a[score_test_min=1] (CCB3).

On a large scale this has really a great impact and saves a lot of command blocks.

Possible solution

Currently there is probably a list containing all scheduled command blocks and then the game does this:

  1. Start chain

  2. Test if next chain member is not in scheduled command blocks list

    1. If true continue with step 3

    2. If false continue with step 2

  3. Schedule this chain command block for this tick

  4. Add command block to scheduled command blocks list

  5. Continue step 2 until chain finishes

  6. Continue step 1 until all impulse and repeating command blocks were executed

And now a possible solution:

  1. Start chain

  2. Test if next chain member is not in scheduled command blocks list

    1. If true continue with step 3

    2. If false continue with step 2

  3. Schedule this chain command block for this tick

  4. Add command block to scheduled command blocks list

  5. Continue step 2 until chain finishes

  6. Clear sheduled command blocks list

  7. Continue step 1 until all impulse and repeating command blocks were executed

Linked issues

Comments 3

Are both of these chains powered/triggered by the same thing?

Yes both are triggered by one /fill command

So really, the issue is that a chain command block cannot be actively part of 2 separate chains. I can confirm this.

marcono1234

michael

Confirmed

chain_command_block, command_block, repeating_command_block

Minecraft 15w34d, Minecraft 15w45a

Retrieved