mojira.dev
MC-97060

Repeating command runs one iteration to much

When you stop a repeating commandblock with /setblock later in the chain, the whole chain still runs an extra iteration. Only if the repeating commandblock itself executes the /setblock command execution is stopped immediately.

This can easily be observed with the following setup:

  • Create a repeating commandblock that needs redstone

  • Enter the command: /say hi

  • Create a chain command next to the first (in positive x direction). It should be always active

  • Enter the command: /setblock ~-2 ~ ~ stone

  • Place a redstone block in negative x direction next to the repeating commandblock

What I observed is that it will print hi two times.

What I expected to happen is only one hi.

It is very interesting that if you switch the commands:

  • repeating: /setblock ~-1 ~ ~ stone

  • chain: /say hi
    it correctly prints only one hi.

This is a really annoying bug, because if i have loops that should terminate at some point, they always run one time to much. This messes up a lot of things like scoreboard counter, continuous teleportation.

Linked issues

Attachments

Comments 4

Before tagging MC-92070 for review, just to make sure: Have you read http://pastebin.com/7F1yvEWF and still think it should be tagged for review?

I read it and I (think) I understand the reason for the implementation.
I still think this should be flagged for review.
In my opinion the chain should be traversed twice, first to execute all commands, then to schedule all commands for the next tick.
This would then behave just like anyone who does not know the implementation would expect it to behave.
The traversing should not cause performance problems I think.
If it would, the first traversing could cache the chain for the second one.

Has this been reviewed? Is there any chance this will get changed?

Adrodoc55

(Unassigned)

Unconfirmed

Minecraft 16w06a

Retrieved