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

Observers react to updates if they already have a scheduled tick

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Won't Fix
    • Affects Version/s: 1.15.2, 1.16 Pre-release 6, 1.16 Pre-release 7, 1.16, 1.16.1, 20w29a
    • Fix Version/s: None
    • Labels:
      None
    • Confirmation Status:
      Community Consensus
    • Category:
      Redstone

      Description

      NOTE: fixing this bug will break 4 tick observer clocks (as shown in the attached screenshot "observer_clock.png". Extending the piston will initiate a 4 tick observer clock).
      Considering that the behaviour that relies on this bug is ubiquitous and the behaviour that breaks due to this bug is quite obscure, this bug should either not be fixed or fixed in such a way that 4 tick observer clocks are not affected. 

       

      Observers react to updates if they already have a scheduled tick at the current world time but haven't yet been ticked.

      When an unpowered observer is updated, it schedules a tick 2 ticks in the future. In the meantime it should not react to any updates. However, if the observer is updated before it is ticked but in the same tick it is scheduled to be ticked, it schedules another tick anyway.

      This behaviour can easily be recreated using the setup shown in the attached screenshot ("observer_bug_setup.png").

      If the bottom observer is updated by changing the delay on the repeater, it will power, first updating the top observer to power and then itself to depower. The fact that the bottom observer will depower after the top observer powers is important, because it will cause the piston to extend. This is the expected behaviour.

      However, if instead a short pulse is sent through the repeater (which has to be on the lowest delay setting!) the circuit behaves differently. The repeater depowers in the same tick the bottom observer powers, but before it is ticked. Instead of ignoring the update, the bottom observer schedules another tick. This causes it to depower before the top observer powers, causing the piston not to extend.

       

      Code analysis

      The way the observer makes sure it does not schedule a tick if it already has a scheduled tick is by calling the hasScheduledTick(BlockPos, Object) method in the net.minecraft.world.level.ServerTickList class. This method returns false if the given position has a scheduled tick at the current world time.

      Looking at other redstone components, the repeater and redstone torch for example do not call the hasScheduledTick(BlockPos, Object) method but rather the willTickThisTick(BlockPos, Object) method, and are not affected by this bug.

        Attachments

        1. CNRtickTest.mp4
          6.48 MB
        2. observer_bug_setup.png
          observer_bug_setup.png
          123 kB
        3. observer_clock.png
          observer_clock.png
          108 kB

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            Space Walker Space Walker
            Votes:
            11 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: