ServerEvents.recipes((event) => {
  /// ENCHANTING APPARATUS FUNCTION
  function enchantingApparatus(name, pedestalItems, reagent, result, sourceCost) {
    event.custom({
      type: 'ars_nouveau:enchanting_apparatus',
      keepNbtOfReagent: false,
      pedestalItems: pedestalItems.map((i) => ({ item: i })),
      reagent: { item: reagent },
      result: { item: result, count: 1, id: result },
      sourceCost: sourceCost,
    });
  }
  /// REMOVING
  event.remove({
    output: [
      'apotheosis:simple_reforging_table',
      'apotheosis:reforging_table',
      'apothic_enchanting:hellshelf',
      'apothic_enchanting:glowing_hellshelf',
      'apothic_enchanting:blazing_hellshelf',
      'apothic_enchanting:sightshelf',
      'apothic_enchanting:library',
      'apothic_enchanting:ender_library',
      'apothic_enchanting:endshelf',
      'apothic_enchanting:draconic_endshelf',
      'apothic_enchanting:pearl_endshelf',
      'apothic_enchanting:treasure_shelf',
      'apothic_enchanting:dormant_deepshelf',
      'apothic_enchanting:scrap_tome',
    ],
  }),
    event.shaped('4x apothic_enchanting:scrap_tome', ['IBI', 'BAB', 'IBI'], {
      B: 'minecraft:book',
      I: 'renether:tourmaline',
      A: 'minecraft:anvil',
    }),
    event.shaped(Item.of('apothic_enchanting:hellshelf', 1), ['NNN', 'ABC', 'NNN'], {
      N: 'minecraft:nether_bricks',
      A: 'forbidden_arcanus:deorum_block',
      B: 'l2complements:blackstone_core',
      C: 'renether:tourmaline',
    });
  event.shaped(Item.of('apotheosis:simple_reforging_table', 1), ['ISI', 'WEW', 'WPW'], {
    I: 'ars_nouveau:source_gem',
    S: 'forbidden_arcanus:iron_blacksmith_gavel',
    E: 'mythsandlegends:cursed_core',
    W: 'minecraft:stone',
    P: 'hexerei:witch_hazel_planks',
  });
  enchantingApparatus(
    'apothic_enchanting:glowing_hellshelf',
    ['mythsandlegends:ethereal_flame', 'mythsandlegends:ethereal_flame', 'mythsandlegends:ethereal_flame', 'mythsandlegends:ethereal_flame', 'renether:blasting_charge', 'renether:blasting_charge', 'renether:blasting_charge'],
    'apothic_enchanting:infused_hellshelf',
    'apothic_enchanting:glowing_hellshelf',
    1000
  );
  enchantingApparatus(
    'apothic_enchanting:blazing_hellshelf',
    ['create:blaze_cake', 'mythsandlegends:fire_heart', 'mythsandlegends:fire_heart', 'create:blaze_cake', 'create:blaze_cake', 'mythsandlegends:fire_heart'],
    'apothic_enchanting:infused_hellshelf',
    'apothic_enchanting:blazing_hellshelf',
    1000
  );
  enchantingApparatus(
    'apothic_enchanting:sightshelf',
    ['createaddition:electrum_block', 'apothic_enchanting:infused_hellshelf', 'apothic_enchanting:infused_hellshelf', 'minecraft:golden_carrot', 'createaddition:electrum_block', 'hexerei:reading_glasses', 'createaddition:electrum_block', 'createaddition:electrum_block'],
    'cataclysm:flame_eye',
    'apothic_enchanting:sightshelf',
    2000
  );
  enchantingApparatus(
    'apothic_enchanting:dormant_deepshelf',
    ['minecraft:deepslate_tiles', 'minecraft:deepslate_tiles', 'minecraft:book', 'minecraft:deepslate_tiles', 'minecraft:deepslate_tiles', 'minecraft:deepslate_tiles', 'minecraft:book', 'minecraft:deepslate_tiles'],
    'l2complements:resonant_feather',
    'apothic_enchanting:dormant_deepshelf',
    4000
  );
  enchantingApparatus(
    'apothic_enchanting:treasure_shelf',
    [
      'apothic_enchanting:deepshelf',
      'forbidden_arcanus:arcane_crystal_block',
      'cataclysm:ancient_metal_block',
      'forbidden_arcanus:arcane_crystal_block',
      'apothic_enchanting:deepshelf',
      'forbidden_arcanus:arcane_crystal_block',
      'cataclysm:ancient_metal_block',
      'forbidden_arcanus:arcane_crystal_block',
    ],
    'forbidden_arcanus:deorum_block',
    'apothic_enchanting:treasure_shelf',
    10000
  );
  enchantingApparatus(
    'apothic_enchanting:endshelf',
    ['apothic_enchanting:infused_breath', 'chipped:end_stone_bricks', 'chipped:end_stone_bricks', 'chipped:end_stone_bricks', 'l2complements:void_eye', 'chipped:end_stone_bricks', 'chipped:end_stone_bricks', 'chipped:end_stone_bricks'],
    'apothic_enchanting:soul_touched_sculkshelf',
    'apothic_enchanting:endshelf',
    40000
  );
  enchantingApparatus(
    'apothic_enchanting:draconic_endshelf',
    ['minecraft:dragon_head', 'chipped:end_stone_bricks', 'apotheosis:mythic_material', 'irons_spellbooks:divine_soulshard', 'apotheosis:mythic_material', 'irons_spellbooks:divine_soulshard', 'apotheosis:mythic_material', 'chipped:end_stone_bricks'],
    'apothic_enchanting:pearl_endshelf',
    'apothic_enchanting:draconic_endshelf',
    40000
  );
  enchantingApparatus(
    'apothic_enchanting:pearl_endshelf',
    ['apotheosis:mythic_material', 'minecraft:ender_pearl', 'apotheosis:mythic_material', 'minecraft:ender_pearl', 'apotheosis:mythic_material', 'minecraft:ender_pearl', 'apotheosis:mythic_material', 'minecraft:ender_pearl'],
    'apothic_enchanting:endshelf',
    'apothic_enchanting:pearl_endshelf',
    20000
  );
});
