API reference / @jsprismarine/prismarine / world/Weather
world/Weather
Classes
Interfaces
WeatherChange
Defined in: packages/prismarine/src/world/Weather.ts:59
A weather change about to happen, as the guards of the weather action read it.
Properties
duration
readonlyduration:number
Defined in: packages/prismarine/src/world/Weather.ts:63
How long the new weather lasts, in ticks.
next
readonlynext:"thunder"|"clear"|"rain"
Defined in: packages/prismarine/src/world/Weather.ts:61
previous
readonlyprevious:"thunder"|"clear"|"rain"
Defined in: packages/prismarine/src/world/Weather.ts:60
WeatherWorld
Defined in: packages/prismarine/src/world/Weather.ts:28
What WorldWeather needs from the world it belongs to.
Methods
cycleAllowed()
cycleAllowed():
boolean
Defined in: packages/prismarine/src/world/Weather.ts:30
Whether doWeatherCycle is on. Java stops the counters dead when it is not.
Returns
boolean
randomInt()
randomInt(
bound):number
Defined in: packages/prismarine/src/world/Weather.ts:32
A draw in [0, bound), used only when a stretch has to be booked.
Parameters
bound
number
Returns
number
show()
show(
from,to):void
Defined in: packages/prismarine/src/world/Weather.ts:34
Shows everybody in the world a change of weather, which each client's edition draws its own way.
Parameters
from
"thunder" | "clear" | "rain"
to
"thunder" | "clear" | "rain"
Returns
void
Type Aliases
SavedWeather
SavedWeather =
WeatherState
Defined in: packages/prismarine/src/world/Weather.ts:38
The weather stored by the provider, which is Java's WeatherData field for field.
WeatherGuard
WeatherGuard = (
change) => {veto:true; } | {change:WeatherChange;veto:false; }
Defined in: packages/prismarine/src/world/Weather.ts:71
A guard of the weather action (ADR 0013): it reads the change and lets it through, with a weather and a duration it may replace, or vetoes it. It writes nothing.
Parameters
change
Returns
{ veto: true; } | { change: WeatherChange; veto: false; }
WeatherListener
WeatherListener = (
change) =>void
Defined in: packages/prismarine/src/world/Weather.ts:76
Hears every weather change that took effect, whatever made it: a command, a script or the cycle.
Parameters
change
current
previous
Returns
void
Functions
savedWeatherOf()
savedWeatherOf(
value):WeatherState|undefined
Defined in: packages/prismarine/src/world/Weather.ts:41
Whether a value read from world storage is a weather record this can use.
Parameters
value
unknown
Returns
WeatherState | undefined