Skip to content
BasaltSoftware
Bedrock 1.26.60

Site colour

Discord
Esc

    ↑↓ moveEnter openEsc close

    Keyboard shortcuts
    Ctrl K
    Search the whole site, from any page
    /
    Jump to the sidebar search, or search the whole site where there isn't one
    Enter
    Open the top search result
    Esc
    Clear the search, or close this panel
    ?
    Show these shortcuts
    Before events

    WeatherChangeBeforeEvent

    Interface in @minecraft/server

    Extends CancellableEvent

    The weather about to turn, by its cycle, a command or a plugin.

    import type { WeatherChangeBeforeEvent } from '@minecraft/server';

    Subscribe to it with world.beforeEvents.weatherChange.

    import { world, type WeatherChangeBeforeEvent } from '@minecraft/server';
    world.beforeEvents.weatherChange.subscribe((event: WeatherChangeBeforeEvent) => {
    console.log('weatherChange', event.previousWeather, event.newWeather, event.duration);
    // Uncomment to stop it from happening.
    // event.cancel = true;
    });
    import { world } from '@minecraft/server';
    world.beforeEvents.weatherChange.subscribe((event) => {
    console.log('weatherChange', event.previousWeather, event.newWeather, event.duration);
    // Uncomment to stop it from happening.
    // event.cancel = true;
    });

    read-only

    readonly previousWeather: WeatherType;
    newWeather: WeatherType;

    What it turns to, which handlers may change.

    duration: number;

    Ticks the new weather lasts, which handlers may change.

    WorldBeforeEvents.weatherChange, WeatherChangeBeforeEventSignal.subscribe, WeatherChangeBeforeEventSignal.unsubscribe

    From CancellableEvent: cancel