const structures = ["scguns:village/houses/desert_gunsmith_house", "scguns:village/houses/plains_gunsmith_house", "scguns:village/houses/savanna_gunsmith_house", "scguns:village/houses/snowy_gunsmith_house", "scguns:village/houses/taiga_gunsmith_house"];
const poiBlocks = ["scguns:gun_bench"];

function isVillageStructure(id) {
    for (let s of structures) {
        if (id.startsWith(s)) {
            return true;
        }

    }
    return false;
}

MoreJSEvents.structureLoad((event) => {
    if (!isVillageStructure(event.id)) {
        return; // if the structure is not in the list, return
    }

    // iterate through all palettes
    event.forEachPalettes((palette) => {
        palette.forEach((blockInfo) => {
            if (poiBlocks.includes(`${blockInfo.id}`)) {
                blockInfo.setBlock("minecraft:crafting_table")
            }
        });
    });
});
