// kubejs/server_scripts/strange_aeons_dragonsteel_ingots.js

ServerEvents.recipes(event => {
  const MANASTEEL = 'botania:manasteel_ingot'

  const recipes = [
    {
      oldId: 'iceandfire:dragonforge/dragonsteel_fire_ingot',
      newId: 'strange_aeons:dragonforge/dragonsteel_fire_from_manasteel',
      dragonType: 'fire',
      blood: 'iceandfire:fire_dragon_blood',
      result: 'iceandfire:dragonsteel_fire_ingot'
    },
    {
      oldId: 'iceandfire:dragonforge/dragonsteel_ice_ingot',
      newId: 'strange_aeons:dragonforge/dragonsteel_ice_from_manasteel',
      dragonType: 'ice',
      blood: 'iceandfire:ice_dragon_blood',
      result: 'iceandfire:dragonsteel_ice_ingot'
    },
    {
      oldId: 'iceandfire:dragonforge/dragonsteel_lightning_ingot',
      newId: 'strange_aeons:dragonforge/dragonsteel_lightning_from_manasteel',
      dragonType: 'lightning',
      blood: 'iceandfire:lightning_dragon_blood',
      result: 'iceandfire:dragonsteel_lightning_ingot'
    }
  ]

  recipes.forEach(recipe => {
    event.remove({ id: recipe.oldId })

    event.custom({
      type: 'iceandfire:dragonforge',
      dragon_type: recipe.dragonType,
      cook_time: 1000,
      input: {
        item: MANASTEEL
      },
      blood: {
        item: recipe.blood
      },
      result: {
        item: recipe.result
      }
    }).id(recipe.newId)
  })
})