events.listen('recipes', function (e) {
//Blood Altar
  e.remove({ id: 'bloodmagic:blood_altar' })
  e.custom(
    {
      "type": "extendedcrafting:shaped_ender_crafter",
      "pattern": ["ABA", "ACA", "DED"],
      "key": {
        "A": { "item": "undergarden:depthrock" },
        "B": { "type": "forge:nbt", "item": "botania:brew_vial", "count": 1, "nbt": "{brewKey:\"botania:bloodthirst\"}" },
        "C": { "item": "botania:runic_altar" },
        "D": { "item": "bluepower:red_alloy_ingot" },
        "E": { "item": "betterendforge:terminite_ingot" }
      },
      "result": { "item": "bloodmagic:altar", "count": 1 }
    }
  )
//Hellfire Forge
  e.remove({ id: 'bloodmagic:soul_forge' })
  e.shaped(item.of('bloodmagic:soulforge', 1), ['A A','BCB','BDB'],
  {
    A: 'forbidden_arcanus:arcane_crystal',
    B: 'quark:basalt',
    C: 'bloodmagic:basemonstersoul',
    D: 'botania:piston_relay'
  })
  /******************************TOOL******************************/
//AIR
  e.remove({ id: 'bloodmagic:altar/air_tool' })
  bloodAltar('botania:rune_air', 'bloodmagic:airscribetool', 2, 1000, 5, 5)
//WATER
  e.remove({ id: 'bloodmagic:altar/water_tool' })
  bloodAltar('botania:rune_water', 'bloodmagic:waterscribetool', 2, 1000, 5, 5)
//FIRE
  e.remove({ id: 'bloodmagic:altar/fire_tool' })
  bloodAltar('botania:rune_fire', 'bloodmagic:firescribetool', 2, 1000, 5, 5)
//EARTH
  e.remove({ id: 'bloodmagic:altar/earth_tool' })
  bloodAltar('botania:rune_earth', 'bloodmagic:earthscribetool', 2, 1000, 5, 5)
//DUSK
  e.remove({ id: 'bloodmagic:altar/dusk_tool' })
  bloodAltar('botania:rune_mana', 'bloodmagic:duskscribetool', 3, 2000, 20, 20)
/******************************ORB**************************/
//WEAK
  e.remove({ id: 'bloodmagic:altar/weakbloodorb' })
  bloodAltar('botania:mana_diamond', 'bloodmagic:weakbloodorb', 0, 2000, 5, 1)
//APPRENTICE
  e.remove({ id: 'bloodmagic:altar/apprenticebloodorb' })
  bloodAltar('astralsorcery:starmetal', 'bloodmagic:apprenticebloodorb', 1, 5000, 5, 5)
//MAGICIAN
  e.remove({ id: 'bloodmagic:altar/magicianbloodorb' })
  bloodAltar('aquaculture:neptunium_ingot', 'bloodmagic:magicianbloodorb', 2, 25000, 20, 20)
//MASTER
  e.remove({ id: 'bloodmagic:altar/masterbloodorb' })  
  bloodAltar('eidolon:shadow_gem', 'bloodmagic:masterbloodorb', 3, 40000, 30, 50)
//Blank Slate  
  e.remove({ id: 'bloodmagic:altar/slate' })
  bloodAltar('botania:livingrock', 'bloodmagic:blankslate', 0, 1000, 5, 5)
//Ethereal Slate
  bloodAltar('bloodmagic:demonslate', 'bloodmagic:etherealslate', 4, 30000, 20, 20)

//Reversion
  e.remove({id: "bloodmagic:arc/reversion/master_blood_orb"})
  e.remove({id: "bloodmagic:arc/reversion/apprentice_blood_orb"})
  e.remove({id: "bloodmagic:arc/reversion/weak_blood_orb"})
  e.remove({id: "bloodmagic:arc/reversion/magician_blood_orb"})

  bloodReversion('bloodmagic:weakbloodorb', 'botania:mana_diamond')
  bloodReversion('bloodmagic:apprenticebloodorb', 'astralsorcery:starmetal')
  bloodReversion('bloodmagic:magicianbloodorb', 'aquaculture:neptunium_ingot')
  bloodReversion('bloodmagic:masterbloodorb', 'eidolon:shadow_gem')


/******************************FUNCTION**************************/
  function bloodAltar(input, output, lvl, qte, consRate, drRate){
    e.custom({"type": "bloodmagic:altar","input": {"item": input},"output": {"item": output},"upgradeLevel": lvl,"altarSyphon": qte,"consumptionRate": consRate,"drainRate": drRate})}
  
  function bloodReversion (input, output){
    e.custom({"type": "bloodmagic:arc","input": {"item": input},"tool": {"tag": "bloodmagic:arc/reverter"},"output": {"item": output},"consumeingredient": true})}
})