Skip to content

API reference / @jsprismarine/prismarine / world/ChunkAdmissions

world/ChunkAdmissions ​

Classes ​

Interfaces ​

ChunkAdmissionRecord ​

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:41

One admitted chunk completion as the replay trace records it.

It names the chunk and carries a digest of its content rather than the content. Generation is deterministic from the seed and a replay starts from the provider snapshot its manifest restores, so a replay produces the same content itself; the digest proves it did.

Extends ​

Properties ​

change ​

readonly change: "leave" | "enter"

Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:118

Whether the chunk entered or left.

Inherited from ​

ChunkAdmission.change

digest ​

readonly digest: string | null

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:52

SHA-256 of the chunk's network serialization as it was admitted, for a chunk that enters, when a recorder or a replay asked for digests. Null for a chunk that leaves, or when nothing asked.

order ​

readonly order: number

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:43

The position of this admission among all the admissions the queue applied.

step ​

readonly step: ChunkAdmissionStep

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:46

tick ​

readonly tick: number

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:45

The tick that admitted it.

world ​

readonly world: string

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:25

The world the chunk enters or leaves, as chunkAdmissionWorld names it.

Inherited from ​

ChunkAdmission.world

x ​

readonly x: number

Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:120

The chunk's x coordinate, in chunks.

Inherited from ​

ChunkAdmission.x

z ​

readonly z: number

Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:122

The chunk's z coordinate, in chunks.

Inherited from ​

ChunkAdmission.z


ChunkAdmissionRecorder ​

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:56

Receives each admitted completion, in admission order.

Methods ​

record() ​

record(record): void

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:57

Parameters ​
record ​

ChunkAdmissionRecord

Returns ​

void


ChunkAdmissionReplay ​

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:106

A replay's trace: the recorded admissions it applies instead of choosing its own.

Properties ​

fromTick? ​

readonly optional fromTick?: number

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:112

The first replay tick the trace decides. Before it the queue chooses as live play does.

records ​

readonly records: readonly ChunkAdmissionRecord[]

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:108

The captured admissions, in capture order. Only input-step ones are applied from it.

tickOffset? ​

readonly optional tickOffset?: number

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:110

Added to each record's tick, for a replay that starts at another tick than its capture.


ChunkAdmissionScheduler ​

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:77

The part of ChunkAdmissions a world uses.

Properties ​

isActive ​

readonly isActive: boolean

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:79

Whether completions wait for an input step. When false, a completion is applied at once.

Methods ​

hold() ​

hold(completion): Promise<boolean>

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:87

Holds a completion for the next input step, or applies it now when no tick loop runs.

Parameters ​
completion ​

ChunkCompletion

The completion.

Returns ​

Promise<boolean>

Settles once the completion has been applied, with what its apply returned.

promote() ​

promote(admission, priority): boolean

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:90

Moves a held completion to a more urgent lane.

Parameters ​
admission ​

ChunkAdmission

priority ​

"immediate" | "soon" | "idle"

Returns ​

boolean


ChunkAdmissionSnapshot ​

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:94

Counts of what the queue admitted, for an operator or a test.

Properties ​

admitted ​

readonly admitted: number

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:98

Completions applied by an input step.

admittedIdle ​

readonly admittedIdle: number

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:100

Completions applied while no tick loop ran.

divergences ​

readonly divergences: readonly string[]

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:102

Where a replay could not admit what its trace recorded, in the order found.

pending ​

readonly pending: number

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:96

Completions waiting for an input step.


ChunkCompletion ​

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:61

Work that makes one chunk completion visible to the simulation.

Extends ​

Properties ​

apply ​

readonly apply: () => boolean

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:73

Applies the completion: puts the chunk into the world, lights it, scans its fluids and creates its entities, or takes it out.

Returns ​

boolean

Whether the chunk entered or left. False when the world has decided otherwise meanwhile, such as a chunk a player came back for before it could leave.

change ​

readonly change: "leave" | "enter"

Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:118

Whether the chunk entered or left.

Inherited from ​

ChunkAdmission.change

content? ​

readonly optional content?: () => Uint8Array

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:65

The chunk's network serialization, for the digest of a chunk that enters.

Returns ​

Uint8Array

priority ​

readonly priority: "immediate" | "soon" | "idle"

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:63

The completion's lane, which decides its turn in the input step.

world ​

readonly world: string

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:25

The world the chunk enters or leaves, as chunkAdmissionWorld names it.

Inherited from ​

ChunkAdmission.world

x ​

readonly x: number

Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:120

The chunk's x coordinate, in chunks.

Inherited from ​

ChunkAdmission.x

z ​

readonly z: number

Defined in: packages/prismarine/src/world/changelog/ChangeEntry.ts:122

The chunk's z coordinate, in chunks.

Inherited from ​

ChunkAdmission.z

Type Aliases ​

ChunkAdmission ​

ChunkAdmission = Omit<ChunkEntry, "kind"> & object

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:23

A chunk entering or leaving one world, in the shape of the change log's chunk entry (ADR 0012) plus the world it happens in, so the entry can be appended where the admission is applied.

Type Declaration ​

world ​

readonly world: string

The world the chunk enters or leaves, as chunkAdmissionWorld names it.


ChunkAdmissionStep ​

ChunkAdmissionStep = "input" | "inline"

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:32

Where a completion was admitted. input is the input step, the only place the rule allows while the ticker runs. inline is a completion applied while no tick loop runs.

Variables ​

CHUNK_ADMISSION_BUDGET_PER_TICK ​

const CHUNK_ADMISSION_BUDGET_PER_TICK: 64 = 64

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:16

The most chunk completions one input step admits. A count, so a backlog costs a slow host the same ticks it costs a fast one; whatever is left waits for the next step.

It holds every delivery the chunk scheduler can have in flight (twice the chunk workers) on a host with up to 32 workers, so a chunk a player waits for is admitted at the next input step after it is ready, and the lane rotation still gives background chunks a share of each step.

Functions ​

chunkAdmissionWorld() ​

chunkAdmissionWorld(levelName, dimension): string

Defined in: packages/prismarine/src/world/ChunkAdmissions.ts:127

Names a world for ChunkAdmission.world: its level name and dimension, which are the same in a capture and its replay, unlike the world's identifier.

Parameters ​

levelName ​

string

dimension ​

string

Returns ​

string