import { system } from "@minecraft/server";
import { getDimension } from "../utils";

export async function getBiome(player) {
    const entity = getDimension().spawnEntity("minty_ew:biome_checker", player.location);
    const biome = await new Promise((resolve) => {
        system.runTimeout(() => {
            const biome = entity.getProperty("minty_ew:biome");
            entity.remove();
            resolve(biome);
        }, 2);
    });
    return biome;
}
