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

Block entity ticking checks chunk (target) ticket level instead of actual chunk ticking state when checking for ticking chunk, resulting in block entities being sometimes ticked in border chunks

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.17.1
    • None
    • Plausible
    • (Unassigned)

      This was done correctly in 1.16.5. I discovered this issue while attempting to help with a MinecraftForge hook around a block entity being loaded and it's chunk reaching ticking state.

      The actual transition into ticking for most of game logic happens when ChunkHolder.tickingChunkFuture future completes - that's when a chunk is actually ready to be ticked.

      LevelChunk.isTicking used for BlockEntity ticking checks the chunk's ticketLevel, which by my understanding of the code is actually the target level to be reached, not necessarily it's current level. This results in block entities sometimes being ticked a tick too early.

      1.16.5 actually checked for the ChunkHolder ticking future instead.

       

      By modifying the code in ServerChunkCache.getChunk to check for completable future that isn't done yet, we were able to confirm that it does in fact cause a hopper on a chunk border to wait for the chunk to load because it has been ticked too early.

            Unassigned Unassigned
            Barteks2x Bartosz Skrzypczak
            Votes:
            6 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              CHK: