Skip to content

API reference / @jsprismarine/prismarine / world/redstoneUpdates

world/redstoneUpdates ​

Interfaces ​

ContentRedstoneUpdateHandlers ​

Defined in: packages/prismarine/src/world/redstoneUpdates.ts:26

The power-change dispatcher and the cache invalidation the world lifecycle needs.

Methods ​

dispatch() ​

dispatch(at, block, power): void

Defined in: packages/prismarine/src/world/redstoneUpdates.ts:30

Dispatches a change in redstone power to the active content state.

Parameters ​
at ​

BlockPosition

block ​

BlockRef

power ​

number

Returns ​

void

forgetChunk() ​

forgetChunk(chunkX, chunkZ): void

Defined in: packages/prismarine/src/world/redstoneUpdates.ts:34

Clears every cached reading in a chunk that unloads.

Parameters ​
chunkX ​

number

chunkZ ​

number

Returns ​

void

forgetPosition() ​

forgetPosition(at): void

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

Clears the cached reading after a block at this position changes.

Parameters ​
at ​

BlockPosition

Returns ​

void

shouldDispatch()? ​

optional shouldDispatch(at, block): boolean

Defined in: packages/prismarine/src/world/redstoneUpdates.ts:28

Whether a block at this position has a resolved redstone hook.

Parameters ​
at ​

BlockPosition

block ​

BlockRef

Returns ​

boolean


ContentRedstoneUpdateOptions ​

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

The content, live world, and error reporter needed by the redstone bridge.

Properties ​

content ​

readonly content: ServerContent

Defined in: packages/prismarine/src/world/redstoneUpdates.ts:18

Resolved block types and their hook tables.

report ​

readonly report: (identifier, error) => void

Defined in: packages/prismarine/src/world/redstoneUpdates.ts:22

Where a failing hook is reported once per block identifier.

Parameters ​
identifier ​

string

error ​

unknown

Returns ​

void

world ​

readonly world: () => World | undefined

Defined in: packages/prismarine/src/world/redstoneUpdates.ts:20

The world to read at dispatch time.

Returns ​

World | undefined

Functions ​

contentRedstoneUpdateHandlers() ​

contentRedstoneUpdateHandlers(options): ContentRedstoneUpdateHandlers

Defined in: packages/prismarine/src/world/redstoneUpdates.ts:47

Builds the redstone hook dispatcher for one world's resolved content.

Power readings are scoped to loaded chunks and discarded when a block changes or its chunk unloads. Neighbor hooks run separately through the content block adapter.

Parameters ​

options ​

ContentRedstoneUpdateOptions

The content, live world, and error reporter.

Returns ​

ContentRedstoneUpdateHandlers

A dispatcher and its world-lifecycle invalidation methods.