// kub for mek

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":{
				"tag" : input
			}
		},
		"output":{
			"item": output
		}
	})
}

event.replaceInput(
  { output: 'mekanism:metallurgic_infuser' },
  'minecraft:iron_ingot',
  '#forge:ingots/steel'
)
	
// No Tier Installer Skipping >:(
event.remove({ output: 'mekanism:basic_smelting_factory'})
event.remove({ output: 'mekanism:basic_enriching_factory'})
event.remove({ output: 'mekanism:basic_crushing_factory'})
event.remove({ output: 'mekanism:basic_compressing_factory'})
event.remove({ output: 'mekanism:basic_combining_factory'})
event.remove({ output: 'mekanism:basic_purifying_factory'})
event.remove({ output: 'mekanism:basic_injecting_factory'})
event.remove({ output: 'mekanism:basic_infusing_factory'})
event.remove({ output: 'mekanism:basic_sawing_factory'})

event.remove({ output: 'mekanism:advanced_smelting_factory'})
event.remove({ output: 'mekanism:advanced_enriching_factory'})
event.remove({ output: 'mekanism:advanced_crushing_factory'})
event.remove({ output: 'mekanism:advanced_compressing_factory'})
event.remove({ output: 'mekanism:advanced_combining_factory'})
event.remove({ output: 'mekanism:advanced_purifying_factory'})
event.remove({ output: 'mekanism:advanced_injecting_factory'})
event.remove({ output: 'mekanism:advanced_infusing_factory'})
event.remove({ output: 'mekanism:advanced_sawing_factory'})

event.remove({ output: 'mekanism:elite_smelting_factory'})
event.remove({ output: 'mekanism:elite_enriching_factory'})
event.remove({ output: 'mekanism:elite_crushing_factory'})
event.remove({ output: 'mekanism:elite_compressing_factory'})
event.remove({ output: 'mekanism:elite_combining_factory'})
event.remove({ output: 'mekanism:elite_purifying_factory'})
event.remove({ output: 'mekanism:elite_injecting_factory'})
event.remove({ output: 'mekanism:elite_infusing_factory'})
event.remove({ output: 'mekanism:elite_sawing_factory'})

event.remove({ output: 'mekanism:ultimate_smelting_factory'})
event.remove({ output: 'mekanism:ultimate_enriching_factory'})
event.remove({ output: 'mekanism:ultimate_crushing_factory'})
event.remove({ output: 'mekanism:ultimate_compressing_factory'})
event.remove({ output: 'mekanism:ultimate_combining_factory'})
event.remove({ output: 'mekanism:ultimate_purifying_factory'})
event.remove({ output: 'mekanism:ultimate_injecting_factory'})
event.remove({ output: 'mekanism:ultimate_infusing_factory'})
event.remove({ output: 'mekanism:ultimate_sawing_factory'})

event.remove({ output: 'mekanism_extras:absolute_smelting_factory'})
event.remove({ output: 'mekanism_extras:absolute_enriching_factory'})
event.remove({ output: 'mekanism_extras:absolute_crushing_factory'})
event.remove({ output: 'mekanism_extras:absolute_compressing_factory'})
event.remove({ output: 'mekanism_extras:absolute_combining_factory'})
event.remove({ output: 'mekanism_extras:absolute_purifying_factory'})
event.remove({ output: 'mekanism_extras:absolute_injecting_factory'})
event.remove({ output: 'mekanism_extras:absolute_infusing_factory'})
event.remove({ output: 'mekanism_extras:absolute_sawing_factory'})

event.remove({ output: 'mekanism_extras:supreme_smelting_factory'})
event.remove({ output: 'mekanism_extras:supreme_enriching_factory'})
event.remove({ output: 'mekanism_extras:supreme_crushing_factory'})
event.remove({ output: 'mekanism_extras:supreme_compressing_factory'})
event.remove({ output: 'mekanism_extras:supreme_combining_factory'})
event.remove({ output: 'mekanism_extras:supreme_purifying_factory'})
event.remove({ output: 'mekanism_extras:supreme_injecting_factory'})
event.remove({ output: 'mekanism_extras:supreme_infusing_factory'})
event.remove({ output: 'mekanism_extras:supreme_sawing_factory'})

event.remove({ output: 'mekanism_extras:cosmic_smelting_factory'})
event.remove({ output: 'mekanism_extras:cosmic_enriching_factory'})
event.remove({ output: 'mekanism_extras:cosmic_crushing_factory'})
event.remove({ output: 'mekanism_extras:cosmic_compressing_factory'})
event.remove({ output: 'mekanism_extras:cosmic_combining_factory'})
event.remove({ output: 'mekanism_extras:cosmic_purifying_factory'})
event.remove({ output: 'mekanism_extras:cosmic_injecting_factory'})
event.remove({ output: 'mekanism_extras:cosmic_infusing_factory'})
event.remove({ output: 'mekanism_extras:cosmic_sawing_factory'})

event.remove({ output: 'mekanism_extras:infinite_smelting_factory'})
event.remove({ output: 'mekanism_extras:infinite_enriching_factory'})
event.remove({ output: 'mekanism_extras:infinite_crushing_factory'})
event.remove({ output: 'mekanism_extras:infinite_compressing_factory'})
event.remove({ output: 'mekanism_extras:infinite_combining_factory'})
event.remove({ output: 'mekanism_extras:infinite_purifying_factory'})
event.remove({ output: 'mekanism_extras:infinite_injecting_factory'})
event.remove({ output: 'mekanism_extras:infinite_infusing_factory'})
event.remove({ output: 'mekanism_extras:infinite_sawing_factory'})

// Extras installers tweaks
event.replaceInput(
  { output: 'mekanism_extras:absolute_tier_installer' },
  '#minecraft:planks',
  '#kubejs:prismatter'
)

event.replaceInput(
  { output: 'mekanism_extras:supreme_tier_installer' },
  '#minecraft:planks',
  '#kubejs:prismatter'
)

event.replaceInput(
  { output: 'mekanism_extras:supreme_tier_installer' },
  'minecraft:netherite_ingot',
  'minecraft:netherite_scrap'
)

event.replaceInput(
  { output: 'mekanism_extras:cosmic_tier_installer' },
  '#minecraft:planks',
  'kubejs:prismsplinter'
)

event.replaceInput(
  { output: 'mekanism_extras:infinite_tier_installer' },
  '#minecraft:planks',
  'kubejs:prismsplinter'
)

// Coal coke crushing
event.recipes.mekanism.crushing('immersiveengineering:dust_coke', '#forge:coal_coke')

// Missing Enriched Obsidian recipe
metallurgic_infusing('mekanism:dust_refined_obsidian', 'forge:dusts/obsidian', 'mekanism:diamond', 40)

// MIR Reactor Parts
event.shaped(
  Item.of('mbd2:fissioninputbus'),
  [
    'CAC',
    'ABA',
    'CAC'
  ],
  {
    A: 'mekanismgenerators:fission_reactor_casing',
    B: 'minecraft:chest',
	C: 'mekanism:ultimate_control_circuit'
  }
)

event.shaped(
  Item.of('mbd2:fissionoutputbus'),
  [
    'CAC',
    'ABA',
    'CAC'
  ],
  {
    A: 'mekanismgenerators:fission_reactor_casing',
    B: 'minecraft:hopper',
	C: 'mekanism:ultimate_control_circuit'
  }
)

event.shaped(
  Item.of('mbd2:reactorinputhatch'),
  [
    'CAC',
    'ABA',
    'CAC'
  ],
  {
    A: 'mekanismgenerators:fission_reactor_casing',
    B: 'minecraft:bucket',
	C: 'mekanism:ultimate_control_circuit'
  }
)

event.shaped(
  Item.of('mbd2:reactoroutputhatch'),
  [
    'CAC',
    'ABA',
    'CAC'
  ],
  {
    A: 'mekanismgenerators:fission_reactor_casing',
    B: 'mekanism:ultimate_fluid_tank',
	C: 'mekanism:ultimate_control_circuit'
  }
)

event.shaped(
  Item.of('mbd2:antimatter_reactor'),
  [
    'CAC',
    'ABA',
    'CAC'
  ],
  {
    A: 'mekanismgenerators:fission_reactor_casing',
    B: 'mekanism:pellet_antimatter',
	C: '#kubejs:prismatter'
  }
)

// Missing plutonium pellet recipe

event.custom({
    "type":"mekanism:reaction",
	"duration":200,
	"energyRequired":800,
	"fluidInput":{
		"amount":1000,
		"fluid":"minecraft:water"
	},
	"gasInput":{
		"amount":1000,
		"gas":"mekanism:plutonium"
	},
	"gasOutput":{
		"amount":1000,
		"gas":"mekanism:spent_nuclear_waste"
	},
	"itemInput":{
		"ingredient":{
			"item":"mekanism:dust_fluorite"
		}
	},
	"itemOutput":{
		"item":"mekanism:pellet_plutonium"
	}
})

// Plutonium Sponge
event.custom({
    "type":"mekanism:reaction",
	"duration":200,
	"energyRequired":1000,
	"fluidInput":{
		"amount":100,
		"fluid":"kubejs:prisma"
	},
	"gasInput":{
		"amount":200,
		"gas":"mekanism_extras:rich_uranium_fuel"
	},
	"itemInput":{
		"ingredient":{
			"item":"mekanism:pellet_plutonium"
		}
	},
	"itemOutput":{
		"item":"kubejs:plutonium_sponge"
	}
})

// SPS casing change
event.remove({output: 'mekanism:sps_casing'})

event.shaped(
  Item.of('4x mekanism:sps_casing'),
  [
    'ABA',
    'BCB',
    'ABA'
  ],
  {
    A: 'mekanism:hdpe_sheet',
    B: 'mekanism:pellet_polonium',
	C: 'mekanism:pellet_plutonium'
  }
)

// Membrane Upgrade uses thermo instead of shining
event.replaceInput(
  { output: 'mekanism_extras:upgrade_ionic_membrane' },
  'mekanism_extras:alloy_shining',
  'mekanism_extras:alloy_thermonuclear'
)

})