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

data/chunks.dat isn't saved if the most recent /forceload command failed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • Minecraft 1.13.2, 1.15.2, 20w08a, 20w16a, 20w17a, 20w18a, 20w19a, 20w22a, 1.16 Pre-release 1, 1.16 Release Candidate 1, 1.16, 20w27a, 20w28a, 1.17.1, 22w19a, 1.19.3, 1.19.4, 1.20.1, 23w32a, 23w35a
    • Community Consensus
    • Commands
    • Normal
    • Platform

      If at the time of saving the world, the most recent /forceload add or /forceload remove command failed (e.g. if a data pack does /forceload add to the same chunk periodically), then no changes to any force-loaded chunks are saved at all.

      The cause of this is that a single chunk's dirty state overwrites the dirty state of all force-loaded chunks (which are stored in chunks.dat).

      Reproduction steps:

      1. /forceload add 0 0
        
      2. /forceload add 0 0
        
      3. Save and restart the world.
      4. /forceload query
        

        →  No force loaded chunks were found in minecraft:overworld

      Code analysis (by intsuc):
      In net.minecraft.server.level.ServerLevel#setChunkForced, the dirty state of chunks.dat is set to the result of addition/removal of a forced chunk. If the server saves/stops with the dirty state false, forced chunks will not be saved in chunks.dat properly.

            Unassigned Unassigned
            GrantGryczan Grant Gryczan
            Votes:
            21 Vote for this issue
            Watchers:
            17 Start watching this issue

              Created:
              Updated:
              CHK: