Skip to content

API reference / @jsprismarine/engine-systems

@jsprismarine/engine-systems ​

Shared world-system primitives that do not come from Bedrock data: tick scheduling, neighbor update ordering, redstone signal calculations, random tick selection, explosions, and the weather cycle. Resolved block families own block behavior, including fluid flow, fire, redstone state changes, and piston movement.

The Java-derived rules in this package are based on the pinned 26.3 server jar in node_modules/.cache/jsprismarine/java-server/. Source comments name the Java classes behind the transcribed behavior.

World access ​

The engine reads and writes blocks through a small WorldAccess interface. Block tick scheduling lives in TickScheduler, and explosions use a separate ExplosionWorld interface.

typescript
import { block, createEngine, createTestWorld } from '@jsprismarine/engine-systems';

const world = createTestWorld();
const engine = createEngine(world);
engine.setBlockAndUpdate({ x: 0, y: 0, z: 0 }, block('minecraft:stone'));

setBlockAndUpdate writes the block, runs the six neighbor updates in Java's CollectingNeighborUpdater order, and reports resulting signal power to the content bridge. It does not implement individual block behavior. The active block family's hooks handle placement, neighbor changes, scheduled ticks, and state transitions.

Hosts can pass shouldComputeRedstoneUpdate to createEngine to skip power scans for states with no onRedstoneUpdate hook. updateAround runs the same notifications after a host has already written the block.

Tick scheduling ​

TickScheduler owns the block and fluid tick lists. A scheduled tick carries a trigger tick, a priority, and insertion order. Ticks drain by trigger tick, then priority, then insertion order; the per tick budget defaults to Java's 65536 for each list. The host drains the scheduler and dispatches each tick to the active block family's onTick hook. TickList.snapshot() and TickScheduler.snapshot() return copies of pending work in stable order for diagnostics and replay comparisons; they do not restore a queue.

TickList uses one queue for the whole world. Java shards each list by chunk and merges those shards while draining, so a backlog can produce a different order. This queue runs the oldest due ticks first.

Redstone signals ​

This package calculates weak and strong signal, conductor re-emission, and wire connections for the Bedrock block identifiers the content families use. WorldSystems reports the resulting power to onRedstoneUpdate; @jsprismarine/block-behaviors owns the redstone components' state changes and scheduled behavior. The engine no longer owns their scheduled ticks or state transitions; it keeps the signal output rules needed to calculate the shared network.

Resolved minecraft:redstone_conductivity values override the Java full-cube conductor default. The vanilla overlay supplies the 28 exceptions extracted from Java's block registrations, and data-driven packs can declare the same component for their blocks. Collision shapes are not published, so the full-cube fallback remains an approximation for partial blocks.

Random ticking ​

The driver draws random_tick_speed positions from each selected section using Java's Level.getBlockRandomPos step, state * 3 + 1013904223. Positions are drawn with replacement; a position whose block does not take random ticks still consumes its draw. Block behavior comes from the active family's random tick hook. BlockRandomPositions.snapshot() reads the signed 32-bit generator state without drawing another position, and restore() reinstates a captured state without drawing. Replay harnesses can restore the counter at a recorded segment boundary when setup work before that segment was not captured.

Explosions ​

explode traces Java's 1352 rays from the surface of a 16 by 16 by 16 grid. It returns affected positions and entity hits; the host applies damage, knockback, drops, and entity callbacks. Blast resistance is read from the mapping table. Exposure treats full cubes as the only occluders because neither edition publishes collision shapes.

Weather ​

advanceWeatherCycle, resetWeatherCycle, and weatherCommandState model Java's saved rain and thunder counters. They are pure functions: the host stores the returned state, applies game-rule and dimension checks, and sends any client updates.

Classes ​

Interfaces ​

BlockEntityData ​

Defined in: engine-systems/src/world.ts:122

The block entity data a system reads or writes.

Comparators store their last output here, matching Java's ComparatorBlockEntity, and containers report their fill through analogOutput.

Properties ​

analogOutput? ​

readonly optional analogOutput?: number

Defined in: engine-systems/src/world.ts:130

The analog signal a comparator reads out of this block, 0 to 15.

The host computes it from the container's contents; this package only reads it, which is how a comparator reads a chest's fill level without this package knowing what an item is.

comparatorOutput? ​

readonly optional comparatorOutput?: number

Defined in: engine-systems/src/world.ts:132

A comparator's last computed output, Java's ComparatorBlockEntity.outputSignal.


BlockPosition ​

Defined in: engine-systems/src/world.ts:14

A block position in world coordinates, with integer components.

Properties ​

x ​

readonly x: number

Defined in: engine-systems/src/world.ts:15

y ​

readonly y: number

Defined in: engine-systems/src/world.ts:16

z ​

readonly z: number

Defined in: engine-systems/src/world.ts:17


BlockRef ​

Defined in: engine-systems/src/world.ts:98

The block at one position: what it is, and the state values its rules read.

Properties ​

name ​

readonly name: string

Defined in: engine-systems/src/world.ts:100

The namespaced Bedrock block identifier, such as minecraft:stone.

redstoneConductor? ​

readonly optional redstoneConductor?: boolean

Defined in: engine-systems/src/world.ts:104

The resolved minecraft:redstone_conductivity.redstone_conductor, when the block defines it.

states ​

readonly states: Readonly<Record<string, BlockStateValue>>

Defined in: engine-systems/src/world.ts:102

Every state value the block carries, keyed by state name.


BoundingBox ​

Defined in: engine-systems/src/explosions.ts:68

An axis-aligned box in world coordinates, Java's AABB.

Properties ​

maxX ​

readonly maxX: number

Defined in: engine-systems/src/explosions.ts:72

maxY ​

readonly maxY: number

Defined in: engine-systems/src/explosions.ts:73

maxZ ​

readonly maxZ: number

Defined in: engine-systems/src/explosions.ts:74

minX ​

readonly minX: number

Defined in: engine-systems/src/explosions.ts:69

minY ​

readonly minY: number

Defined in: engine-systems/src/explosions.ts:70

minZ ​

readonly minZ: number

Defined in: engine-systems/src/explosions.ts:71


Engine ​

Defined in: engine-systems/src/engine.ts:41

What a host calls to run the engine.

Properties ​

updates ​

readonly updates: NeighborUpdates

Defined in: engine-systems/src/engine.ts:43

The update operations, exposed so a host can raise one directly.

Methods ​

runRandomTicks() ​

runRandomTicks(positions, sections, tickSpeed?): number

Defined in: engine-systems/src/engine.ts:56

Run one chunk tick's random ticks.

Parameters ​
positions ​

BlockRandomPositions

The draw source, shared across the world.

sections ​

readonly SectionOrigin[]

The randomly ticking sections of the chunk.

tickSpeed? ​

number

random_tick_speed, Java's 3 by default.

Returns ​

number

How many positions were ticked.

setBlockAndUpdate() ​

setBlockAndUpdate(at, to): void

Defined in: engine-systems/src/engine.ts:45

Write a block and run its six neighbor updates.

Parameters ​
at ​

BlockPosition

to ​

BlockRef

Returns ​

void

updateAround() ​

updateAround(at, changedBlockName): void

Defined in: engine-systems/src/engine.ts:47

Run neighbor and redstone updates after the host has already written the changed block.

Parameters ​
at ​

BlockPosition

changedBlockName ​

string

Returns ​

void


EngineOptions ​

Defined in: engine-systems/src/engine.ts:17

How to build an Engine.

Properties ​

maxChainedNeighborUpdates? ​

optional maxChainedNeighborUpdates?: number

Defined in: engine-systems/src/engine.ts:19

The neighbor update chain limit, defaulting to Java's 1000000.

onRedstoneUpdate? ​

optional onRedstoneUpdate?: (at, block, power) => void

Defined in: engine-systems/src/engine.ts:25

What to run when neighbor updates may have changed a block's redstone power. The content bridge compares the new value with the previous one before dispatching onRedstoneUpdate.

Parameters ​
at ​

BlockPosition

block ​

BlockRef

power ​

number

Returns ​

void

randomTickHandlers? ​

optional randomTickHandlers?: Readonly<Record<string, (at, block) => void>>

Defined in: 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.

shouldComputeRedstoneUpdate? ​

optional shouldComputeRedstoneUpdate?: (at, block) => boolean

Defined in: engine-systems/src/engine.ts:30

Whether an update at this position can reach a redstone hook. Returning false skips the neighbor power scan; omitted predicates keep the default behavior.

Parameters ​
at ​

BlockPosition

block ​

BlockRef

Returns ​

boolean


ExplosionEntity ​

Defined in: engine-systems/src/explosions.ts:99

An entity a blast may catch, as the ray math needs it.

The host fills this in from its own entity model and gets the same object back on the hit, so nothing in this package needs to know what an entity is.

Properties ​

box ​

readonly box: BoundingBox

Defined in: engine-systems/src/explosions.ts:101

The collision box, which getSeenPercent samples a grid of ray origins over.

eye ​

readonly eye: Point

Defined in: engine-systems/src/explosions.ts:105

Java's Entity.getEyePosition(), which the knockback direction points along.

immune? ​

readonly optional immune?: boolean

Defined in: engine-systems/src/explosions.ts:111

Entity.ignoreExplosion: the blast passes over it without hurting or shoving it.

knockbackMultiplier? ​

readonly optional knockbackMultiplier?: number

Defined in: engine-systems/src/explosions.ts:109

ExplosionDamageCalculator.getKnockbackMultiplier, defaulting to 1.

knockbackResistance? ​

readonly optional knockbackResistance?: number

Defined in: engine-systems/src/explosions.ts:107

Attributes.EXPLOSION_KNOCKBACK_RESISTANCE, 0 to 1, defaulting to 0.

position ​

readonly position: Point

Defined in: engine-systems/src/explosions.ts:103

Java's Entity.position(), the feet, which the distance falloff measures to.


ExplosionHit ​

Defined in: engine-systems/src/explosions.ts:115

What a blast did to one entity.

Type Parameters ​

T ​

T extends ExplosionEntity

Properties ​

damage ​

readonly damage: number

Defined in: engine-systems/src/explosions.ts:126

Half-hearts of damage, Java's getEntityDamageAmount.

Never below 1 for an entity in range: the curve adds a flat one at the end, so being fully behind a wall still costs half a heart.

entity ​

readonly entity: T

Defined in: engine-systems/src/explosions.ts:117

The entity the host handed in.

knockback ​

readonly knockback: Point

Defined in: engine-systems/src/explosions.ts:128

The impulse Java's Entity.pushFromExplosion adds to the entity's motion.

seen ​

readonly seen: number

Defined in: engine-systems/src/explosions.ts:119

The fraction of the rays from its box that reached the center, 0 to 1.


ExplosionOptions ​

Defined in: engine-systems/src/explosions.ts:132

What to set off, and what the host wants back.

Type Parameters ​

T ​

T extends ExplosionEntity

Properties ​

breaksBlocks? ​

readonly optional breaksBlocks?: boolean

Defined in: engine-systems/src/explosions.ts:145

Whether blocks come out, which is Java's DESTROY_WITH_DECAY against KEEP.

center ​

readonly center: Point

Defined in: engine-systems/src/explosions.ts:134

Where the blast starts, in world coordinates rather than block coordinates.

entities? ​

readonly optional entities?: readonly T[]

Defined in: engine-systems/src/explosions.ts:143

Everything that might be caught.

Filtered here against Java's own range test, so the host may hand in anything within radius * 2 + 1 of the center and let the blast decide.

onBlockDestroyed? ​

readonly optional onBlockDestroyed?: (at, block) => void

Defined in: engine-systems/src/explosions.ts:152

Called for each block about to be cleared, in the order Java shuffled them into.

Air is skipped, as BlockStateBase.onExplosionHit skips it. This is where a host rolls the block's loot table with an explosion_radius of ExplosionOptions.radius.

Parameters ​
at ​

BlockPosition

block ​

BlockRef

Returns ​

void

radius ​

readonly radius: number

Defined in: engine-systems/src/explosions.ts:136

Java's radius: TNT is 4, a creeper 3, a charged creeper 6.


ExplosionResult ​

Defined in: engine-systems/src/explosions.ts:156

What one blast came to.

Type Parameters ​

T ​

T extends ExplosionEntity

Properties ​

broken ​

readonly broken: number

Defined in: engine-systems/src/explosions.ts:168

How many positions held a block that was cleared.

hits ​

readonly hits: readonly ExplosionHit<T>[]

Defined in: engine-systems/src/explosions.ts:166

What to do to each entity the blast caught, in the order the host handed them in.

positions ​

readonly positions: readonly BlockPosition[]

Defined in: engine-systems/src/explosions.ts:164

Every position a ray reached with intensity to spare, Java's calculateExplodedPositions.

Air is in here, because Java puts it in: an air position costs a ray nothing and still joins the set, which is what createFire later picks over.


ExplosionWorld ​

Defined in: engine-systems/src/explosions.ts:78

What a blast reads and writes.

Extended by ​

Methods ​

getBlock() ​

getBlock(at): BlockRef

Defined in: engine-systems/src/explosions.ts:80

The block at one position. Outside the loaded world, return air.

Parameters ​
at ​

BlockPosition

Returns ​

BlockRef

getMaxY() ​

getMaxY(): number

Defined in: engine-systems/src/explosions.ts:90

The highest y the world holds.

Returns ​

number

getMinY() ​

getMinY(): number

Defined in: engine-systems/src/explosions.ts:88

The lowest y the world holds.

Returns ​

number

randomFloat() ​

randomFloat(): number

Defined in: engine-systems/src/explosions.ts:86

A random float in [0, 1).

Returns ​

number

randomInt() ​

randomInt(bound): number

Defined in: engine-systems/src/explosions.ts:84

A random integer in [0, bound), from the world's random source.

Parameters ​
bound ​

number

Returns ​

number

setBlock() ​

setBlock(at, to, notifyNeighbors): void

Defined in: engine-systems/src/explosions.ts:82

Replace one block, notifying neighbors when requested.

Parameters ​
at ​

BlockPosition

to ​

BlockRef

notifyNeighbors ​

boolean

Returns ​

void


NeighborUpdateTarget ​

Defined in: engine-systems/src/neighborUpdates.ts:26

What the updater calls when an update reaches a block.

Methods ​

onNeighborChanged() ​

onNeighborChanged(at, fromBlock): void

Defined in: engine-systems/src/neighborUpdates.ts:28

Java's BlockBehaviour.neighborChanged: a block next to this one changed.

Parameters ​
at ​

BlockPosition

fromBlock ​

string

Returns ​

void


NeighborUpdates ​

Defined in: engine-systems/src/neighborUpdates.ts:32

The update operations a block behavior raises.

Methods ​

neighborChanged() ​

neighborChanged(at, fromBlock): void

Defined in: engine-systems/src/neighborUpdates.ts:34

Tell one block that a neighbor changed.

Parameters ​
at ​

BlockPosition

fromBlock ​

string

Returns ​

void

updateNeighborsAt() ​

updateNeighborsAt(at, fromBlock): void

Defined in: engine-systems/src/neighborUpdates.ts:36

Java's Level.updateNeighborsAt: tell all six neighbors of at.

Parameters ​
at ​

BlockPosition

fromBlock ​

string

Returns ​

void

updateNeighborsAtExceptFromFacing() ​

updateNeighborsAtExceptFromFacing(at, fromBlock, skip): void

Defined in: engine-systems/src/neighborUpdates.ts:38

Java's Level.updateNeighborsAtExceptFromFacing: all six but one.

Parameters ​
at ​

BlockPosition

fromBlock ​

string

skip ​

"south" | "west" | "north" | "east" | "down" | "up"

Returns ​

void


Point ​

Defined in: engine-systems/src/explosions.ts:61

A point in world coordinates, with no integer requirement.

Properties ​

x ​

readonly x: number

Defined in: engine-systems/src/explosions.ts:62

y ​

readonly y: number

Defined in: engine-systems/src/explosions.ts:63

z ​

readonly z: number

Defined in: engine-systems/src/explosions.ts:64


ScheduledTick ​

Defined in: engine-systems/src/scheduler.ts:48

One queued tick.

Properties ​

at ​

readonly at: BlockPosition

Defined in: engine-systems/src/scheduler.ts:51

priority ​

readonly priority: number

Defined in: engine-systems/src/scheduler.ts:54

subTickOrder ​

readonly subTickOrder: number

Defined in: engine-systems/src/scheduler.ts:56

The order the tick was scheduled in, Java's subTickOrder.

triggerTick ​

readonly triggerTick: number

Defined in: engine-systems/src/scheduler.ts:53

The game tick this fires on.

type ​

readonly type: string

Defined in: engine-systems/src/scheduler.ts:50

The block or fluid identifier whose tick method runs.


SectionOrigin ​

Defined in: engine-systems/src/randomTick.ts:81

One section to draw positions from.

Properties ​

x ​

readonly x: number

Defined in: engine-systems/src/randomTick.ts:82

y ​

readonly y: number

Defined in: engine-systems/src/randomTick.ts:83

z ​

readonly z: number

Defined in: engine-systems/src/randomTick.ts:84


TestWorld ​

Defined in: engine-systems/src/testWorld.ts:22

A map-backed world with helpers for arranging blocks.

Extends ​

Methods ​

getBlock() ​

getBlock(at): BlockRef

Defined in: engine-systems/src/world.ts:159

The block at one position. Outside the loaded world, return air.

Parameters ​
at ​

BlockPosition

Returns ​

BlockRef

Inherited from ​

WorldAccess.getBlock

getBlockByRuntimeId()? ​

optional getBlockByRuntimeId(runtimeId): BlockRef

Defined in: engine-systems/src/world.ts:163

Resolve a runtime id without first looking up its position.

Parameters ​
runtimeId ​

number

Returns ​

BlockRef

Inherited from ​

WorldAccess.getBlockByRuntimeId

getBlockEntityData() ​

getBlockEntityData(at): BlockEntityData | undefined

Defined in: engine-systems/src/world.ts:182

The block entity data at one position, or undefined when there is none.

Parameters ​
at ​

BlockPosition

Returns ​

BlockEntityData | undefined

Inherited from ​

WorldAccess.getBlockEntityData

getBlockRuntimeId()? ​

optional getBlockRuntimeId(at): number | undefined

Defined in: engine-systems/src/world.ts:161

The runtime id at one position, or undefined when the host has no loaded block there.

Parameters ​
at ​

BlockPosition

Returns ​

number | undefined

Inherited from ​

WorldAccess.getBlockRuntimeId

getMaxY() ​

getMaxY(): number

Defined in: engine-systems/src/explosions.ts:90

The highest y the world holds.

Returns ​

number

Inherited from ​

ExplosionWorld.getMaxY

getMinY() ​

getMinY(): number

Defined in: engine-systems/src/explosions.ts:88

The lowest y the world holds.

Returns ​

number

Inherited from ​

ExplosionWorld.getMinY

isRandomlyTicking()? ​

optional isRandomlyTicking(at): boolean

Defined in: engine-systems/src/world.ts:170

Whether the stored block state at one position receives random ticks. Hosts that translate state names for engine behavior can answer from their native state.

Parameters ​
at ​

BlockPosition

Returns ​

boolean

Inherited from ​

WorldAccess.isRandomlyTicking

isRandomlyTickingRuntimeId()? ​

optional isRandomlyTickingRuntimeId(runtimeId): boolean

Defined in: engine-systems/src/world.ts:165

Whether a runtime id receives random ticks, using the host's palette-state facts.

Parameters ​
runtimeId ​

number

Returns ​

boolean

Inherited from ​

WorldAccess.isRandomlyTickingRuntimeId

nameAt() ​

nameAt(at): string

Defined in: engine-systems/src/testWorld.ts:28

The block identifier at one position.

Parameters ​
at ​

BlockPosition

Returns ​

string

place() ​

place(at, to): void

Defined in: engine-systems/src/testWorld.ts:24

Write a block without running neighbor updates.

Parameters ​
at ​

BlockPosition

to ​

BlockRef

Returns ​

void

placeLine() ​

placeLine(from, axis, length, to): void

Defined in: engine-systems/src/testWorld.ts:26

Write the same block over a run of positions along one axis.

Parameters ​
from ​

BlockPosition

axis ​

"y" | "x" | "z"

length ​

number

to ​

BlockRef

Returns ​

void

randomFloat() ​

randomFloat(): number

Defined in: engine-systems/src/explosions.ts:86

A random float in [0, 1).

Returns ​

number

Inherited from ​

ExplosionWorld.randomFloat

randomInt() ​

randomInt(bound): number

Defined in: engine-systems/src/explosions.ts:84

A random integer in [0, bound), from the world's random source.

Parameters ​
bound ​

number

Returns ​

number

Inherited from ​

ExplosionWorld.randomInt

setBlock() ​

setBlock(at, to, notifyNeighbors): void

Defined in: engine-systems/src/world.ts:180

Replace the block at one position.

Parameters ​
at ​

BlockPosition

Where to write.

to ​

BlockRef

The new block.

notifyNeighbors ​

boolean

Whether the host should run neighbor updates, which is Java's flag 1 in setBlockAndUpdate against the bare write a block family uses for its own state.

Returns ​

void

Inherited from ​

WorldAccess.setBlock

setBlockEntityData() ​

setBlockEntityData(at, data): void

Defined in: engine-systems/src/testWorld.ts:32

Write block entity data for a test.

Parameters ​
at ​

BlockPosition

data ​

BlockEntityData

Returns ​

void

stateAt() ​

stateAt(at, state): BlockStateValue | undefined

Defined in: engine-systems/src/testWorld.ts:30

One state value at one position.

Parameters ​
at ​

BlockPosition

state ​

string

Returns ​

BlockStateValue | undefined


TestWorldOptions ​

Defined in: engine-systems/src/testWorld.ts:12

How to build a TestWorld.

Properties ​

maxY? ​

optional maxY?: number

Defined in: engine-systems/src/testWorld.ts:14

minY? ​

optional minY?: number

Defined in: engine-systems/src/testWorld.ts:13

randomFloat? ​

optional randomFloat?: () => number

Defined in: engine-systems/src/testWorld.ts:18

The float source, defaulting to one that always returns 0.

Returns ​

number

randomInt? ​

optional randomInt?: (bound) => number

Defined in: engine-systems/src/testWorld.ts:16

The random source, defaulting to one that always returns 0.

Parameters ​
bound ​

number

Returns ​

number


TickRange ​

Defined in: engine-systems/src/weather.ts:51

An inclusive range of ticks, Java's UniformInt.

Properties ​

max ​

readonly max: number

Defined in: engine-systems/src/weather.ts:53

min ​

readonly min: number

Defined in: engine-systems/src/weather.ts:52


WeatherState ​

Defined in: engine-systems/src/weather.ts:22

Java's WeatherData: everything a level saves about its weather.

Properties ​

clearWeatherTime ​

readonly clearWeatherTime: number

Defined in: engine-systems/src/weather.ts:30

Ticks of forced clear weather left.

While above zero nothing else moves: both other counters are pinned to one tick and both flags are held false, so the cycle restarts the moment this runs out. Only /weather clear and a datapack set it.

raining ​

readonly raining: boolean

Defined in: engine-systems/src/weather.ts:36

Whether rain is falling.

rainTime ​

readonly rainTime: number

Defined in: engine-systems/src/weather.ts:32

Ticks until raining flips.

thundering ​

readonly thundering: boolean

Defined in: engine-systems/src/weather.ts:38

Whether the rain is a thunderstorm. Never true on its own; see the module comment.

thunderTime ​

readonly thunderTime: number

Defined in: engine-systems/src/weather.ts:34

Ticks until thundering flips.


WorldAccess ​

Defined in: engine-systems/src/world.ts:157

The world reads and writes the redstone and random tick systems use.

The host implements it over its own chunks; createTestWorld implements it over a map of positions. Tick scheduling lives in TickScheduler and the data-driven block content adapter.

Extended by ​

Methods ​

getBlock() ​

getBlock(at): BlockRef

Defined in: engine-systems/src/world.ts:159

The block at one position. Outside the loaded world, return air.

Parameters ​
at ​

BlockPosition

Returns ​

BlockRef

getBlockByRuntimeId()? ​

optional getBlockByRuntimeId(runtimeId): BlockRef

Defined in: engine-systems/src/world.ts:163

Resolve a runtime id without first looking up its position.

Parameters ​
runtimeId ​

number

Returns ​

BlockRef

getBlockEntityData() ​

getBlockEntityData(at): BlockEntityData | undefined

Defined in: engine-systems/src/world.ts:182

The block entity data at one position, or undefined when there is none.

Parameters ​
at ​

BlockPosition

Returns ​

BlockEntityData | undefined

getBlockRuntimeId()? ​

optional getBlockRuntimeId(at): number | undefined

Defined in: engine-systems/src/world.ts:161

The runtime id at one position, or undefined when the host has no loaded block there.

Parameters ​
at ​

BlockPosition

Returns ​

number | undefined

isRandomlyTicking()? ​

optional isRandomlyTicking(at): boolean

Defined in: engine-systems/src/world.ts:170

Whether the stored block state at one position receives random ticks. Hosts that translate state names for engine behavior can answer from their native state.

Parameters ​
at ​

BlockPosition

Returns ​

boolean

isRandomlyTickingRuntimeId()? ​

optional isRandomlyTickingRuntimeId(runtimeId): boolean

Defined in: engine-systems/src/world.ts:165

Whether a runtime id receives random ticks, using the host's palette-state facts.

Parameters ​
runtimeId ​

number

Returns ​

boolean

setBlock() ​

setBlock(at, to, notifyNeighbors): void

Defined in: engine-systems/src/world.ts:180

Replace the block at one position.

Parameters ​
at ​

BlockPosition

Where to write.

to ​

BlockRef

The new block.

notifyNeighbors ​

boolean

Whether the host should run neighbor updates, which is Java's flag 1 in setBlockAndUpdate against the bare write a block family uses for its own state.

Returns ​

void

Type Aliases ​

BlockStateValue ​

BlockStateValue = string | number | boolean

Defined in: blocks/src/hooks.ts:42

A block state value as the palette holds it; booleans travel as 0 and 1 on the wire.


Difficulty ​

Difficulty = typeof DIFFICULTIES[number]

Defined in: engine-systems/src/world.ts:139

One of DIFFICULTIES.


Direction ​

Direction = typeof DIRECTIONS[number]

Defined in: engine-systems/src/world.ts:29

One of DIRECTIONS.


TickHandler ​

TickHandler = (tick) => void

Defined in: engine-systems/src/scheduler.ts:60

What a drained tick's handler receives.

Parameters ​

tick ​

ScheduledTick

Returns ​

void


TickKind ​

TickKind = "block" | "fluid"

Defined in: engine-systems/src/world.ts:148

Which of the two Java tick lists a scheduled tick belongs to.


TickPriority ​

TickPriority = typeof TICK_PRIORITIES[keyof typeof TICK_PRIORITIES]

Defined in: engine-systems/src/scheduler.ts:36

One of the TICK_PRIORITIES values.


Weather ​

Weather = typeof WEATHER[number]

Defined in: engine-systems/src/world.ts:145

One of WEATHER.

Variables ​

AIR ​

const AIR: BlockRef

Defined in: engine-systems/src/world.ts:114

Air, the block every system treats as empty.


CLEAR_WEATHER ​

const CLEAR_WEATHER: WeatherState

Defined in: engine-systems/src/weather.ts:42

A dry world whose first shower is due on the next tick. The state Java starts a level in.


DEFAULT_RANDOM_TICK_SPEED ​

const DEFAULT_RANDOM_TICK_SPEED: 3 = 3

Defined in: engine-systems/src/randomTick.ts:25

Java's random_tick_speed default, read from the game rule registry.


DIFFICULTIES ​

const DIFFICULTIES: readonly ["peaceful", "easy", "normal", "hard"]

Defined in: engine-systems/src/world.ts:136

The four difficulty names, in the order Java assigns their numeric ids.


DIRECTIONS ​

const DIRECTIONS: readonly ["down", "up", "north", "south", "west", "east"]

Defined in: engine-systems/src/world.ts:26

The six directions, in Java's Direction.values() order.

The order matters: SignalGetter.getBestNeighborSignal iterates it and stops at the first 15, so power readings depend on the order.


EXPLOSION_ABSORPTION_SCALE ​

const EXPLOSION_ABSORPTION_SCALE: number

Defined in: engine-systems/src/explosions.ts:43

The scale on a block's absorption, (resistance + 0.3) * 0.3.

The same 0.3F the step length is, which is why Java's step constant reads as 0.30000001192092896, and a separate idea: it is what makes a block with no blast resistance at all still cost a ray 0.09.


EXPLOSION_DAMAGE_CURVE ​

const EXPLOSION_DAMAGE_CURVE: 7 = 7

Defined in: engine-systems/src/explosions.ts:55

The multiplier in ExplosionDamageCalculator.getEntityDamageAmount.


EXPLOSION_ENTITY_REACH ​

const EXPLOSION_ENTITY_REACH: 2 = 2

Defined in: engine-systems/src/explosions.ts:52

How far past its radius a blast reaches entities, and the divisor its damage curve uses.


EXPLOSION_INTENSITY_FLOOR ​

const EXPLOSION_INTENSITY_FLOOR: number

Defined in: engine-systems/src/explosions.ts:46

The low end of a ray's starting intensity, as a fraction of the radius.


EXPLOSION_INTENSITY_SPREAD ​

const EXPLOSION_INTENSITY_SPREAD: number

Defined in: engine-systems/src/explosions.ts:49

How much random spread sits on top of EXPLOSION_INTENSITY_FLOOR.


EXPLOSION_RAY_DECAY ​

const EXPLOSION_RAY_DECAY: number

Defined in: engine-systems/src/explosions.ts:34

What a ray loses per step regardless of what it passes through.


EXPLOSION_RAY_GRID ​

const EXPLOSION_RAY_GRID: 16 = 16

Defined in: engine-systems/src/explosions.ts:28

The cube of ray origins Java walks, 16 cells on a side.


EXPLOSION_RAY_STEP ​

const EXPLOSION_RAY_STEP: number

Defined in: engine-systems/src/explosions.ts:31

How far a ray travels per step, Java's (double) 0.3F.


HORIZONTAL_DIRECTIONS ​

const HORIZONTAL_DIRECTIONS: readonly ["north", "south", "west", "east"]

Defined in: engine-systems/src/world.ts:32

The four horizontal directions, in Java's Direction.Plane.HORIZONTAL order.


MAX_CHAINED_NEIGHBOR_UPDATES ​

const MAX_CHAINED_NEIGHBOR_UPDATES: 1000000 = 1_000_000

Defined in: engine-systems/src/neighborUpdates.ts:23

How many chained updates one change may raise before the rest are dropped.

Java's ServerLevel passes max-chained-neighbor-updates from server.properties, which defaults to 1000000.


MAX_SCHEDULED_TICKS_PER_TICK ​

const MAX_SCHEDULED_TICKS_PER_TICK: 65536 = 65536

Defined in: engine-systems/src/scheduler.ts:45

How many ticks one game tick may run, per tick list.

ServerLevel.tick passes 65536 to both blockTicks.tick and fluidTicks.tick in the 26.3 jar. Bedrock's limit is 100 per chunk, which this package does not implement; see the README.


MIN_EXPLOSION_RADIUS ​

const MIN_EXPLOSION_RADIUS: number

Defined in: engine-systems/src/explosions.ts:58

Below this radius hurtEntities returns without touching anything.


RAIN_DELAY ​

const RAIN_DELAY: TickRange

Defined in: engine-systems/src/weather.ts:57

How long a dry spell lasts, and what /weather clear uses with no duration. 10 to 150 minutes.


RAIN_DURATION ​

const RAIN_DURATION: TickRange

Defined in: engine-systems/src/weather.ts:60

How long a shower lasts, and what /weather rain uses with no duration. 10 to 20 minutes.


SECTION_SIZE ​

const SECTION_SIZE: 16 = 16

Defined in: engine-systems/src/randomTick.ts:28

The edge length of a chunk section, which bounds every draw.


SIGNAL_MAX ​

const SIGNAL_MAX: 15 = 15

Defined in: engine-systems/src/signal.ts:108

The strongest signal redstone carries, which is Java's Redstone.SIGNAL_MAX.


SIGNAL_NONE ​

const SIGNAL_NONE: 0 = 0

Defined in: engine-systems/src/signal.ts:111

No signal, which is Java's Redstone.SIGNAL_NONE.


THUNDER_DELAY ​

const THUNDER_DELAY: TickRange

Defined in: engine-systems/src/weather.ts:63

How long the rain stays plain before a storm is due. 10 to 150 minutes.


THUNDER_DURATION ​

const THUNDER_DURATION: TickRange

Defined in: engine-systems/src/weather.ts:66

How long a storm lasts, and what /weather thunder uses with no duration. 3 to 13 minutes.


TICK_PRIORITIES ​

const TICK_PRIORITIES: object

Defined in: engine-systems/src/scheduler.ts:25

Java's TickPriority values, lowest first. The numbers are the enum's own value field, read from TickPriority in the 26.3 jar, and the comparator sorts on them directly.

The data-driven redstone family uses these values for repeaters and comparators. Their priority rules match DiodeBlock.checkTickOnNeighbor.

Type Declaration ​

EXTREMELY_HIGH ​

readonly EXTREMELY_HIGH: -3 = -3

EXTREMELY_LOW ​

readonly EXTREMELY_LOW: 3 = 3

HIGH ​

readonly HIGH: -1 = -1

LOW ​

readonly LOW: 1 = 1

NORMAL ​

readonly NORMAL: 0 = 0

VERY_HIGH ​

readonly VERY_HIGH: -2 = -2

VERY_LOW ​

readonly VERY_LOW: 2 = 2


VERTICAL_DIRECTIONS ​

const VERTICAL_DIRECTIONS: readonly ["down", "up"]

Defined in: engine-systems/src/world.ts:35

The two vertical directions, in Java's Direction.Plane.VERTICAL order.


WEATHER ​

const WEATHER: readonly ["clear", "rain", "thunder"]

Defined in: engine-systems/src/world.ts:142

The three weather states.

Functions ​

advanceWeatherCycle() ​

advanceWeatherCycle(state, randomInt): WeatherState

Defined in: engine-systems/src/weather.ts:107

One game tick of the cycle, Java's ServerLevel.advanceWeatherCycle.

The three counters run down in order of precedence. A clear spell outranks everything and pins the other two to one tick, so when it ends the next tick flips both. Otherwise each of thunder and rain either counts down - flipping its flag and booking the opposite stretch when it reaches zero - or, if it was already at zero, books its first stretch without flipping anything. That last branch is why a fresh world's weather does not change on tick one: the counters start at zero, and the first tick only decides how long to wait.

The caller decides whether to run this at all. Java gates it on the doWeatherCycle game rule and on whether the dimension can have weather, and neither is this function's business.

Parameters ​

state ​

WeatherState

The state at the top of the tick.

randomInt ​

(bound) => number

The host's random source, used only when a counter has to be booked.

Returns ​

WeatherState

The state at the bottom of it. The same object is never returned twice, so a host can compare weatherOf before and after to decide whether to tell its clients.


bestNeighborSignal() ​

bestNeighborSignal(world, at): number

Defined in: engine-systems/src/signal.ts:207

Java's SignalGetter.getBestNeighborSignal: the strongest power reaching a position.

Parameters ​

world ​

WorldAccess

at ​

BlockPosition

Returns ​

number


block() ​

block(name, states?): BlockRef

Defined in: engine-systems/src/world.ts:108

A block with no states, which is what most of this package writes.

Parameters ​

name ​

string

states? ​

Readonly<Record<string, BlockStateValue>> = {}

Returns ​

BlockRef


calculateExplodedPositions() ​

calculateExplodedPositions(world, center, radius): readonly BlockPosition[]

Defined in: engine-systems/src/explosions.ts:351

Every position a ray reached with intensity left, Java's calculateExplodedPositions.

One ray per cell on the surface of the 16-cube, which is 1352 of them: the interior cells are skipped because their direction is already covered by a surface cell. Each ray draws its own starting intensity, so two blasts of the same radius at the same spot do not carve the same hole.

Rays overlap heavily near the center, so a ray's 0.3-block step reads the same block several times over and the 1352 rays read each other's blocks thousands of times. Two flat arrays over the cube a ray can possibly reach hold the resistance already read and whether the position is already marked, which takes a radius-4 blast from about 24,000 block reads down to about 800.

Parameters ​

world ​

ExplosionWorld

center ​

Point

radius ​

number

Returns ​

readonly BlockPosition[]

The positions in no particular order, air included.


clockWise() ​

clockWise(direction): "south" | "west" | "north" | "east"

Defined in: engine-systems/src/world.ts:64

The next horizontal direction clockwise, as Java's Direction.getClockWise gives it.

Parameters ​

direction ​

"south" | "west" | "north" | "east"

Returns ​

"south" | "west" | "north" | "east"


connectsToWire() ​

connectsToWire(block, direction): boolean

Defined in: engine-systems/src/signal.ts:138

Whether a wire next to a block connects to it, Java's shouldRedstoneWireConnectTo.

Parameters ​

block ​

BlockRef

direction ​

"south" | "west" | "north" | "east" | "down" | "up" | undefined

Returns ​

boolean


counterClockWise() ​

counterClockWise(direction): "south" | "west" | "north" | "east"

Defined in: engine-systems/src/world.ts:68

The next horizontal direction counterclockwise.

Parameters ​

direction ​

"south" | "west" | "north" | "east"

Returns ​

"south" | "west" | "north" | "east"


createEngine() ​

createEngine(world, options?): Engine

Defined in: engine-systems/src/engine.ts:71

Build the engine over one world.

Parameters ​

world ​

WorldAccess

The world the systems read and write.

options? ​

EngineOptions = {}

The game rules and content hooks the host fills in.

Returns ​

Engine

Example ​

typescript
const world = createTestWorld();
const engine = createEngine(world);
engine.setBlockAndUpdate({ x: 0, y: 0, z: 0 }, { name: 'minecraft:stone', states: {} });

createNeighborUpdates() ​

createNeighborUpdates(target, maxChained?): NeighborUpdates

Defined in: engine-systems/src/neighborUpdates.ts:80

Build the updater over one target.

Parameters ​

target ​

NeighborUpdateTarget

What to call when an update reaches a block.

maxChained? ​

number = MAX_CHAINED_NEIGHBOR_UPDATES

The chain limit, defaulting to Java's 1000000.

Returns ​

NeighborUpdates

The update operations block behaviors raise.


createTestWorld() ​

createTestWorld(options?): TestWorld

Defined in: engine-systems/src/testWorld.ts:46

Build a map-backed world.

Parameters ​

options? ​

TestWorldOptions = {}

The height bounds and random sources.

Returns ​

TestWorld

A world that satisfies WorldAccess and ExplosionWorld.

Example ​

typescript
const world = createTestWorld();
world.place({ x: 0, y: 0, z: 0 }, block('minecraft:stone'));

directSignalTo() ​

directSignalTo(world, at): number

Defined in: engine-systems/src/signal.ts:190

Java's SignalGetter.getDirectSignalTo: the strongest strong power at a position.

Parameters ​

world ​

WorldAccess

at ​

BlockPosition

Returns ​

number


drawSectionPositions() ​

drawSectionPositions(positions, section, tickSpeed?): BlockPosition[]

Defined in: engine-systems/src/randomTick.ts:95

Draw the positions one chunk tick visits in one section.

Parameters ​

positions ​

BlockRandomPositions

The draw source, shared across the whole world in Java.

section ​

SectionOrigin

The section's lowest corner.

tickSpeed? ​

number = DEFAULT_RANDOM_TICK_SPEED

random_tick_speed, Java's 3 by default.

Returns ​

BlockPosition[]

tickSpeed positions, which may repeat.


explode() ​

explode<T>(world, options): ExplosionResult<T>

Defined in: engine-systems/src/explosions.ts:518

Sets a blast off.

The order is Java's ServerExplosion.explode: the rays are cast first, so the hole does not change what the next ray passes through; then the entities are measured against the world as it still stands, which is why a wall shields you even though it is about to go; then the blocks come out.

Type Parameters ​

T ​

T extends ExplosionEntity

Parameters ​

world ​

ExplosionWorld

options ​

ExplosionOptions<T>

Returns ​

ExplosionResult<T>

The positions the rays reached, what to do to each entity, and how many blocks were cleared. Applying the hits is the host's, because this package has no entity model.

Example ​

typescript
const blast = explode(world, { center: { x: 0.5, y: 64, z: 0.5 }, radius: 4 });
for (const hit of blast.hits) hurt(hit.entity, hit.damage);

explosionDamage() ​

explosionDamage(radius, distance, seen): number

Defined in: engine-systems/src/explosions.ts:325

Half-hearts of damage, Java's ExplosionDamageCalculator.getEntityDamageAmount.

((impact² + impact) / 2) * 7 * reach + 1, where impact is how close the entity is as a fraction of the reach, times how much of it the blast can see. The flat one at the end is why an entity in range always loses something.

Parameters ​

radius ​

number

The blast's radius, not its reach.

distance ​

number

From the center to the entity's feet.

seen ​

number

The exposure getSeenPercent measured, 0 to 1.

Returns ​

number


explosionResistanceOf() ​

explosionResistanceOf(block): number | undefined

Defined in: engine-systems/src/explosions.ts:179

How much of a ray one block absorbs, Java's ExplosionDamageCalculator.getBlockExplosionResistance.

Parameters ​

block ​

BlockRef

Returns ​

number | undefined

The block's blast resistance, or undefined for air, which costs a ray nothing. A block the mapping table does not know answers 0, which still costs a ray the flat 0.3 * 0.3 every non-air block costs.


getSeenPercent() ​

getSeenPercent(world, center, box): number

Defined in: engine-systems/src/explosions.ts:280

The fraction of a box that can see a point, Java's ServerExplosion.getSeenPercent.

The sample spacing is 1 / (side * 2 + 1) per axis, so a player's box is sampled 3 by 5 by 3 and a cow's 3 by 4 by 3. The x and z samples are nudged inwards by half the leftover so the grid sits centered on the box; Java leaves y alone.

Parameters ​

world ​

ExplosionWorld

center ​

Point

box ​

BoundingBox

Returns ​

number

0 for a box with a negative side, which is what Java answers for one.


hasNeighborSignal() ​

hasNeighborSignal(world, at): boolean

Defined in: engine-systems/src/signal.ts:218

Java's SignalGetter.hasNeighborSignal: whether any neighbor powers a position.

Parameters ​

world ​

WorldAccess

at ​

BlockPosition

Returns ​

boolean


hasSignal() ​

hasSignal(world, at, direction): boolean

Defined in: engine-systems/src/signal.ts:226

Java's SignalGetter.hasSignal for one direction.

Parameters ​

world ​

WorldAccess

at ​

BlockPosition

direction ​

"south" | "west" | "north" | "east" | "down" | "up"

Returns ​

boolean


hasSturdyTopFace() ​

hasSturdyTopFace(block): boolean

Defined in: engine-systems/src/blockRules.ts:76

Java's isFaceSturdy(…, Direction.UP): whether something can be placed on top of the block. Wire, repeaters and comparators all break without it.

Slabs and stairs have sturdy top faces in Java depending on their half, which this does not model: it answers from the full-cube test plus the top slab and upside-down stair states.

Parameters ​

block ​

BlockRef

Returns ​

boolean


isAir() ​

isAir(block): boolean

Defined in: engine-systems/src/blockRules.ts:17

Whether the position holds nothing.

Parameters ​

block ​

BlockRef

Returns ​

boolean


isFullCube() ​

isFullCube(block): boolean

Defined in: engine-systems/src/blockRules.ts:55

Whether the block's collision shape fills its cube, which is what Java's isCollisionShapeFullBlock answers.

Neither edition publishes collision shapes, so this reads the mapping table's light dampening, which is 15 for every opaque cube and 0 or 1 for the slabs, stairs, fences and plates that are not cubes, and adds the handful of transparent cubes by name. It is the one input in this package with no published source; the README lists it as such.

Parameters ​

block ​

BlockRef

Returns ​

boolean


isRandomlyTicking() ​

isRandomlyTicking(block): boolean

Defined in: engine-systems/src/blockRules.ts:20

Whether the block receives random ticks, which the random tick driver filters on.

Parameters ​

block ​

BlockRef

Returns ​

boolean


isRedstoneConductor() ​

isRedstoneConductor(block): boolean

Defined in: engine-systems/src/blockRules.ts:66

Java's isRedstoneConductor: whether the block carries redstone power into itself and passes it to its neighbors.

BlockBehaviour.Properties defaults it to isCollisionShapeFullBlock. Explicit component values from the resolved block definition override that default, including the vanilla exceptions written into the generated overlay.

Parameters ​

block ​

BlockRef

Returns ​

boolean


isSignalSource() ​

isSignalSource(block): boolean

Defined in: engine-systems/src/signal.ts:130

Java's BlockState.isSignalSource.

Parameters ​

block ​

BlockRef

Returns ​

boolean


offset() ​

offset(from, dx, dy, dz): BlockPosition

Defined in: engine-systems/src/world.ts:85

The position offset by three deltas.

Parameters ​

from ​

BlockPosition

dx ​

number

dy ​

number

dz ​

number

Returns ​

BlockPosition


opposite() ​

opposite(direction): "south" | "west" | "north" | "east" | "down" | "up"

Defined in: engine-systems/src/world.ts:61

The direction facing the other way.

Parameters ​

direction ​

"south" | "west" | "north" | "east" | "down" | "up"

Returns ​

"south" | "west" | "north" | "east" | "down" | "up"


ownSignalOf() ​

ownSignalOf(world, at, block): number

Defined in: engine-systems/src/signal.ts:114

Java's BlockState.getOwnSignal: the power a block emits before direction is considered.

Parameters ​

world ​

WorldAccess

at ​

BlockPosition

block ​

BlockRef

Returns ​

number


positionKey() ​

positionKey(at): string

Defined in: engine-systems/src/world.ts:95

A position as a map key: x,y,z.

Parameters ​

at ​

BlockPosition

Returns ​

string


relative() ​

relative(from, direction, distance?): BlockPosition

Defined in: engine-systems/src/world.ts:79

The position distance blocks away in one direction.

Parameters ​

from ​

BlockPosition

The position to start from.

direction ​

"south" | "west" | "north" | "east" | "down" | "up"

Which way to step.

distance? ​

number = 1

How many blocks to step, defaulting to one.

Returns ​

BlockPosition


resetWeatherCycle() ​

resetWeatherCycle(state): WeatherState

Defined in: engine-systems/src/weather.ts:145

What a player sleeping through the night does to the weather, Java's ServerLevel.resetWeatherCycle.

Both counters go to zero rather than to a fresh draw, so the next tick books the dry spell that follows. The clear spell is left where it is, which is how /weather clear 1d survives a night's sleep.

Parameters ​

state ​

WeatherState

Returns ​

WeatherState


runRandomTicks() ​

runRandomTicks(world, positions, sections, run, tickSpeed?): number

Defined in: engine-systems/src/randomTick.ts:119

Run one chunk tick's random ticks over a list of sections.

Positions whose block does not take random ticks are drawn and discarded, which is what Java does: the draw happens first and the filter second, so a section full of stone still consumes its draws.

Parameters ​

world ​

WorldAccess

The world to read.

positions ​

BlockRandomPositions

The draw source.

sections ​

readonly SectionOrigin[]

The randomly ticking sections of one chunk.

run ​

(at, block) => void

Called for each drawn position whose block takes random ticks, with its resolved block.

tickSpeed? ​

number = DEFAULT_RANDOM_TICK_SPEED

random_tick_speed, Java's 3 by default.

Returns ​

number

How many positions reached run.


samePosition() ​

samePosition(a, b): boolean

Defined in: engine-systems/src/world.ts:92

Whether two positions name the same block.

Parameters ​

a ​

BlockPosition

b ​

BlockPosition

Returns ​

boolean


sampleTicks() ​

sampleTicks(range, randomInt): number

Defined in: engine-systems/src/weather.ts:75

A draw from an inclusive range, Java's UniformInt.sample.

Parameters ​

range ​

TickRange

The range, both ends included.

randomInt ​

(bound) => number

The host's random source: a draw in [0, bound).

Returns ​

number


setWeatherParameters() ​

setWeatherParameters(clearTime, weatherTime, raining, thundering): WeatherState

Defined in: engine-systems/src/weather.ts:165

What /weather sets, Java's MinecraftServer.setWeatherParameters.

One duration covers both counters, which is what makes the command's effect last exactly as long as it says whichever cycle would have moved first.

Parameters ​

clearTime ​

number

Ticks of forced clear weather. /weather rain and /weather thunder pass 0, which releases the pin.

weatherTime ​

number

Ticks both the rain and the thunder counter are set to.

raining ​

boolean

Whether it rains for that stretch.

thundering ​

boolean

Whether the rain is a storm. Java never passes true without raining.

Returns ​

WeatherState


signalAt() ​

signalAt(world, at, direction): number

Defined in: engine-systems/src/signal.ts:200

The power a block gives its neighbor, including power re-emitted by a conductor.

Parameters ​

world ​

WorldAccess

at ​

BlockPosition

direction ​

"south" | "west" | "north" | "east" | "down" | "up"

Returns ​

number


stepOf() ​

stepOf(direction): BlockPosition

Defined in: engine-systems/src/world.ts:58

The unit step of one direction, matching Java's getStepX, getStepY and getStepZ.

Parameters ​

direction ​

"south" | "west" | "north" | "east" | "down" | "up"

Returns ​

BlockPosition


strongSignalOf() ​

strongSignalOf(world, at, direction): number

Defined in: engine-systems/src/signal.ts:173

Java's BlockState.getDirectSignal: the strong power a block gives one neighbor.

Parameters ​

world ​

WorldAccess

at ​

BlockPosition

direction ​

"south" | "west" | "north" | "east" | "down" | "up"

Returns ​

number


weakSignalOf() ​

weakSignalOf(world, at, direction): number

Defined in: engine-systems/src/signal.ts:149

Java's BlockState.getSignal: the weak power a block gives one neighbor.

Parameters ​

world ​

WorldAccess

at ​

BlockPosition

direction ​

"south" | "west" | "north" | "east" | "down" | "up"

Returns ​

number


weatherCommandState() ​

weatherCommandState(kind, randomInt, durationTicks?): WeatherState

Defined in: engine-systems/src/weather.ts:194

The state /weather <kind> [duration] asks for, with Java's default duration per kind.

WeatherCommand.getDuration samples the kind's own range when the command names no duration, which is why /weather rain lasts between ten and twenty minutes and /weather thunder between three and thirteen. A host wiring the command calls this and hands the result to its world; nothing else about the command belongs here.

Parameters ​

kind ​

"thunder" | "clear" | "rain"

What the command asked for.

randomInt ​

(bound) => number

The host's random source, used only when durationTicks is absent.

durationTicks? ​

number

The duration the command named, in ticks.

Returns ​

WeatherState

Example ​

typescript
const state = weatherCommandState('thunder', randomInt);

weatherOf() ​

weatherOf(state): "thunder" | "clear" | "rain"

Defined in: engine-systems/src/weather.ts:84

Which of the three the state reads as, for the rules that branch on weather rather than on the counters.

Parameters ​

state ​

WeatherState

Returns ​

"thunder" | "clear" | "rain"

thunder while a storm is overhead, rain for plain rain, clear otherwise.


wireConnectsOnSide() ​

wireConnectsOnSide(world, at, side): boolean

Defined in: engine-systems/src/signal.ts:230

Whether a wire connects along one horizontal side.

Parameters ​

world ​

WorldAccess

at ​

BlockPosition

side ​

"south" | "west" | "north" | "east" | "down" | "up"

Returns ​

boolean