API reference / @jsprismarine/prismarine / world/providers/ChunkSaveContext
world/providers/ChunkSaveContext
Interfaces
ChunkSaveContext
Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:8
Entity and actor indexes shared by every chunk write in one save or unload pass.
Properties
actorIdsInWorld
readonlyactorIdsInWorld:Set<bigint>
Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:16
Persistent actor ids in the dimension; providers add ids allocated during this pass.
dimensionId
readonlydimensionId:number
Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:10
Bedrock dimension id these entities belong to.
entitiesByChunk
readonlyentitiesByChunk:ReadonlyMap<number, readonlyStoreActor[]>
Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:12
Non-player entities in each chunk, in ascending runtime id order.
firstEntityByActorId
readonlyfirstEntityByActorId:ReadonlyMap<bigint,StoreActor>
Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:18
The persistent entity with the lowest runtime id for each existing actor id.
pendingTicks?
readonlyoptionalpendingTicks?:PendingTicksToSave
Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:24
The block and fluid ticks still scheduled in each chunk, by Chunk.packXZ index, and the world tick they are due against. Absent when the caller does not track them, which leaves what a chunk was saved with alone; present, a chunk missing from the map has none.
persistentEntitiesByChunk
readonlypersistentEntitiesByChunk:ReadonlyMap<number, readonlyStoreActor[]>
Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:14
Persistent non-player entities in each chunk, in ascending runtime id order.
PendingTicksToSave
Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:41
A world's scheduled ticks, grouped for a save.
Properties
byChunk
readonlybyChunk:ReadonlyMap<number, readonlyTickToSave[]>
Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:44
currentTick
readonlycurrentTick:number
Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:43
The world tick the save is made at, which a saved tick's due tick is read against.
TickToSave
Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:28
One scheduled tick as a save writes it.
Properties
kind
readonlykind:TickKind
Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:35
Which of the world's tick lists it is on.
triggerTick
readonlytriggerTick:number
Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:33
The absolute world tick it is due on.
type
readonlytype:string
Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:37
The block or fluid it was scheduled for.
x
readonlyx:number
Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:29
y
readonlyy:number
Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:30
z
readonlyz:number
Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:31
Functions
createChunkSaveContext()
createChunkSaveContext(
dimensionId,entities,chunkIndexOf,pendingTicks?):ChunkSaveContext
Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:56
Builds the indexes a provider needs without revisiting the world's entity list per chunk.
The entities may come in any order. What the indexes hold is put in ascending runtime id order, so a chunk saves its entities in the same order whatever order the world keeps them in.
Parameters
dimensionId
number
entities
Iterable<StoreActor>
chunkIndexOf
(entity) => number
pendingTicks?
The world's scheduled block and fluid ticks, when it tracks them; see ChunkSaveContext.pendingTicks.