// for 1.18 pls use: onEvent("morejs.structure.load", (event) => { ... })
MoreJS.structureLoad((event) => {
  /**
   * `event.id`: The id of the structure.
   * `event.structureSize`: The size of the structure.
   * `event.palettesSize`: The size of the palettes.
   * `event.entitiesSize`: The size of the entities.
   * `event.removePalette(index)`: Removes the palette at the given index. Throws exception if invalid index!
   * `event.getPalette(index)`: Returns the palette at the given index. Throws exception if invalid index!
   * `event.forEachPalettes((palette) => { ... })`: Iterates over all palettes.
   * `event.entities`: The entities in the structure.
   */

  // Iterate through all palettes in the structure
  event.forEachPalettes((palette) => {
    // Find and replace irons_spellbooks:alchemist_cauldron blocks with hexerei:mixing_cauldron
    palette.forEach((blockData) => {
      if (blockData.id === 'irons_spellbooks:alchemist_cauldron') {
        // Replace the block while preserving properties if needed
        blockData.setBlock('hexerei:mixing_cauldron', blockData.properties);
      }
    });
  });
});
