API reference / @jsprismarine/prismarine / world/WorldSystems
world/WorldSystems
Classes
Interfaces
LightSectionPalette
Defined in: packages/prismarine/src/world/WorldSystems.ts:109
A chunk section's runtime-id palette and the revision that owns it.
Properties
revision
readonlyrevision:number
Defined in: packages/prismarine/src/world/WorldSystems.ts:110
runtimeIds
readonlyruntimeIds:Iterable<number>
Defined in: packages/prismarine/src/world/WorldSystems.ts:111
RandomTickChunk
Defined in: packages/prismarine/src/world/WorldSystems.ts:88
One chunk a random tick visits, and the sub chunk indices worth drawing from.
Properties
chunk?
readonlyoptionalchunk?:Pick<Chunk,"getSubChunk">
Defined in: packages/prismarine/src/world/WorldSystems.ts:97
The chunk itself, when the world has it at hand, so each section's draws read the sub chunk it already found rather than looking the chunk up by its coordinates once per section.
sections
readonlysections:Iterable<number>
Defined in: packages/prismarine/src/world/WorldSystems.ts:92
Sub chunk indices, as the dimension numbers them: the Overworld runs -4 to 19.
x
readonlyx:number
Defined in: packages/prismarine/src/world/WorldSystems.ts:89
z
readonlyz:number
Defined in: packages/prismarine/src/world/WorldSystems.ts:90
RandomTickSectionOrigin
Defined in: packages/prismarine/src/world/WorldSystems.ts:104
A random tick section's corner, with the sub chunk it stands for when the world handed one over. The engine passes it back to WorldSystemsAccess.sectionRandomTickIds as it was given.
Extends
Properties
section?
readonlyoptionalsection?:ReadonlySubChunk|null
Defined in: packages/prismarine/src/world/WorldSystems.ts:105
x
readonlyx:number
Defined in: packages/engine-systems/src/randomTick.ts:91
Inherited from
y
readonlyy:number
Defined in: packages/engine-systems/src/randomTick.ts:92
Inherited from
z
readonlyz:number
Defined in: packages/engine-systems/src/randomTick.ts:93
Inherited from
SystemBlock
Defined in: packages/prismarine/src/world/WorldSystems.ts:35
A block as the systems read one: the identifier and its Bedrock state values.
Properties
name
readonlyname:string
Defined in: packages/prismarine/src/world/WorldSystems.ts:36
runtimeId?
readonlyoptionalruntimeId?:number
Defined in: packages/prismarine/src/world/WorldSystems.ts:39
The palette id for block changes whose caller already read it from the chunk.
states
readonlystates:Readonly<Record<string,string|number|boolean>>
Defined in: packages/prismarine/src/world/WorldSystems.ts:37
WorldSystemsOptions
Defined in: packages/prismarine/src/world/WorldSystems.ts:199
What a world gives WorldSystems to run on.
Extends
Pick<EngineOptions,"randomTickHandlers">
Properties
blockTickHandlers?
readonlyoptionalblockTickHandlers?:Readonly<Record<string, (at) =>void>>
Defined in: packages/prismarine/src/world/WorldSystems.ts:205
Resolved content handlers for scheduled block ticks.
packBlockLight?
readonlyoptionalpackBlockLight?: (block) =>BlockLightProperties|undefined
Defined in: packages/prismarine/src/world/WorldSystems.ts:212
The light of a block the vanilla mapping table does not know, such as a behavior pack's stone. Left out, such a block is transparent to light, as air is.
Parameters
block
Returns
BlockLightProperties | undefined
randomTickHandlers?
optionalrandomTickHandlers?:Readonly<Record<string, (at,block) =>void>>
Defined in: packages/engine-systems/src/engine.ts:37
What to run when a random tick lands on a block, keyed by identifier.
The engine supplies the draws; the handler owns the block behavior. The block is passed with the position so the handler can reuse this read.
Inherited from
Pick.randomTickHandlers
redstoneUpdateHandlers?
readonlyoptionalredstoneUpdateHandlers?:ContentRedstoneUpdateHandlers
Defined in: packages/prismarine/src/world/WorldSystems.ts:207
Content redstone hooks and their power cache lifecycle.
view
readonlyview:WorldSystemsView
Defined in: packages/prismarine/src/world/WorldSystems.ts:201
The reads the light pass and the random tick draw need, which a chunk answers.
world
readonlyworld:WorldAccess
Defined in: packages/prismarine/src/world/WorldSystems.ts:203
The world reads and writes the engine systems need.
WorldSystemsReport
Defined in: packages/prismarine/src/world/WorldSystems.ts:78
What one world tick's systems pass did.
Properties
light
readonlylight:LightFlushResult
Defined in: packages/prismarine/src/world/WorldSystems.ts:84
What the light engine got through, and what it still owes.
randomTicked
readonlyrandomTicked:number
Defined in: packages/prismarine/src/world/WorldSystems.ts:82
How many random tick positions landed on a block that takes them.
scheduled
readonlyscheduled:number
Defined in: packages/prismarine/src/world/WorldSystems.ts:80
How many scheduled block and fluid ticks ran.
WorldSystemsView
Defined in: packages/prismarine/src/world/WorldSystems.ts:115
What WorldSystems reads out of the world it serves.
Properties
dimension
readonlydimension:DimensionType
Defined in: packages/prismarine/src/world/WorldSystems.ts:116
Methods
blockAt()
blockAt(
x,y,z):SystemBlock|undefined
Defined in: packages/prismarine/src/world/WorldSystems.ts:118
The block at a world position, or undefined when its chunk is not loaded.
Parameters
x
number
y
number
z
number
Returns
SystemBlock | undefined
blockRuntimeIdAt()?
optionalblockRuntimeIdAt(x,y,z):number|undefined
Defined in: packages/prismarine/src/world/WorldSystems.ts:129
The runtime id at a world position, which names the same block blockAt answers with and nothing else.
The light pass reads two numbers per block and asks tens of millions of times while a world preloads. With this it resolves a block's identifier and state values once per distinct id and reads the rest out of a table; without it, it asks blockAt and goes through the property table by name and state values for every single read. Left out by every test double, which take the second path.
Parameters
x
number
y
number
z
number
Returns
number | undefined
blockStorageAt()?
optionalblockStorageAt(x,y,z):ReadonlyBlockStorage|null|undefined
Defined in: packages/prismarine/src/world/WorldSystems.ts:138
The block layer storage of the section holding a position: null where the section has no block layer, which reads as air, and undefined where blockRuntimeIdAt has no block.
The light pass reads a block's two numbers out of a table per palette slot with it, which skips the walk from the chunk to the section on every read and the lookup by runtime id. Left out by every test double, which read through blockRuntimeIdAt.
Parameters
x
number
y
number
z
number
Returns
ReadonlyBlockStorage | null | undefined
canTickFluids()?
optionalcanTickFluids(chunkX,chunkZ):boolean
Defined in: packages/prismarine/src/world/WorldSystems.ts:155
Whether the fluid ticks of a chunk may run now. One that may not keeps its due ticks queued until it may, as Java's LevelTicks does for a chunk that is not ticking, so water at the edge of the loaded area waits for the next chunk rather than stopping for good. A view without it runs every due fluid tick.
Parameters
chunkX
number
chunkZ
number
Returns
boolean
lightChunks()?
optionallightChunks():Iterable<{x:number;z:number; }>
Defined in: packages/prismarine/src/world/WorldSystems.ts:164
Chunks whose simulation distance and guard ring currently require lighting, in the order they should be lit: LIGHT_CHUNKS_PER_TICK of them are taken in each tick, from the front.
A view that returns the same object across calls promises the set has not changed in between; one that changes the set returns a new object.
Returns
Iterable<{ x: number; z: number; }>
lightSectionAt()?
optionallightSectionAt(chunkX,sectionY,chunkZ):LightSectionPalette|undefined
Defined in: packages/prismarine/src/world/WorldSystems.ts:168
The block-layer palette in a section, for revision-keyed light scan hints.
Parameters
chunkX
number
sectionY
number
chunkZ
number
Returns
LightSectionPalette | undefined
loadedChunks()
loadedChunks():
Iterable<{x:number;z:number; }>
Defined in: packages/prismarine/src/world/WorldSystems.ts:148
The chunk coordinates held in memory, used by fallbacks and world-wide reads.
Returns
Iterable<{ x: number; z: number; }>
randomTickChunks()?
optionalrandomTickChunks():Iterable<RandomTickChunk>
Defined in: packages/prismarine/src/world/WorldSystems.ts:176
Where this tick's random draws land: Java's "a player ticket holds this chunk, and this section of it holds something". Left out, every section of every loaded chunk is drawn for, which is what this did before the world could answer.
Returns
Iterable<RandomTickChunk>
randomTickSpeed()?
optionalrandomTickSpeed():number
Defined in: packages/prismarine/src/world/WorldSystems.ts:170
random_tick_speed, which is draws per section rather than a rate.
Returns
number
shouldInitializeLight()?
optionalshouldInitializeLight(chunkX,chunkZ):boolean
Defined in: packages/prismarine/src/world/WorldSystems.ts:166
Whether a newly loaded chunk should be initialized for light immediately.
Parameters
chunkX
number
chunkZ
number
Returns
boolean
tickPrecipitation()?
optionaltickPrecipitation(chunkX,chunkZ,speed,nextPosition):void
Defined in: packages/prismarine/src/world/WorldSystems.ts:182
One chunk's ice and snow for this tick, which Java runs ahead of the chunk's random block ticks: speed rolls, each drawing its column with nextPosition from the counter the block ticks draw from next. Left out, nothing freezes or settles.
Parameters
chunkX
number
chunkZ
number
speed
number
nextPosition
(originX, originY, originZ) => BlockPosition
Returns
void
topOfColumn()?
optionaltopOfColumn(x,z):number
Defined in: packages/prismarine/src/world/WorldSystems.ts:146
One past the highest y a column stores a block for, as BlockLightView.topOfColumn defines it.
Left out, a fresh chunk's light scan reads every block from the dimension ceiling down, which in an Overworld is mostly open sky.
Parameters
x
number
z
number
Returns
number
Type Aliases
WorldSystemsAccess
WorldSystemsAccess =
WorldAccess
Defined in: packages/prismarine/src/world/WorldSystems.ts:196
The world reads and writes the engine systems use.
@jsprismarine/engine-systems reads and writes through one WorldAccess. Tick scheduling belongs to WorldSystems.ticks and the content adapter.
Variables
LIGHT_BUDGET_PER_TICK
constLIGHT_BUDGET_PER_TICK:16384=16384
Defined in: packages/prismarine/src/world/WorldSystems.ts:52
How many queue nodes one world tick may spend on light.
A torch placed in the open queues a few hundred nodes, and a chunk of broken terrain floods a few thousand when it is first lit. A chunk is not simulated until its first light is done (WorldSystems.isLightReady), so this number is also how soon the world around a player who just joined starts to move: at 16384 the chunks next to the player are ready within a few ticks and a whole light ring of broken terrain within about a hundred. The rest of a flood finishes on the ticks that follow; WorldSystemsReport.light says when it has.
LIGHT_CHUNKS_PER_TICK
constLIGHT_CHUNKS_PER_TICK:8=8
Defined in: packages/prismarine/src/world/WorldSystems.ts:64
How many chunks one world tick takes into the light model.
Taking a chunk in reads each of its 256 block columns down to the ground and queues the sources it finds. A player who joins, teleports or changes dimension puts a whole light ring of loaded chunks in front of this at once, and taking them all in was the longest thing a tick did. Eight a tick still queues more light in broken terrain than LIGHT_BUDGET_PER_TICK floods, so a higher number finishes no chunk sooner there. A read that cannot wait takes in the chunks it needs itself; see WorldSystems.getSkyLight.
SCHEDULED_TICK_BUDGET_PER_TICK
constSCHEDULED_TICK_BUDGET_PER_TICK:65536=65536
Defined in: packages/prismarine/src/world/WorldSystems.ts:75
How many scheduled ticks one world tick may run, per list.
Java's limit is 65536 for each of the block and fluid lists. Bedrock's is 100 per chunk, which this server does not implement; the Java number is the one the package defaults to.
It is the only bound. A host too slow to run the batch in a tick's period ticks slower, as Java does, and runs the same ticks a fast host runs, so a replay agrees on both.