import { system as dadyagd67a } from "@minecraft/server";

const au7c76asc = "dss:golf_flag_c";
const kk_s8daa21s = "block_jesu:dss_gep_hole";

function cca9s8(biff8) {
    return {x: biff8.location.x, y: biff8.location.y-1, z: biff8.location.z}
}

function aidjwa8c(duhaus7) {
    let { permutationToPlace } = duhaus7;

    const xa9s2d = duhaus7.block.dimension.getBlock(cca9s8(duhaus7.block));
    if (xa9s2d && xa9s2d.typeId === kk_s8daa21s) {
        permutationToPlace = permutationToPlace.withState("dss:golf_flag", "in");
    }

    duhaus7.permutationToPlace = permutationToPlace;
}

dadyagd67a.beforeEvents.startup.subscribe((sy7xa6) => {
    sy7xa6.blockComponentRegistry.registerCustomComponent(au7c76asc, {
        beforeOnPlayerPlace: aidjwa8c
    });
})