import * as mc from "@minecraft/server";

export class stepManager {

    static beforeplace(data) {
        const block = data.block;
        const below = block.below();
        mc.system.runTimeout(() => {
            if (below.isAir) {
                below.setPermutation(mc.BlockPermutation.resolve("sgs_farm:step_support"));
            }
        }, 0)
    }

    static destroy(data) {
        const block = data.block;
        const above = block.above();
        if (above.hasTag("sgs_farm_step")) {
            block.dimension.runCommandAsync(`setblock ${above.x} ${above.y} ${above.z} air [] destroy`);
        }
    }
}