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:
/forceload add 0 0
/forceload add 0 0
- Save and restart the world.
/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.
- is duplicated by
-
MC-170764 Chunks forceloaded relatively by non-player entities lose their state on server restart
- Resolved