// Scripts relating to creating and using transcendent matter

ServerEvents.recipes(event => {

// Remove induct smelter netherite recipe
event.remove({ output: 'minecraft:netherite_ingot', type: 'thermal:smelter' })

// Remove netherite dust infusing recipe
event.remove({ output: 'mekanism:dust_netherite'})

// Prismatic Input Bus
event.shaped(
  Item.of('mbd2:pcasinginputbus'),
  [
    ' A ',
    'ABA',
    ' A '
  ],
  {
    A: 'kubejs:prismatic_casing',
    B: 'mekanism:personal_chest'
  }
)

event.shaped(
  Item.of('mbd2:pcasingoutputbus'),
  [
    ' A ',
    'ABA',
    ' A '
  ],
  {
    A: 'kubejs:prismatic_casing',
    B: 'mekanism:personal_barrel'
  }
)

event.shaped(
  Item.of('mbd2:pcasinginputhatch'),
  [
    ' A ',
    'ABA',
    ' A '
  ],
  {
    A: 'kubejs:prismatic_casing',
    B: 'mekanism:ultimate_fluid_tank'
  }
)

event.shaped(
  Item.of('mbd2:pcasingcoolantinput'),
  [
    ' A ',
    'ABA',
    ' A '
  ],
  {
    A: 'kubejs:prismatic_casing',
    B: 'minecraft:blue_ice'
  }
)

event.shaped(
  Item.of('mbd2:pcasingfluxinput'),
  [
    ' A ',
    'ABA',
    ' A '
  ],
  {
    A: 'kubejs:prismatic_casing',
    B: 'mekanism:ultimate_control_circuit'
  }
)

event.shaped(
  Item.of('mbd2:pcasingmanainput'),
  [
    ' A ',
    'ABA',
    ' A '
  ],
  {
    A: 'kubejs:prismatic_casing',
    B: 'botania:rune_mana'
  }
)

// Alchemical Fuel
event.recipes.immersiveengineering.arc_furnace('kubejs:prism_fuel_block_active', 'projecte:aeternalis_fuel_block', ['create_new_age:nuclear_fuel', 'embers:ember_crystal_cluster', 'bigreactors:blutonium_ingot', 'mekanism:reprocessed_fissile_fragment'], 'projecte:high_covalence_dust', 100, 5000000)

// Assembly Matrix
event.custom({
  "type": "create:sequenced_assembly",
  "ingredient": {
    "item": "immersiveengineering:heavy_engineering"
  },
  "loops": 1,
  "results": [
    {
      "item": "kubejs:assembly_matrix_active"
    }
  ],
  "sequence": [
    {
      "type": "create:deploying",
      "ingredients": [
        {
          "item": "immersiveengineering:heavy_engineering"
        },
        [
          {
            "item": "pneumaticcraft:pneumatic_cylinder"
          }
        ]
      ],
      "results": [
        {
          "item": "immersiveengineering:heavy_engineering"
        }
      ]
    },
    {
      "type": "create:deploying",
      "ingredients": [
        {
          "item": "immersiveengineering:heavy_engineering"
        },
        [
          {
            "item": "create:precision_mechanism"
          }
        ]
      ],
      "results": [
        {
          "item": "immersiveengineering:heavy_engineering"
        }
      ]
    },
    {
      "type": "create:deploying",
      "ingredients": [
        {
          "item": "immersiveengineering:heavy_engineering"
        },
        [
          {
            "item": "mekanismgenerators:turbine_blade"
          }
        ]
      ],
      "results": [
        {
          "item": "immersiveengineering:heavy_engineering"
        }
      ]
    },
	{
      "type": "create:deploying",
      "ingredients": [
        {
          "item": "immersiveengineering:heavy_engineering"
        },
        [
          {
            "item": "thermal_extra:abyssal_gear"
          }
        ]
      ],
      "results": [
        {
          "item": "immersiveengineering:heavy_engineering"
        }
      ]
    }
  ],
  "transitionalItem": {
    "item": "immersiveengineering:heavy_engineering"
  }
})

// Radiant Crystal
event.recipes.botania.runic_altar("3x kubejs:radiant_gem", ["botania:dragonstone", "#forge:gems/source", "embers:dawnstone_plate", "malum:cluster_of_brilliance"], 50000)
event.recipes.botania.elven_trade(["kubejs:radiant_crystal"], "kubejs:radiant_gem")

// Nutrient Distillation chain
event.recipes.thermal.brewer(Fluid.of('kubejs:mushroom', 1000), [Fluid.of('minecraft:milk', 1000), '#forge:mushrooms']).energy(10000)
event.recipes.thermal.brewer(Fluid.of('kubejs:rotten', 1000), [Fluid.of('kubejs:mushroom', 1000), 'minecraft:rotten_flesh']).energy(16000)
event.recipes.thermal.brewer(Fluid.of('enderio:nutrient_distillation', 1000), [Fluid.of('kubejs:rotten', 1000), 'minecraft:fermented_spider_eye']).energy(24000)

// Cryo Cube chain
event.recipes.thermal.brewer(Fluid.of('kubejs:normal_ice', 1000), [Fluid.of('minecraft:water', 1000), 'minecraft:ice']).energy(10000)
event.recipes.thermal.brewer(Fluid.of('kubejs:packed_ice', 1000), [Fluid.of('kubejs:normal_ice', 1000), 'minecraft:packed_ice']).energy(16000)
event.recipes.thermal.brewer(Fluid.of('kubejs:blue_ice', 1000), [Fluid.of('kubejs:packed_ice', 1000), 'minecraft:blue_ice']).energy(24000)
event.recipes.thermal.chiller('kubejs:cryo_cube', [Fluid.of('kubejs:blue_ice', 1000)]).energy(20000)

// Missing thorium recipe
event.custom({
	"type":"mekanism:injecting",
	"chemicalInput":{
		"amount":10,
		"gas":"mekanism:uranium_hexafluoride"
	},
	"itemInput":{
		"ingredient":{
			"item":"minecraft:stone"
		}
	},
	"output":{
		"item":"create_new_age:thorium"
	}
})

// No orchids
event.remove({ output: 'botania:orechid'})
event.remove({ output: 'botania:orechid_ignem'})

// Netherite obtain
event.custom({
  "type": "embers:alchemy",
  "aspects": [
    {
      "tag": "embers:aspectus/aetherium"
    },
    {
      "tag": "embers:aspectus/lead"
    },
    {
      "tag": "embers:aspectus/silver"
    },
    {
      "tag": "embers:aspectus/dawnstone"
    }
  ],
  "inputs": [
    {
      "item": "botania:rune_wrath"
    },
    {
      "item": "bloodmagic:rawdemonite"
    },
    {
      "item": "minecraft:red_nether_bricks"
    },
    {
      "item": "embers:ancient_motive_core"
    }
  ],
  "output": {
    "item": "minecraft:ancient_debris"
  },
  "tablet": {
    "item": "projecte:red_matter_block"
  }
})

// Anglesite and Benitoite
event.recipes.ars_nouveau.imbuement(
        '#kubejs:ember_crystals', // input item
        'bigreactors:anglesite_crystal', // output
        4000, // source cost
        ['botania:rune_autumn', 'bloodmagic:lavasigil', 'thermal_extra:soul_infused_gear', 'malum:cthonic_gold']
)

event.recipes.ars_nouveau.imbuement(
        'malum:chunk_of_brilliance', // input item
        'bigreactors:benitoite_crystal', // output
        4000, // source cost
        ['botania:rune_summer', 'bloodmagic:watersigil', 'thermal_extra:dragonsteel_gear', 'bigreactors:blutonium_ingot']
)

// Fluxed Electrum

event.remove({output: 'extendedcrafting:enhanced_redstone_ingot'})
event.remove({output: 'extendedcrafting:flux_star'})

event.recipes.thermal.bottler('extendedcrafting:enhanced_redstone_ingot', [Fluid.of('kubejs:redstone_flux', 250), '#forge:ingots/electrum']).energy(20000)
event.recipes.thermal.bottler('extendedcrafting:flux_star', [Fluid.of('kubejs:redstone_flux', 2000), 'minecraft:nether_star']).energy(50000)

// Oil Recipe
event.recipes.thermal.refinery([Fluid.of('thermal:crude_oil', 150), Fluid.of('thermal:resin', 25)], Fluid.of('thermal:creosote', 200)).energy(10000)
event.recipes.thermal.refinery([Fluid.of('thermal:crude_oil', 150), Fluid.of('thermal:resin', 25)], Fluid.of('immersiveengineering:creosote', 200)).energy(10000)

// No crystaltine uses
event.remove({input: 'extendedcrafting:crystaltine_ingot'})

// Universium Ingots
event.custom({
  "type": "draconicevolution:fusion_crafting",
  "catalyst": {
    "tag": "forge:ingots/silver"
  },
  "ingredients": [
    {
      "tag": "kubejs:prismatter"
    },
    {
      "item": "kubejs:transcendent"
    },
	{
      "tag": "kubejs:dark_matter"
    },
	{
      "tag": "kubejs:red_matter"
    },
    {
      "item": "extendedcrafting:black_iron_ingot"
    },
    {
      "tag": "forge:ingots/draconium_awakened"
    }
  ],
  "result": {
    "item": "extendedcrafting:crystaltine_ingot"
  },
  "tier": "DRACONIC",
  "total_energy": 100000000
})

// Botania Dice Shatter
event.recipes.botania.mana_infusion("kubejs:shattered_dice", "botania:dice", 250000, 'botania:conjuration_catalyst')

})