// priority: 0

onEvent('recipes', e => {
  //removals
  removeRecipeByID(e, [
    BT("water_pump"),
    BT("hammer"),
    BT("compressor"),
    BT("blast_furnace"),
    BT("solar_panel"),
    BT("coal_generator"),
    BT("fuel_refinery"),
    BT("oxygen_mask"),
    BT("netherite_oxygen_mask"),
    BT("space_suit"),
    BT("netherite_space_suit"),
    BT("space_leggings"),
    BT("netherite_space_pants"),
    BT("space_boots"),
    BT("netherite_space_boots"),
    BT("oxygen_gear"),
    BT('oxygen_tank'),
  ])

  //energy acceptor
  e.replaceInput({ id: AE2("network/blocks/energy_energy_acceptor") }, AE2("#crystals/fluix"), AE2("#crystals/certus"))



  //sky stone
  e.shaped(AE2('sky_stone_block'), ['AA ', 'AA '], {
    A: ENS('pebble_blackstone'),
  }).id(KJ(`${AE2()}/sky_stone_from_pebble`))

  //compressed metals
  e.recipes.createPressing(EE("steel_plate"), F("#ingots/steel"))
  e.recipes.createPressing(BT("desh_plate"), F("#ingots/desh"))

  const metals = [
    { metal: "steel", ingot: EE("steel_plate") },
    { metal: "desh", ingot: BT("desh_plate") },
    { metal: "silicon", ingot: BT("silicon_ingot") },
  ]
  metals.forEach(metalObj => {
    const { metal, ingot } = metalObj
    e.remove({ output: BT(`compressed_${metal}`) })
  
    let tMetal = KJ(`incomplete_${metal}_plate`)
    e.recipes.createSequencedAssembly([
      BT(`compressed_${metal}`),
    ], ingot, [
      e.recipes.createPressing(tMetal, tMetal)
    ]).transitionalItem(tMetal)
      .loops(16)
      .id(KJ(`compressed_${metal}`))
  })

  //helmet
  const { space, spaceNetherite } = armorMats
	const { ultimate } = templates

  //space helmet
  e.recipes.extendedcrafting.shaped_table(BT("oxygen_mask"), ultimate.helmet, ultArmorObj(space, "helmet"))
    .id(KJ(`${BT()}/extended_crafting/oxygen_mask`))

  //netherite helmet
  e.recipes.extendedcrafting.shaped_table(BT("netherite_oxygen_mask"), ultimate.helmet, ultArmorObj(spaceNetherite, "helmet"))
    .id(KJ(`${BT()}/extended_crafting/netherite_oxygen_mask`))

  //space suit
  e.recipes.extendedcrafting.shaped_table(BT("space_suit"), ultimate.chestplate, ultArmorObj(space, "chestplate"))
    .id(KJ(`${BT()}/extended_crafting/space_suit`))

  //netherite suit
  e.recipes.extendedcrafting.shaped_table(BT("netherite_space_suit"), ultimate.chestplate, ultArmorObj(spaceNetherite, "chestplate"))
    .id(KJ(`${BT()}/extended_crafting/netherite_space_suit`))

	//space pants
  e.recipes.extendedcrafting.shaped_table(BT("space_pants"), ultimate.pants, ultArmorObj(space, "pants"))
    .id(KJ(`${BT()}/extended_crafting/space_pants`))

  //netherite pants
  e.recipes.extendedcrafting.shaped_table(BT("netherite_space_pants"), ultimate.pants, ultArmorObj(spaceNetherite, "pants"))
    .id(KJ(`${BT()}/extended_crafting/netherite_space_pants`))

	//space boots
  e.recipes.extendedcrafting.shaped_table(BT("space_boots"), ultimate.boots, ultArmorObj(space, "boots"))
    .id(KJ(`${BT()}/extended_crafting/space_boots`))

  //netherite boots
  e.recipes.extendedcrafting.shaped_table(BT("netherite_space_boots"), ultimate.boots, ultArmorObj(spaceNetherite, "boots"))
    .id(KJ(`${BT()}/extended_crafting/netherite_space_boots`))

  //oxygen gear
  e.recipes.extendedcrafting.shaped_table(BT('oxygen_gear'), [
    '  A  ',
    'BBBBB',
    'BCBCB',
    'BCBCB',
    'BBBBB',
  ], {
    A: MC('end_rod'),
    B: F('#plates/steel'),
    C: M('electrolytic_core'),
  }).id(KJ(`${BT()}/extended_crafting/oxygen_gear`))

  //oxygen tank
  e.recipes.extendedcrafting.shaped_table(BT('oxygen_tank'), [
    '  C  ',
    ' ADA ',
    ' ABA ',
    ' AEA ',
    ' AAA ',
  ], {
    A: F('#plates/steel'),
    B: M('scuba_tank'),
    C: F('#gears/gold'),
    D: M('electrolytic_core'),
    E: M('ultimate_chemical_tank'),
  }).id(KJ(`${BT()}/extended_crafting/oxygen_tank`))
})
