import * as mc from "@minecraft/server";
import * as utils from "../utils/index";
export function waitForInput() {
    return new Promise(resolve => {
        const event = (e) => {
            resolve(e.itemStack.nameTag === "Good");
            mc.world.afterEvents.itemUse.unsubscribe(event);
        };
        mc.world.afterEvents.itemUse.subscribe(event);
    });
}
export function snapToSurface(dimension, origin, yCap) {
    var _a, _b;
    yCap = yCap !== null && yCap !== void 0 ? yCap : dimension.heightRange.max;
    const blockLocation = (_b = (_a = dimension.getTopmostBlock(origin, yCap)) === null || _a === void 0 ? void 0 : _a.location) !== null && _b !== void 0 ? _b : origin;
    return new utils.Vector3(blockLocation);
}
