ServerEvents.recipes(event => {
    //Spiritfire Machine
    event.custom ({
        "type": "bloodmagic:altar",
        "input": {
          "item": "occultism:spirit_campfire"
        },
        "output": {
            type: "forge:nbt",
            item: "custommachinery:custom_machine_item",
            count: 1,
            nbt: "{machine:\"mystian:spiritfire\"}"
        },
        "upgradeLevel": 4,
        "altarSyphon": 250000,
        "consumptionRate": 30,
        "drainRate": 50
    }).id('impostor:bloodaltar/spiritfire')


    //Spiritfire Structure/Function
    function spiritfire(itemInput, inputAmount, itemOutput, outputAmount, energyAmount, time, recipeId) {
      event.custom({
        "type": "custommachinery:custom_machine",
        "machine": "mystian:spiritfire",
        "time": time,
        "requirements": [
        {
            "type": "custommachinery:energy_per_tick",
            "mode": "input",
            "amount": energyAmount
        },
        {
            "type": "custommachinery:item",
            "id": "iteminput",
            "mode": "input",
            "item": itemInput,
            "amount": inputAmount
        },
        {
            "type": "custommachinery:item",
            "id": "itemoutput",
            "mode": "output",
            "item": itemOutput,
            "amount": outputAmount
        },
        {
          "type": "custommachinery:structure",
          "pattern": [
            [
              "  FFF  ",
              " FFFFF ",
              "FFJFIFF",
              "FFFFFFF",
              "FFHFGFF",
              " FFFFF ",
              "  FmF  ",
            ],
            [
              "  ABA  ",
              " A A A ",
              "A DAD A",
              "BAAEAAB",
              "A DAD A",
              " A A A ",
              "  ABA  "
            ]
          ],
          "keys": {
            "A": "occultism:chalk_glyph_white",
            "B": "occultism:candle_white",
            "D": "occultism:sacrificial_bowl",
            "E": "occultism:golden_sacrificial_bowl",
            "F": "occultism:otherstone",
            "G": "bloodmagic:earthritualstone",
            "H": "bloodmagic:fireritualstone",
            "I": "bloodmagic:airritualstone",
            "J": "bloodmagic:waterritualstone" // Remove the last comma for valid JSON
          }
        }
        
        ]
    }).id('mystian:spiritfire/' + recipeId)
  }

  //Input - Input Amount - Output - Output Amount - Energy Amount - Time - ID
  spiritfire('occultism:chalk_red_impure', 1, 'occultism:chalk_red', 1, 1000, 100, 'chalk_red')
  spiritfire('minecraft:black_dye', 1, 'occultism:purified_ink', 1, 100, 100, 'purified_ink')
  spiritfire('occultism:chalk_purple_impure', 1, 'occultism:chalk_purple', 1, 500, 100, 'chalk_purple')
  spiritfire('eidolon:shadow_gem', 1, 'occultism:spirit_attuned_gem', 1, 100, 20, 'spirit_attuned_gem')
  spiritfire('eidolon:shadow_gem_block', 1, 'occultism:spirit_attuned_gem', 9, 250, 20, 'spirit_attuned_gem_block')
})