Script API - v1.26.20
    Preparing search index...

    Used to affect atmospheric scattering per biome for Vibrant Visuals

    A video showcases rainbow skies in overworld biomes using the @minecraft/server-graphics module. Posted by oSylfrost on the Bedrock Add-Ons Discord.

    Full example code:

    import { system, BiomeTypes, BiomeType } from "@minecraft/server";
    import { atmosphere } from "@minecraft/server-graphics";

    let biomes: BiomeType[];

    system.run(() => {
    biomes = BiomeTypes.getAll().filter((b) => {
    const id = (b as any)?.id ?? "";

    return !(
    id.includes("nether") ||
    id.includes("end") ||
    id.includes("void")
    );
    });
    });

    let hue = 0;

    function rgb(h: number, s = 1, l = 0.5) {
    const c = (1 - Math.abs(2 * l - 1)) * s;
    const x = c * (1 - Math.abs(((h / 60) % 2) - 1));
    const m = l - c / 2;

    let [r, g, b] =
    h < 60
    ? [c, x, 0]
    : h < 120
    ? [x, c, 0]
    : h < 180
    ? [0, c, x]
    : h < 240
    ? [0, x, c]
    : h < 300
    ? [x, 0, c]
    : [c, 0, x];

    return { red: r + m, green: g + m, blue: b + m };
    }

    system.runInterval(() => {
    hue = (hue + 1.2) % 360;

    const frame = {
    0.0: rgb(hue),
    0.25: rgb(hue + 60),
    0.5: rgb(hue + 120),
    0.75: rgb(hue + 180),
    1.0: rgb(hue + 240),
    };

    for (const biome of biomes) {
    try {
    atmosphere.setSkyHorizonColor(frame, biome);
    atmosphere.setSkyZenithColor(frame, biome);
    } catch {}
    }
    });
    export class BiomeAtmospherics {
    private constructor();
    resetHorizonBlendMax(): void;
    resetHorizonBlendMieStart(): void;
    resetHorizonBlendMin(): void;
    resetHorizonBlendStart(): void;
    resetMoonMieStrength(): void;
    resetRayleighStrength(): void;
    resetSkyHorizonColor(): void;
    resetSkyZenithColor(): void;
    resetSunGlareShape(): void;
    resetSunMieStrength(): void;
    setHorizonBlendMax(blendMax: number | Record<number, number>): void;
    setHorizonBlendMieStart(blendMieStart: number | Record<number, number>): void;
    setHorizonBlendMin(blendMin: number | Record<number, number>): void;
    setHorizonBlendStart(blendStart: number | Record<number, number>): void;
    setMoonMieStrength(moonMieStrength: number | Record<number, number>): void;
    setRayleighStrength(rayleighStrength: number | Record<number, number>): void;
    setSkyHorizonColor(color: Record<number, minecraftserver.RGB> | minecraftserver.RGB): void;
    setSkyZenithColor(color: Record<number, minecraftserver.RGB> | minecraftserver.RGB): void;
    setSunGlareShape(sunGlareShape: number | Record<number, number>): void;
    setSunMieStrength(sunMieStrength: number | Record<number, number>): void;
    }
    Index

    Constructors

    Methods

    • Returns void

      Resets the horizon blend max to the value set by resource packs

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.EngineError

    • Returns void

      Resets the horizon blend mie start to the value set by resource packs

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.EngineError

    • Returns void

      Resets the horizon blend min to the value set by resource packs

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.EngineError

    • Returns void

      Resets the horizon blend start to the value set by resource packs

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.EngineError

    • Returns void

      Resets the moon mie strength to the value set by resource packs

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.EngineError

    • Returns void

      Resets the rayleigh strength to the value set by resource packs

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.EngineError

    • Returns void

      Resets the sky horizon color to the color set by resource packs

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.EngineError

    • Returns void

      Resets the sky zenith color to the color set by resource packs

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.EngineError

    • Returns void

      Resets the sun glare shape to the value set by resource packs

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.EngineError

    • Returns void

      Resets the sun mie strength to the value set by resource packs

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.EngineError

    • Parameters

      • blendMax: number | Record<number, number>

        Either a number (range [0,1]) or a set of keyframes. The keyframes are composed of key value pairs. The key is a number (range [0,1]) to signify a time of day (0.0 and 1.0 are noon, 0.25 is sunset, 0.5 is midnight, and 0.75 is sunrise). The value is also a number (range [0,1])

      Returns void

      Sets the horizon blend max for atmospheric scattering in Vibrant Visuals

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.InvalidArgumentError

    • Parameters

      • blendMieStart: number | Record<number, number>

        Either a number (range [0,1.2]) or a set of keyframes. The keyframes are composed of key value pairs. The key is a number (range [0,1]) to signify a time of day (0.0 and 1.0 are noon, 0.25 is sunset, 0.5 is midnight, and 0.75 is sunrise). The value is also a number (range [0,1.2])

      Returns void

      Sets the horizon blend mie start for atmospheric scattering in Vibrant Visuals

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.InvalidArgumentError

    • Parameters

      • blendMin: number | Record<number, number>

        Either a number (range [0,1]) or a set of keyframes. The keyframes are composed of key value pairs. The key is a number (range [0,1]) to signify a time of day (0.0 and 1.0 are noon, 0.25 is sunset, 0.5 is midnight, and 0.75 is sunrise). The value is also a number (range [0,1])

      Returns void

      Sets the horizon blend min for atmospheric scattering in Vibrant Visuals

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.InvalidArgumentError

    • Parameters

      • blendStart: number | Record<number, number>

        Either a number (range [0,1]) or a set of keyframes. The keyframes are composed of key value pairs. The key is a number (range [0,1]) to signify a time of day (0.0 and 1.0 are noon, 0.25 is sunset, 0.5 is midnight, and 0.75 is sunrise). The value is also a number (range [0,1])

      Returns void

      Sets the horizon blend start for atmospheric scattering in Vibrant Visuals

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.InvalidArgumentError

    • Parameters

      • moonMieStrength: number | Record<number, number>

        Either a number (range [0,60]) or a set of keyframes. The keyframes are composed of key value pairs. The key is a number (range [0,1]) to signify a time of day (0.0 and 1.0 are noon, 0.25 is sunset, 0.5 is midnight, and 0.75 is sunrise). The value is also a number (range [0,60])

      Returns void

      Sets the moon mie strength for atmospheric scattering in Vibrant Visuals

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.InvalidArgumentError

    • Parameters

      • rayleighStrength: number | Record<number, number>

        Either a number (range [0,11]) or a set of keyframes. The keyframes are composed of key value pairs. The key is a number (range [0,1]) to signify a time of day (0.0 and 1.0 are noon, 0.25 is sunset, 0.5 is midnight, and 0.75 is sunrise). The value is also a number (range [0,11])

      Returns void

      Sets the rayleigh strength for atmospheric scattering in Vibrant Visuals

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.InvalidArgumentError

    • Parameters

      • color: RGB | Record<number, RGB>

        Either a RGB triplet or a set of keyframes. The keyframes are composed of key value pairs. The key is a number (range [0,1]) to signify a time of day (0.0 and 1.0 are noon, 0.25 is sunset, 0.5 is midnight, and 0.75 is sunrise). The value is a RGB triplet

      Returns void

      Sets the sky horizon color for atmospheric scattering in Vibrant Visuals

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.InvalidArgumentError

    • Parameters

      • color: RGB | Record<number, RGB>

        Either a RGB triplet or a set of keyframes. The keyframes are composed of key value pairs. The key is a float in the range 0-1 to signify a time of day and the value is a RGB triplet

      Returns void

      Sets the sky zenith color for atmospheric scattering in Vibrant Visuals

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.InvalidArgumentError

    • Parameters

      • sunGlareShape: number | Record<number, number>

        Either a number (range [0,50]) or a set of keyframes. The keyframes are composed of key value pairs. The key is a number (range [0,1]) to signify a time of day (0.0 and 1.0 are noon, 0.25 is sunset, 0.5 is midnight, and 0.75 is sunrise). The value is also a number (range [0,50])

      Returns void

      Sets the sun glare shape for atmospheric scattering in Vibrant Visuals

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.InvalidArgumentError

    • Parameters

      • sunMieStrength: number | Record<number, number>

        Either a number (range [0,60]) or a set of keyframes. The keyframes are composed of key value pairs. The key is a number (range [0,1]) to signify a time of day (0.0 and 1.0 are noon, 0.25 is sunset, 0.5 is midnight, and 0.75 is sunrise). The value is also a number (range [0,60])

      Returns void

      Sets the sun mie strength for atmospheric scattering in Vibrant Visuals

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.InvalidArgumentError