Skip to content

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 ​

readonly actorIdsInWorld: 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 ​

readonly dimensionId: number

Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:10

Bedrock dimension id these entities belong to.

entitiesByChunk ​

readonly entitiesByChunk: ReadonlyMap<number, readonly StoreActor[]>

Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:12

Non-player entities in each chunk, in ascending runtime id order.

firstEntityByActorId ​

readonly firstEntityByActorId: 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? ​

readonly optional pendingTicks?: 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 ​

readonly persistentEntitiesByChunk: ReadonlyMap<number, readonly StoreActor[]>

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 ​

readonly byChunk: ReadonlyMap<number, readonly TickToSave[]>

Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:44

currentTick ​

readonly currentTick: 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 ​

readonly kind: TickKind

Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:35

Which of the world's tick lists it is on.

triggerTick ​

readonly triggerTick: number

Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:33

The absolute world tick it is due on.

type ​

readonly type: string

Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:37

The block or fluid it was scheduled for.

x ​

readonly x: number

Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:29

y ​

readonly y: number

Defined in: packages/prismarine/src/world/providers/ChunkSaveContext.ts:30

z ​

readonly z: 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? ​

PendingTicksToSave

The world's scheduled block and fluid ticks, when it tracks them; see ChunkSaveContext.pendingTicks.

Returns ​

ChunkSaveContext