import { MolangVariableMap } from "@minecraft/server";

const FallingLeaves = {
    onTick(event) {
        const block = event.block;
        const dimension = event.dimension // Dimension that contains the block

        const variables = new MolangVariableMap();
        variables.setColorRGB("variable.color", {
            red: 0.541,
            green: 0.157,
            blue: 0.125
        });

        dimension.spawnParticle(
            "minecraft:biome_tinted_leaves_particle",
            { x: block.location.x + 0.5, y: block.location.y + 0.8, z: block.location.z + 0.5 },
            variables
        );
    }
};

export default FallingLeaves;
