import { world, system } from "@minecraft/server";

system.runInterval(() => {
    let players = world.getAllPlayers()
    for (const player of players) {
        if (player.hasTag("is_air")) {
            let pos = player.location;
            let dimension = player.dimension;
            let belowBlock = dimension.getBlock({ x: pos.x, y: pos.y - 1, z: pos.z });

            if (!belowBlock || belowBlock.typeId === "minecraft:air") {
                player.addEffect("levitation", 1, { duration: 0.3, amplifier: 0.1, showParticles: false });
            }
        }
    }
}, 1.7);