// 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 Casing
event.recipes.extendedcrafting.shaped_table("8x kubejs:prismatic_casing", 
	['abbbbba', 
	 'bacccab', 
	 'bcdddcb',
	 'bcdedcb',
	 'bcdddcb',
	 'bacccab',
	 'abbbbba'
	 ], 
	{
		a: 'mekanism_extras:reinforced_induction_casing',
		b: 'bigreactors:reinforced_turbinecasing',
		c: 'mekanismgenerators:fission_reactor_casing',
		d: 'create_new_age:reactor_casing',
		e: '#kubejs:prismatter'
	}
).tier(3);	

// 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'
  }
)

// Prismatic Alchemy Alloyer
event.recipes.extendedcrafting.shaped_table("mbd2:palloyer", 
	['abbabba', 
	 'bcdcdcb', 
	 'bdefedb',
	 'acfffca',
	 'bdefedb',
	 'bcdcdcb',
	 'abbabba'
	 ], 
	{
		a: 'enderio:reinforced_obsidian_block',
		b: 'kubejs:prismatic_casing',
		c: 'malum:block_of_blazing_quartz',
		d: 'botania:blaze_block',
		e: 'createdieselgenerators:diesel_engine',
		f: 'create_new_age:nuclear_fuel'
	}
).tier(3);

// Prismatic Precision Assembler
event.recipes.extendedcrafting.shaped_table("mbd2:passembler", 
	['abbabba', 
	 'bcdcdcb', 
	 'bdefedb',
	 'acghgca',
	 'bdefedb',
	 'bcdcdcb',
	 'abbabba'
	 ], 
	{
		a: 'pneumaticcraft:smooth_plastic_brick_white',
		b: 'kubejs:prismatic_casing',
		c: 'mekanism:ingot_refined_obsidian',
		d: 'mekanism:hdpe_sheet',
		e: 'thermal:diamond_gear',
		f: 'enderio:octadic_capacitor',
		g: 'pneumaticcraft:capacitor',
		h: 'mekanism:ultimate_control_circuit'
	}
).tier(3);

// Prismatic Ritual Diviner
event.recipes.extendedcrafting.shaped_table("mbd2:pritualiser", 
	['abbabba', 
	 'bcdcdcb', 
	 'bdeifdb',
	 'acijica',
	 'bdgihdb',
	 'bcdcdcb',
	 'abbabba'
	 ], 
	{
		a: 'bloodmagic:bloodstonebrick',
		b: 'kubejs:prismatic_casing',
		c: 'bloodmagic:demonslate',
		d: 'botania:terrasteel_ingot',
		e: 'ars_nouveau:fire_essence',
		f: 'ars_nouveau:earth_essence',
		g: 'ars_nouveau:air_essence',
		h: 'ars_nouveau:water_essence',
		i: 'malum:cthonic_gold',
		j: 'embers:glimmer_crystal'
	}
).tier(3);

// Prismatic Cosmic Channeler
event.recipes.extendedcrafting.shaped_table("mbd2:cosmicchanneler", 
	['abbabba', 
	 'bcdcdcb', 
	 'bdefedb',
	 'acfgfca',
	 'bdefedb',
	 'bcdcdcb',
	 'abbabba'
	 ], 
	{
		a: 'projecte:dark_matter_block',
		b: 'kubejs:prismatic_casing',
		c: 'botania:gaia_ingot',
		d: 'thermal_extra:shellite_ingot',
		e: 'mekanism_extras:cosmic_control_circuit',
		f: 'aetherworks:gem_aether',
		g: 'minecraft:nether_star'
	}
).tier(3);

// 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("kubejs:radiant_gem", ["botania:dragonstone", "ars_nouveau:source_gem", "embers:dawnstone_plate", "malum:cluster_of_brilliance"], 50000)
event.recipes.botania.elven_trade(["kubejs:radiant_crystal"], "kubejs:radiant_gem")

// Cosmic Focus Crystal
event.recipes.extendedcrafting.shaped_table("9x kubejs:cosmic_focus_crystal", 
	['abcdcba', 
	 'befffeb', 
	 'cgjjjhc',
	 'dgjjjhd',
	 'cgjjjhc',
	 'beiiieb',
	 'abcdcba'
	 ], 
	{
		a: 'draconicevolution:wyvern_core',
		b: 'mekanism_extras:alloy_spectrum',
		c: 'aetherworks:gem_aether',
		d: 'mythicbotany:alfsteel_ingot',
		e: 'bloodmagic:etherealslate',
		f: 'bigreactors:ludicrite_block',
		g: 'thermal_extra:twinite_block',
		h: 'enderio:end_steel_block',
		i: 'malum:block_of_brilliance',
		j: 'kubejs:radiant_crystal'
	}
).tier(3);

// 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', 'mythicbotany:asgard_rune', 'thermal_extra:soul_infused_gear', 'bigreactors:yellorium_ingot']
)

event.recipes.ars_nouveau.imbuement(
        'malum:chunk_of_brilliance', // input item
        'bigreactors:benitoite_crystal', // output
        4000, // source cost
        ['botania:rune_summer', 'mythicbotany:niflheim_rune', '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', 100), Fluid.of('thermal:resin', 25)], Fluid.of('thermal:creosote', 200)).energy(20000)

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

// Quantised Prismatter
event.shapeless(
  Item.of('kubejs:emc_prismatter'),
  [
    'kubejs:transcendent',
    'kubejs:prismatter'
  ]
).keepIngredient('kubejs:transcendent')

// 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
})

})