-
Notifications
You must be signed in to change notification settings - Fork 0
Load and Restore Pipeline
The load path converts a stored ChunkDelta into a live server WorldChunk without recording the replay as new gameplay mutation.
ThreadedAnvilChunkStorageMixin resolves state in this order of availability:
- currently tracked runtime state;
- the unload cache;
- a completed CIS prefetch;
- synchronous
CisStorageload.
The first three reduce disk work but do not weaken ownership rules. A clean cached delta is invalidated before it can override stronger persistent state.
Minecraft still constructs the initial chunk through its normal NBT deserializer. CisNbtUtil.buildLoadChunkNbt(...) chooses one of two baselines:
- Persisted-base-backed NBT when the delta carries a preserved vanilla base.
- Synthetic empty-shell NBT when a full CIS baseline can supply the chunk contents itself.
ChunkSerializerMixin attaches the decoded delta to the proto chunk and carries restoration suppression through the conversion to WorldChunk.
ChunkRestorer.restore(...) runs on the server thread. For an authoritative CIS snapshot it:
- clears the target chunk block grid to air;
- removes stale block-entity state;
- applies saved block states directly to chunk sections;
- restores block entities only when their type identifier is valid;
- recalculates counts for touched
ChunkSections; - refreshes lighting and heightmaps;
- copies validated state into the runtime delta without marking it dirty.
The block clear is deliberate. For v11, an omitted block entry is air; leaving generated terrain behind would corrupt the snapshot contract.
Entity payloads are removed from synthetic vanilla load NBT. EntityReplayCoordinator is the sole server-side materializer for CIS-owned entities, avoiding duplicate loads from vanilla and Chunkis.
Pending entities are replayed once per restore operation. ChunkHolderMixin repeats the guard immediately before a vanilla full-chunk send, covering chunks that became visible before the normal promotion-path replay.
After restore, vanilla serializes the live server chunk as ChunkDataS2CPacket. There is no Chunkis custom full-chunk client payload. This keeps trial spawners, entities, and registry-sensitive vanilla state on the vanilla synchronization path.
- A block-entity-only sparse payload without a persisted base/full baseline is rejected before restore.
- An invalid persisted block-entity
idis skipped with context rather than fed into Minecraft's NBT deserializer. - Missing prefetch data falls back to synchronous storage load.
- Restore code does not prune saved blocks merely because current world generation happens to match; world generation is not a stable persistence baseline.