API reference / @jsprismarine/prismarine / scripting/events/worldEvents
scripting/events/worldEvents
Interfaces
ScriptWorldEvents
Defined in: packages/prismarine/src/scripting/events/worldEvents.ts:43
What a level's scripts hear of the world events WorldEventSource describes.
Methods
events()
events(
listener): () =>void
Defined in: packages/prismarine/src/scripting/events/worldEvents.ts:45
Parameters
listener
(event) => void
Returns
() => void
guard()
guard(
guard): () =>void
Defined in: packages/prismarine/src/scripting/events/worldEvents.ts:44
Parameters
guard
Returns
() => void
poll()
poll():
void
Defined in: packages/prismarine/src/scripting/events/worldEvents.ts:47
Sends the changes of the state the sources compare, before the script flush takes the events.
Returns
void
WorldEventSource
Defined in: packages/prismarine/src/scripting/events/worldEvents.ts:24
One game system's world events.
Methods
events()?
optionalevents(listener): () =>void
Defined in: packages/prismarine/src/scripting/events/worldEvents.ts:34
Calls listener with each of this system's after-events, once the world has kept the change.
Parameters
listener
(event) => void
Returns
A function that stops it.
() => void
guard()?
optionalguard(guard): () =>void
Defined in: packages/prismarine/src/scripting/events/worldEvents.ts:29
Adds a guard to the actions this system's before-events are about.
Parameters
guard
Returns
A function that removes it.
() => void
poll()?
optionalpoll():void
Defined in: packages/prismarine/src/scripting/events/worldEvents.ts:39
Compares the state this system's events are about with what the last call saw, and sends the listener an after-event for each change, once a tick before the script flush.
Returns
void
Functions
levelWorldEvents()
levelWorldEvents(
server,level):ScriptWorldEvents
Defined in: packages/prismarine/src/scripting/events/worldEvents.ts:62
The world events of one level's scripts.
Parameters
server
The server whose events carry the game systems' changes.
level
The level whose worlds the scripts see.