// priority: 0

settings.logAddedRecipes = true
settings.logRemovedRecipes = true
settings.logSkippedRecipes = false
settings.logErroringRecipes = true

console.info('Server scripts reloaded!')

onEvent('recipes', event => {

  // General/misc recipe fixes
	
	event.remove({output: '#forge:rods/iron'})
	event.shaped(Item.of('buildersaddition:iron_rod', 2), [
		'I',
		'I'
	], {
		I: 'minecraft:iron_ingot'
	})
	event.remove({output: 'immersiveengineering:stick_steel'})
	event.shapeless('mapperbase:steel_rod', ['immersiveengineering:hammer', '#forge:ingots/steel'])
	event.remove({output: 'immersiveengineering:plate_steel'})
	event.shapeless('mapperbase:steel_plate', ['immersiveengineering:hammer', '#forge:ingots/steel'])
	event.remove({output: 'quark:iron_ladder'})
	event.remove({output: 'immersiveengineering:metal_ladder_none'})
	event.remove({output: 'mcwbridges:iron_platform'})
	event.shaped(Item.of('mcwbridges:iron_platform', 3), [
		'SSS'
	], {
		S: 'create:iron_sheet'
	})
	event.remove({output: 'mapperbase:iron_plate'})
	event.remove({output: 'immersiveengineering:plate_iron'})
	event.remove({output: 'mapperbase:flatter_hammer'})
	event.shapeless('create:iron_sheet', ['immersiveengineering:hammer', 'minecraft:iron_ingot'])
	event.remove({output: 'mcwbridges:iron_rod'})
	event.remove({output: 'mcwbridges:iron_armrest'})
	event.shaped('mcwbridges:iron_armrest', [
		'NRN'
	], {
		N: 'minecraft:iron_nugget',
		R: '#forge:rods/iron'
	})
	event.remove({output: 'platforms:wrench'})
	event.shaped('platforms:wrench', [
		' II',
		' B ',
		'BR '
	], {
		I: 'minecraft:iron_ingot',
		B: '#forge:rods/all_metal',
		R: '#forge:dyes/red'
	})
	event.shaped(Item.of('blockcarpentry:frameblock', 4), [
		'WWW',
		'S S',
		'WWW'
	], {
		W: '#minecraft:wooden_slabs',
		S: 'minecraft:stick'
	})
	event.shapeless(Item.of('minecraft:diorite', 2), ['minecraft:cobblestone', '#forge:stone'])
	event.shapeless('mana-and-artifice:guide_book', ['minecraft:book', 'mana-and-artifice:vinteum_dust'])
	event.shapeless('minecraft:crafting_table', ['#forge:crumbs_crafting_benches'])
	event.remove({output: 'astralsorcery:wand'})
	event.shaped('astralsorcery:wand', [
		' AD',
		' MA',
		'M  '
	], {
		A: 'astralsorcery:aquamarine',
		D: 'minecraft:diamond',
		M: 'astralsorcery:marble_raw'
	})
	event.shapeless(Item.of('minecraft:flint', 2), ['minecraft:gravel', 'minecraft:gravel', 'minecraft:gravel'])
	event.shapeless('immersiveengineering:steel_fence', ['mapperbase:steel_fence'])
	event.shapeless('minecraft:chest', ['#forge:chests/wooden'])


  // Ingot Stuff

	event.remove({output: 'mapperbase:steel_ingot'})
	event.remove({output: 'immersiveengineering:ingot_steel'})
	event.remove({output: 'create:copper_ingot'})
	event.remove({output: 'immersiveengineering:copper_ingot'})
	event.remove({output: 'immersiveengineering:ingot_lead'})
	event.remove({output: 'eidolon:lead_ingot'})
	event.remove({output: 'immersiveengineering:ingot_uranium'})
	event.remove({output: 'appliedenergistics2:iron_dust'})

  // AE2 recipes
  
	event.shaped('appliedenergistics2:calculation_processor_press', [
		'III',
		'ICI',
		'III'
	], {
		I: 'minecraft:iron_ingot',
		C: 'appliedenergistics2:purified_certus_quartz_crystal'
	})
	event.shaped('appliedenergistics2:engineering_processor_press', [
		'III',
		'IDI',
		'III'
	], {
		I: 'minecraft:iron_ingot',
		D: 'minecraft:diamond'
	})
	event.shaped('appliedenergistics2:logic_processor_press', [
		'III',
		'IGI',
		'III'
	], {
		I: 'minecraft:iron_ingot',
		G: 'minecraft:gold_ingot'
	})
	event.shaped('appliedenergistics2:silicon_press', [
		'III',
		'ISI',
		'III'
	], {
		I: 'minecraft:iron_ingot',
		S: 'appliedenergistics2:silicon'
	})
	event.shaped(Item.of('appliedenergistics2:sky_stone_block', 8), [
		'BCB',
		'COC',
		'BCB'
	], {
		B: 'minecraft:coal_block',
		C: 'appliedenergistics2:purified_certus_quartz_crystal',
		O: 'minecraft:obsidian'
	})

  // IE recipes
	
	event.recipes.immersiveengineering.crusher('appliedenergistics2:sky_dust', 'appliedenergistics2:sky_stone_block')
	event.recipes.immersiveengineering.crusher('appliedenergistics2:sky_dust', 'appliedenergistics2:smooth_sky_stone_block')
	event.recipes.immersiveengineering.arc_furnace(['appliedenergistics2:smooth_sky_stone_block'], 'appliedenergistics2:sky_stone_block')
	event.recipes.immersiveengineering.arc_furnace(['appliedenergistics2:sky_stone_block'], 'appliedenergistics2:sky_dust')

	event.shaped(Item.of('immersiveengineering:blueprint').nbt({blueprint: "electrode"}), [
		' H ',
		'LLL',
		'PPP'
	], {
		H: 'immersiveengineering:ingot_hop_graphite',
		L: 'minecraft:lapis_lazuli',
		P: 'minecraft:paper'
	})

	event.recipes.immersiveengineering.crusher('appliedenergistics2:ender_dust', 'minecraft:ender_pearl')
	event.recipes.immersiveengineering.crusher('appliedenergistics2:fluix_dust', 'appliedenergistics2:fluix_crystal')
	event.recipes.immersiveengineering.crusher('appliedenergistics2:certus_quartz_dust', '#forge:gems/certus_quartz')
	event.recipes.immersiveengineering.crusher('mekanism:dust_lapis_lazuli', 'minecraft:lapis_lazuli')
	event.recipes.immersiveengineering.crusher('mekanism:dust_charcoal', 'minecraft:charcoal')
	event.recipes.immersiveengineering.crusher('appliedenergistics2:nether_quartz_dust', 'minecraft:quartz')
	event.recipes.immersiveengineering.crusher('mekanism:dust_emerald', 'minecraft:emerald')
	event.recipes.immersiveengineering.crusher('mekanism:dust_diamond', 'minecraft:diamond')
	event.recipes.immersiveengineering.crusher('mekanism:dust_netherite', 'minecraft:netherite_ingot')
	event.recipes.immersiveengineering.crusher(Item.of('mekanism:dust_obsidian', 4), 'minecraft:obsidian')
	event.recipes.immersiveengineering.arc_furnace('mana-and-artifice:vinteum_dust', 'mana-and-artifice:vinteum_ore')
	event.recipes.immersiveengineering.crusher(Item.of('mana-and-artifice:vinteum_dust', 2), 'mana-and-artifice:vinteum_ore')
	event.recipes.immersiveengineering.crusher(Item.of('astralsorcery:rock_crystal', 4), 'astralsorcery:rock_crystal_ore')
	event.recipes.immersiveengineering.crusher(Item.of('appliedenergistics2:certus_quartz_crystal', 4), 'appliedenergistics2:quartz_ore')
	event.recipes.immersiveengineering.crusher(Item.of('appliedenergistics2:charged_certus_quartz_crystal', 4), 'appliedenergistics2:charged_quartz_ore')
	event.recipes.immersiveengineering.arc_furnace('astralsorcery:starmetal_ingot', 'astralsorcery:starmetal_ore')
	event.recipes.immersiveengineering.crusher(Item.of('astralsorcery:stardust', 2), 'astralsorcery:starmetal_ore')
	event.recipes.immersiveengineering.arc_furnace('astralsorcery:starmetal_ingot', 'astralsorcery:stardust')
	event.recipes.immersiveengineering.crusher('astralsorcery:stardust', 'astralsorcery:starmetal_ingot')
	event.recipes.immersiveengineering.arc_furnace('elementalcraft:inertcrystal', 'elementalcraft:crystalore')
	event.remove({id: 'immersiveengineering:crusher/ore_quartz'})
	event.recipes.immersiveengineering.crusher(Item.of('minecraft:quartz', 6), 'minecraft:nether_quartz_ore')
	event.recipes.immersiveengineering.arc_furnace('mana-and-artifice:vinteum_ingot', 'mana-and-artifice:vinteum_coated_iron')
	event.recipes.immersiveengineering.arc_furnace('mana-and-artifice:purified_vinteum_ingot', 'mana-and-artifice:purified_vinteum_coated_iron')
	event.recipes.immersiveengineering.crusher(Item.of('create:crushed_zinc_ore', 2), 'create:zinc_ore')
	event.recipes.immersiveengineering.arc_furnace('mekanism:ingot_lead', 'create:crushed_lead_ore')

  // Mekanism recipes

	event.recipes.mekanism.crushing('immersiveengineering:dust_coke', 'immersiveengineering:coal_coke')
	event.remove({output: 'mekanism:dust_quartz'})
	event.recipes.mekanism.crushing('appliedenergistics2:nether_quartz_dust', 'minecraft:quartz')
	event.recipes.mekanism.enriching(Item.of('mana-and-artifice:vinteum_dust', 2), 'mana-and-artifice:vinteum_ore')
	event.recipes.mekanism.enriching(Item.of('astralsorcery:rock_crystal', 4), 'astralsorcery:rock_crystal_ore')
	event.recipes.mekanism.smelting('astralsorcery:starmetal_ingot', 'astralsorcery:starmetal_ore')
	event.recipes.mekanism.enriching(Item.of('astralsorcery:stardust', 2), 'astralsorcery:starmetal_ore')
	event.recipes.mekanism.smelting('astralsorcery:starmetal_ingot', 'astralsorcery:stardust')
	event.recipes.mekanism.crushing('astralsorcery:stardust', 'astralsorcery:starmetal_ingot')
	event.recipes.mekanism.enriching(Item.of('create:crushed_zinc_ore', 2), 'create:zinc_ore')
	event.recipes.mekanism.enriching(Item.of('immersiveengineering:dust_aluminum', 2), 'immersiveengineering:ore_aluminum')
	event.recipes.mekanism.enriching(Item.of('immersiveengineering:dust_silver', 2), 'immersiveengineering:ore_silver')
	event.recipes.mekanism.enriching(Item.of('immersiveengineering:dust_nickel', 2), 'immersiveengineering:ore_nickel')

  // Create recipes
	
	event.recipes.create.pressing('mapperbase:steel_plate', '#forge:ingots/steel')
	event.recipes.create.crushing(Item.of('astralsorcery:rock_crystal', 4), 'astralsorcery:rock_crystal_ore')
	event.recipes.create.crushing(Item.of('astralsorcery:stardust', 2), 'astralsorcery:starmetal_ore')
	event.recipes.create.crushing(Item.of('mekanism:fluorite_gem', 6), 'mekanism:fluorite_ore')
	event.recipes.create.crushing(Item.of('mana-and-artifice:vinteum_dust', 2), 'mana-and-artifice:vinteum_ore')
	event.recipes.create.crushing('appliedenergistics2:fluix_dust', 'appliedenergistics2:fluix_crystal')
	event.remove({output: 'create:andesite_alloy'})
	event.shaped('create:andesite_alloy', [
		'IS',
		'SI'
	], {
		I: 'minecraft:iron_nugget',
		S: '#forge:stone'
	})
	event.shaped('create:andesite_alloy', [
		'ZS',
		'SZ'
	], {
		Z: 'create:zinc_nugget',
		S: '#forge:stone'
	})
	event.recipes.create.mixing('create:andesite_alloy', [
		'#forge:stone',
		'minecraft:iron_nugget'
	])
	event.recipes.create.mixing('create:andesite_alloy', [
		'#forge:stone',
		'create:zinc_nugget'
	])
})

onEvent('item.tags', event => {
  // Get the #forge:cobblestone tag collection and add Diamond Ore to it
  // event.get('forge:cobblestone').add('minecraft:diamond_ore')
  
  // Get the #forge:cobblestone tag collection and remove Mossy Cobblestone from it
  // event.get('forge:cobblestone').remove('minecraft:mossy_cobblestone')
  event.get('forge:crumbs_crafting_benches').add('crumbs:spruce_crafting_table')
  event.get('forge:crumbs_crafting_benches').add('crumbs:birch_crafting_table')
  event.get('forge:crumbs_crafting_benches').add('crumbs:jungle_crafting_table')
  event.get('forge:crumbs_crafting_benches').add('crumbs:acacia_crafting_table')
  event.get('forge:crumbs_crafting_benches').add('crumbs:dark_oak_crafting_table')
  event.get('forge:crumbs_crafting_benches').add('crumbs:crimson_crafting_table')
  event.get('forge:crumbs_crafting_benches').add('crumbs:warped_crafting_table')
})