Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-88961

saving the game can appear to happen 'mid-tick', violating command block contracts


    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • None
    • Minecraft 15w38b, Minecraft 16w36a, 1.15
    • None
    • Confirmed
    • (Unassigned)

      (I have not investigated yet to see if 'chunk boundaries' are essential to this issue, but regardless, I consider this a serious bug.)

      To start, run

      scoreboard objectives add S dummy
      scoreboard objectives setdisplay sidebar S

      Suppose I have an impulse command block (ICB) followed by 200 chain command blocks (CCB). The ICB has no command. Each CCB has

      scoreboard players add Score S 1

      Set a redstone block next to the ICB, and the score goes up to 200. Break it, set it again, it goes to 400. Again, 600. Etc.

      It's an invariant that the score displayed in the sidebar will always be a multiple of 200 at the end of a tick.

      Now, change the ICB to a repeating command block (RCB). Activate it with redstone. Score counts very fast, but if you disable the RCB, the score will stop on some score that's divisible by 200.

      Even if the RCB is powered, hitting escape to pause the game in single player will also show that the 'user input loop' is synchronized to the 'tick' loop, as each time you pause the game, the score displayed in the sidebar always is divisible by 200.

      Now, leave the RCB powered, score counting, and save & exit. Re-enter the world, score is counting, but now un-power the RCB and... the score is no longer divisible by 200!

      'save and exit, then restart game' has broken a very basic invariant of this simple command block program.

      I have not investigated deeper; my guess is that chunk boundaries may be at play, and the 'scheduled ticks' in the chunk get reloaded/reordered wonky somehow at save or at load. But in any case, save & exit and then reload seems like it ought to work, at least under certain not-too-limited conditions.

            Unassigned Unassigned
            brianmcn Brian McNamara
            6 Vote for this issue
            8 Start watching this issue