// Items gated behind prismatter

ServerEvents.tags('item', event => {
	
// Ember crystals
event.add('kubejs:prismatter', 'kubejs:prismatter')
event.add('kubejs:prismatter', 'kubejs:emc_prismatter')

})

ServerEvents.recipes(event => {

// Metallurgic Infusion Helper Function
function metallurgic_infusing(output, input, enrichType, enrichQuant) {
	event.custom({
		"type":"mekanism:metallurgic_infusing",
		"chemicalInput":{
			"amount": enrichQuant,
			"tag": enrichType
			},
		"itemInput":{
			"ingredient":{
				"item" : input
			}
		},
		"output":{
			"item": output
		}
	})
}

// Blood Magic: Dusk Scribing tool
event.remove({output: 'bloodmagic:duskscribetool'})
event.recipes.bloodmagic.altar('bloodmagic:duskscribetool', '#kubejs:prismatter').upgradeLevel(3).altarSyphon(2000).consumptionRate(20).drainRate(10)

// Pneumaticraft: Amadron Tablet
event.remove({output: 'pneumaticcraft:amadron_tablet'})
event.shaped(
  Item.of('pneumaticcraft:amadron_tablet'),
  [
    'aba',
    'aca',
    'ada'
  ],
  {
    a: 'pneumaticcraft:plastic',
    b: '#kubejs:prismatter',
	c: 'pneumaticcraft:gps_tool',
	d: 'pneumaticcraft:air_canister'
  }
)

// EnderIO: Soul Machine Chassis
event.replaceInput(
  { output: 'enderio:ensouled_chassis' },
  '#forge:gems/quartz',
  '#kubejs:prismatter'
)

// Mekanism: ultimate tier installer and fissile fuel assembly
event.replaceInput(
  { output: 'mekanism:ultimate_tier_installer' },
  '#minecraft:planks',
  '#kubejs:prismatter'
)

event.replaceInput(
  { output: 'mekanismgenerators:control_rod_assembly' },
  'mekanism:elite_control_circuit',
  '#kubejs:prismatter'
)

// Botania: beacons
event.remove({output: 'minecraft:beacon'})
event.shaped(
  Item.of('minecraft:beacon'),
  [
    'aaa',
    'aba',
    'cdc'
  ],
  {
    a: 'minecraft:glass',
    b: 'minecraft:nether_star',
	c: 'minecraft:obsidian',
	d: '#kubejs:prismatter'
  }
)

// Prisma melting and crushing
event.recipes.thermal.crucible(Fluid.of('kubejs:prisma', 1000), '#kubejs:prismatter').energy(24000)
event.recipes.thermal.pulverizer(Item.of('kubejs:prisma_dust').withChance(8.0), '#kubejs:prismatter').energy(24000)

// Quantiser Parts
event.shaped(
  Item.of('mbd2:prismatic_quantiser'),
  [
    'aba',
    'bcb',
    'aba'
  ],
  {
    a: 'ae2:smooth_sky_stone_block',
    b: '#kubejs:prismatter',
	c: 'ae2:controller'
  }
)

event.shaped(
  Item.of('mbd2:sky_stone_input_bus'),
  [
    'aba',
    'bcb',
    'aba'
  ],
  {
    a: 'ae2:smooth_sky_stone_block',
    b: 'minecraft:hopper',
	c: 'minecraft:chest'
  }
)

event.shaped(
  Item.of('mbd2:sky_stone_output_bus'),
  [
    'aba',
    'bcb',
    'aba'
  ],
  {
    a: 'ae2:smooth_sky_stone_block',
    b: 'minecraft:chest',
	c: 'minecraft:hopper'
  }
)

event.shaped(
  Item.of('mbd2:sky_stone_prisma_hatch'),
  [
    'aba',
    'bcb',
    'aba'
  ],
  {
    a: 'ae2:smooth_sky_stone_block',
    b: 'minecraft:bucket',
	c: '#kubejs:prismatter'
  }
)

event.shaped(
  Item.of('12x kubejs:infused_sky_stone'),
  [
    'aaa',
    'aba',
    'aaa'
  ],
  {
    a: 'ae2:smooth_sky_stone_block',
    b: '#kubejs:prismatter'
  }
)

// Flux core
event.remove({output: 'fluxnetworks:flux_core'})
event.remove({output: 'fluxnetworks:flux_controller'})
event.remove({output: 'fluxnetworks:basic_flux_storage'})
event.remove({output: 'fluxnetworks:herculean_flux_storage'})
event.remove({output: 'fluxnetworks:gargantuan_flux_storage'})

event.shaped(
  Item.of('4x fluxnetworks:flux_core'),
  [
    ' a ',
    'aba',
    ' a '
  ],
  {
    a: 'fluxnetworks:flux_dust',
    b: 'kubejs:prisma_dust'
  }
)

event.shaped(
  Item.of('fluxnetworks:flux_controller'),
  [
    'aaa',
    'aba',
    'aaa'
  ],
  {
    a: 'fluxnetworks:flux_core',
    b: 'mekanism:ultimate_energy_cube'
  }
)

// AE2 trans interface
event.shaped(
  Item.of('appliede:emc_module'),
  [
    'aba',
    'ced',
    'aba'
  ],
  {
    a: 'extendedcrafting:black_iron_ingot',
    b: 'projecte:transmutation_tablet',
	c: 'ae2:formation_core',
	d: 'ae2:annihilation_core',
	e: '#kubejs:prismatter'
  }
)

event.shaped(
  Item.of('appliede:emc_interface'),
  [
    'aba',
    'ced',
    'aba'
  ],
  {
    a: 'minecraft:iron_ingot',
    b: '#kubejs:red_matter',
	c: 'ae2:formation_core',
	d: 'ae2:annihilation_core',
	e: 'kubejs:prisma_dust'
  }
)

event.shapeless(Item.of('appliede:emc_interface'), ['appliede:cable_emc_interface'])
event.shapeless(Item.of('appliede:cable_emc_interface'), ['appliede:emc_interface'])

// Rune of Asgard uses prismatter
event.replaceInput(
  { output: 'mythicbotany:asgard_rune' },
  'minecraft:netherite_ingot',
  '#kubejs:prismatter'
)

// Dragon head
event.shaped(
  Item.of('minecraft:dragon_head'),
  [
    'aba',
    'bcb',
    'aba'
  ],
  {
    a: 'kubejs:prisma_dust',
    b: 'minecraft:wither_skeleton_skull',
	c: 'minecraft:dragon_egg'
  }
)

// Ancient dust duping with prisma dust
event.recipes.thermal.smelter('8x thermal_extra:ancient_dust', ['thermal_extra:ancient_dust', 'kubejs:prisma_dust']).energy(10000)

// Thermal Extra alloys
event.recipes.thermal.smelter('4x thermal_extra:soul_infused_ingot', ['3x #forge:ingots/signalum', 'enderio:soularium_ingot', 'thermal_extra:soul_sand_dust']).energy(8000)
event.recipes.thermal.smelter('4x thermal_extra:twinite_ingot', ['3x #forge:ingots/lumium', '#forge:ingots/elementium', '4x minecraft:blaze_rod']).energy(12000)
event.recipes.thermal.smelter('4x thermal_extra:shellite_ingot', ['3x #forge:ingots/enderium', '#kubejs:dark_matter', '4x minecraft:shulker_shell']).energy(16000)

event.recipes.thermal.smelter('4x thermal_extra:dragonsteel_ingot', ['3x #forge:ingots/invar', 'draconicevolution:draconium_dust', 'thermal_extra:ancient_dust']).energy(20000)
event.recipes.thermal.smelter('4x thermal_extra:abyssal_ingot', ['3x #forge:ingots/dragonsteel', '#kubejs:prismatter', 'minecraft:echo_shard']).energy(40000)

// Radiance Dust
metallurgic_infusing('mekanism_extras:dust_radiance', 'kubejs:prisma_dust', 'mekanism:refined_obsidian', 20)

// Aetherium Shard
event.recipes.thermal.chiller('aetherworks:aether_shard', [Fluid.of('kubejs:prisma', 10)])

})