var LINKS = [
  'projectexpansion:basic_emc_link',   // T1
  'projectexpansion:dark_emc_link',    // T2
  'projectexpansion:red_emc_link',     // T3
  'projectexpansion:magenta_emc_link', // T4
  'projectexpansion:pink_emc_link',    // T5
  'projectexpansion:purple_emc_link',  // T6
  'projectexpansion:violet_emc_link',  // T7
  'projectexpansion:blue_emc_link',    // T8
  'projectexpansion:cyan_emc_link',    // T9
];

// Escalating mats for T2..T9
var MAT = [
  { A: '#forge:storage_blocks/steel',        B: 'the_cooler_hopper:bluestone_block' }, // T2
  { A: 'tconstruct:rose_gold_block',        B: 'enderio:dark_steel_block'     }, // T3
  { A: '#forge:storage_blocks/diamond',       B: 'scguns:treated_brass_block'     }, // T4
  { A: '#forge:storage_blocks/emerald',       B: '#forge:storage_blocks/diamond'  }, // T5
  { A: 'minecraft:netherite_block', B: '#forge:storage_blocks/emerald'  }, // T6
  { A: 'sophisticatedstorage:netherite_shulker_box',   B: 'scguns:scorched_block'            }, // T7
  { A: 'tconstruct:amethyst_bronze_block',      B: 'nuclearcraft:xenorium_298' }, // T8
  { A: 'minecraft:nether_star',     B: 'enderio:reinforced_obsidian_block'      }, // T9
];

ServerEvents.recipes(function (event) {
  // Nuke any existing recipes for the first 9 links
  for (var i = 0; i < LINKS.length; i++) {
    event.remove({ output: LINKS[i] });
  }

  // Tier 1 base craft
  event.shaped(LINKS[0], [
    'HEH',
    'C#C',
    'RHR'
  ], {
    H: 'the_cooler_hopper:ender_hopper',
    E: 'projecte:aeternalis_fuel_block',
    C: 'projecte:alchemical_chest',
    R: '#forge:storage_blocks/redstone',
    '#': 'minecraft:crying_obsidian'
  });

  // T2..T9 upgrades (use var, not const/let, for Rhino)
  for (var j = 1; j < LINKS.length; j++) {
    var m = MAT[j - 1]; // ← key change: plain var + different name
    event.shaped(LINKS[j], [
      'ABA',
      'B#B',
      'ABA'
    ], {
      A: m.A,
      B: m.B,
      '#': LINKS[j - 1]
    });
  }
});