// Kubejs scripts for items that don't quite fit anywhere else
	
ServerEvents.recipes(event => {

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

event.remove({output: '#forge:gears', not: [{type: 'thermal:press'}, {type: 'immersiveengineering:metal_press'}, {type: 'embers:stamping'}]})
event.remove({output: 'hammerlib:gears/iron'})
event.remove({output: 'hammerlib:gears/gold'})

// No handcrafting alloys
event.remove({ output: '#forge:ingots', input: 'minecraft:fire_charge'})
event.remove({ output: '#forge:dusts', input: 'thermal:earth_charge'})
event.remove({ output: '#forge:dusts', input: '#forge:dusts'})

// EnderIO gears
event.recipes.thermal.press('enderio:stone_gear', ['4x minecraft:cobblestone', 'thermal:press_gear_die'])
event.recipes.thermal.smelter('enderio:iron_gear', ['thermal:iron_gear', '4x #kubejs:infinity_grains']).energy(3200)
event.recipes.thermal.smelter('enderio:energized_gear', ['enderio:iron_gear', '4x #forge:ingots/energetic_alloy']).energy(4800)
event.recipes.thermal.smelter('enderio:dark_bimetal_gear', ['enderio:iron_gear', '4x #forge:ingots/dark_steel']).energy(4800)
event.recipes.thermal.smelter('enderio:vibrant_gear', ['enderio:energized_gear', '4x enderio:vibrant_alloy_ingot']).energy(5400)

// Comp iron gear
event.recipes.thermal.press('pneumaticcraft:compressed_iron_gear', ['4x #forge:ingots/compressed_iron', 'thermal:press_gear_die'])

// Remove non angelic rings
event.remove({mod: 'angelring', not: [{output: 'angelring:angel_ring'}]})

// Angel Ring
event.replaceInput(
  { output: 'angelring:angel_ring' },
  'angelring:diamond_ring',
  'malum:ring_of_manaweaving'
)

event.replaceInput(
  { output: 'angelring:angel_ring' },
  'minecraft:blaze_rod',
  '#kubejs:prismatter'
)

// Swiftwolf move
event.remove({output: 'projecte:swiftwolf_rending_gale'})

event.shapeless(
  Item.of('projecte:swiftwolf_rending_gale'),
  [
    'angelring:angel_ring',
	'#kubejs:red_matter'
  ]
)

// Well, well, well..
event.remove({output: 'well:well'})

event.recipes.extendedcrafting.shaped_table("well:well", 
	['aaaaa', 
	 'bdedb', 
	 'befeb',
	 'cdedc',
	 'ccgcc'
	 ], 
	{
		a: 'minecraft:bricks',
		b: 'minecraft:oak_planks',
		c: 'minecraft:stone_bricks',
		d: 'mekanism:ultimate_fluid_tank',
		e: 'thermal:upgrade_augment_3',
		f: 'thermal:device_water_gen',
		g: '#kubejs:prismatter'
	}
).tier(2);

// TIAB
event.remove({output: 'tiab:time_in_a_bottle'})

event.shaped(
  Item.of('tiab:time_in_a_bottle'),
  [
    'bih',
    'cAg',
    'def'
  ],
  {
    A: 'minecraft:glass_bottle',
    b: 'pneumaticcraft:speed_upgrade',
	c: 'thermal:machine_speed_augment',
	d: 'bloodmagic:speedrune',
	e: 'ae2:speed_card',
	f: 'enderio:extraction_speed_upgrade_4',
	g: 'mekanism:upgrade_speed',
	h: 'create:rotation_speed_controller',
	i: '#kubejs:prismatter'
  }
)

// Fuel Reprocessor collector doesn't use netherite
event.replaceInput(
  { output: 'bigreactors:reprocessorcollector' },
  'minecraft:netherite_ingot',
  'minecraft:netherite_scrap'
)

event.replaceInput(
  { output: 'bigreactors:fluidizerfluidinjector' },
  'minecraft:netherite_ingot',
  'minecraft:netherite_scrap'
)

// Echo shard from sculk catalyst
metallurgic_infusing('minecraft:echo_shard', 'minecraft:sculk_catalyst', 'mekanism_extras:radiance', 80)

// DM armor changes
event.remove({output: 'projecte:dm_helmet'})
event.remove({output: 'projecte:dm_chestplate'})
event.remove({output: 'projecte:dm_leggings'})
event.remove({output: 'projecte:dm_boots'})

event.shaped(
  Item.of('projecte:dm_helmet'),
  [
    'aaa',
    'aba',
    '   '
  ],
  {
    a: 'projecte:dark_matter',
    b: 'malum:soul_hunter_cloak'
  }
)

event.shaped(
  Item.of('projecte:dm_chestplate'),
  [
    'aba',
    'aaa',
    'aaa'
  ],
  {
    a: 'projecte:dark_matter',
    b: 'malum:soul_hunter_robe'
  }
)

event.shaped(
  Item.of('projecte:dm_leggings'),
  [
    'aaa',
    'aba',
    'a a'
  ],
  {
    a: 'projecte:dark_matter',
    b: 'malum:soul_hunter_leggings'
  }
)

event.shaped(
  Item.of('projecte:dm_boots'),
  [
    '   ',
    'aba',
    'a a'
  ],
  {
    a: 'projecte:dark_matter',
    b: 'malum:soul_hunter_boots'
  }
)

// Remove red matter
event.remove({output: 'projecte:rm_helmet'})
event.remove({output: 'projecte:rm_chestplate'})
event.remove({output: 'projecte:rm_leggings'})
event.remove({output: 'projecte:rm_boots'})

// Red Matter Armor
event.custom({
  "type": "extendedcrafting:shaped_table",
  "pattern": [
    "AAAAA",
    "ABCDA",
    "AEFEA",
    "AG GA",
    "AA AA"
  ],
  "key": {
    "A": {
      "tag": "kubejs:red_matter"
    },
    "B": {
      "type": "forge:nbt",
      "item": "pneumaticcraft:compressed_iron_helmet",
      "count": 1,
      "nbt": "{Damage:0}"
    },
    "C": {
      "type": "forge:nbt",
      "item": "thermal_extra:enderium_helmet",
      "count": 1,
      "nbt": "{Damage:0}"
    },
    "D": {
      "type": "forge:nbt",
      "item": "malum:soul_stained_steel_helmet",
      "count": 1,
      "nbt": "{Damage:0}"
    },
    "E": {
      "tag": "kubejs:prismatter"
    },
    "F": {
      "item": "projecte:dm_helmet"
    },
    "G": {
      "item": "aetherworks:gem_aether"
    }
  },
  "result": {
    "item": "projecte:rm_helmet"
  }
})

event.custom({
  "type": "extendedcrafting:shaped_table",
  "pattern": [
    "AA AA",
    "ABCDA",
    "AEFEA",
    "AGGGA",
    "AAAAA"
  ],
  "key": {
    "A": {
      "tag": "kubejs:red_matter"
    },
    "B": {
      "type": "forge:nbt",
      "item": "pneumaticcraft:compressed_iron_chestplate",
      "count": 1,
      "nbt": "{Damage:0}"
    },
    "C": {
      "type": "forge:nbt",
      "item": "thermal_extra:enderium_chestplate",
      "count": 1,
      "nbt": "{Damage:0}"
    },
    "D": {
      "type": "forge:nbt",
      "item": "malum:soul_stained_steel_chestplate",
      "count": 1,
      "nbt": "{Damage:0}"
    },
    "E": {
      "tag": "kubejs:prismatter"
    },
    "F": {
      "item": "projecte:dm_chestplate"
    },
    "G": {
      "item": "aetherworks:gem_aether"
    }
  },
  "result": {
    "item": "projecte:rm_chestplate"
  }
})

event.custom({
  "type": "extendedcrafting:shaped_table",
  "pattern": [
    "AAAAA",
    "ABCDA",
    "AEFEA",
    "AG GA",
    "AA AA"
  ],
  "key": {
    "A": {
      "tag": "kubejs:red_matter"
    },
    "B": {
      "type": "forge:nbt",
      "item": "pneumaticcraft:compressed_iron_leggings",
      "count": 1,
      "nbt": "{Damage:0}"
    },
    "C": {
      "type": "forge:nbt",
      "item": "thermal_extra:enderium_leggings",
      "count": 1,
      "nbt": "{Damage:0}"
    },
    "D": {
      "type": "forge:nbt",
      "item": "malum:soul_stained_steel_leggings",
      "count": 1,
      "nbt": "{Damage:0}"
    },
    "E": {
      "tag": "kubejs:prismatter"
    },
    "F": {
      "item": "projecte:dm_leggings"
    },
    "G": {
      "item": "aetherworks:gem_aether"
    }
  },
  "result": {
    "item": "projecte:rm_leggings"
  }
})

event.custom({
  "type": "extendedcrafting:shaped_table",
  "pattern": [
    "AA AA",
    "ABCDA",
    "AEFEA",
    "AG GA",
    "AA AA"
  ],
  "key": {
    "A": {
      "tag": "kubejs:red_matter"
    },
    "B": {
      "type": "forge:nbt",
      "item": "pneumaticcraft:compressed_iron_boots",
      "count": 1,
      "nbt": "{Damage:0}"
    },
    "C": {
      "type": "forge:nbt",
      "item": "thermal_extra:enderium_boots",
      "count": 1,
      "nbt": "{Damage:0}"
    },
    "D": {
      "type": "forge:nbt",
      "item": "malum:soul_stained_steel_boots",
      "count": 1,
      "nbt": "{Damage:0}"
    },
    "E": {
      "tag": "kubejs:prismatter"
    },
    "F": {
      "item": "projecte:dm_boots"
    },
    "G": {
      "item": "aetherworks:gem_aether"
    }
  },
  "result": {
    "item": "projecte:rm_boots"
  }
})

// Fool's Gold compressing
// Black iron compressing
event.shapeless(
  Item.of('kubejs:fool_gold_ingot'),
  [
    'kubejs:fool_gold_nugget',
    'kubejs:fool_gold_nugget',
    'kubejs:fool_gold_nugget',
	'kubejs:fool_gold_nugget',
	'kubejs:fool_gold_nugget',
	'kubejs:fool_gold_nugget',
	'kubejs:fool_gold_nugget',
	'kubejs:fool_gold_nugget',
	'kubejs:fool_gold_nugget'
  ]
)

event.shapeless(
  Item.of('9x kubejs:fool_gold_nugget'),
  [
    'kubejs:fool_gold_ingot'
  ]
)

// Earlier Alchemical Bags
event.replaceInput(
  { output: '#projecte:alchemical_bags' },
  'projecte:high_covalence_dust',
  'projecte:medium_covalence_dust'
)

event.replaceInput(
  { output: '#projecte:alchemical_bags' },
  'projecte:alchemical_chest',
  'minecraft:ender_chest'
)

// Obsinite
event.recipes.create.mixing(['kubejs:obsinite_alloy'], ['minecraft:obsidian', 'minecraft:gold_ingot', 'minecraft:iron_ingot', Fluid.of(('minecraft:lava'), 1000)]).heated()

event.shaped(
  Item.of('kubejs:obsinite_pickaxe'),
  [
    'aaa',
    ' b ',
    ' b '
  ],
  {
    a: 'kubejs:obsinite_alloy',
    b: 'minecraft:stick'
  }
)

// Alch catalyst swap between pris crystals <=> ghast tears
event.recipes.botania.mana_infusion("minecraft:ghast_tear", "minecraft:prismarine_crystals", 8000, 'botania:alchemy_catalyst')
event.recipes.botania.mana_infusion("minecraft:prismarine_crystals", "minecraft:ghast_tear", 8000, 'botania:alchemy_catalyst')

// Disable horse armor crunching
event.remove({input: 'minecraft:iron_horse_armor'})
event.remove({input: 'minecraft:golden_horse_armor'})
event.remove({input: 'minecraft:diamond_horse_armor'})

})