// Kubejs scripts for recipes pertaining to normally unobtainable items

ServerEvents.recipes(event => {

// Remove unwanted diamond compressing recipe from pneu
event.remove({ output: 'minecraft:diamond', type:'pneumaticcraft:pressure_chamber'})

event.shaped(
  Item.of('minecraft:iron_ingot'),
  [
    ' A ',
    ' B ',
    ' C '
  ],
  {
    A: '#forge:storage_blocks/charcoal',
    B: 'projecte:low_covalence_dust',
    C: 'minecraft:lava_bucket'
  }
).replaceIngredient('minecraft:lava_bucket', 'minecraft:bucket')

// Copper and Zinc nuggets from create
event.remove({ output: 'minecraft:sand', type: 'create:milling' })
event.remove({ output: 'minecraft:red_sand', type: 'create:milling' })

event.recipes.create.milling([Item.of('minecraft:red_sand').withChance(1)], 'minecraft:granite')
event.recipes.create.milling([Item.of('minecraft:red_sand').withChance(0.5), Item.of('thermal:copper_nugget').withChance(0.05)], 'minecraft:red_sandstone')
event.recipes.create.milling([Item.of('minecraft:sand').withChance(0.5), Item.of('create:zinc_nugget').withChance(0.05)], 'minecraft:sandstone')

// Charcoal dust to lead
event.remove({ output: 'minecraft:black_dye', type: 'create:milling' })

event.recipes.create.milling(['minecraft:black_dye', Item.of('mekanism:dust_charcoal').withChance(0.75)], 'minecraft:charcoal')
event.recipes.immersiveengineering.alloy('thermal:lead_ingot', 'create:zinc_ingot', '4x mekanism:dust_charcoal', 200)

// Path to redstone using embers
event.custom({
  "type": "embers:melting",
  "conditions": [
    {
      "type": "forge:not",
      "value": {
        "type": "forge:tag_empty",
        "item": "embers:ember_grit"
      }
    }
  ],
  "input": {
    "item": "embers:ember_grit"
  },
  "output": {
    "amount": 90,
    "fluid": "kubejs:molten_ember"
  }
})

event.custom({
  "type": "embers:mixing",
  "conditions": [
    {
      "type": "forge:not",
      "value": {
        "type": "forge:tag_empty",
        "item": "minecraft:redstone"
      }
    }
  ],
  "inputs": [
    {
      "amount": 3,
      "tag": "forge:molten_iron"
    },
    {
      "amount": 1,
      "fluid": "kubejs:molten_ember"
    }
  ],
  "output": {
    "amount": 1,
    "fluid": "thermal:redstone"
  }
})

event.custom({
  "type": "embers:stamping",
  "conditions": [
    {
      "type": "forge:not",
      "value": {
        "type": "forge:tag_empty",
        "item": "minecraft:redstone"
      }
    }
  ],
  "fluid": {
    "amount": 90,
    "fluid": "thermal:redstone"
  },
  "output": {
    "item": "minecraft:redstone"
  },
  "stamp": {
    "item": "embers:nugget_stamp"
  }
})

// Alright lets get some gold finally
event.recipes.create.mixing(['minecraft:gold_ingot'], ['4x projecte:medium_covalence_dust', 'create:brass_ingot', Fluid.of(('kubejs:molten_ember'), 1000)]).heated()

// Nickel too
event.recipes.create.mixing(['thermal:nickel_ingot'], ['4x projecte:medium_covalence_dust', '#forge:ingots/tin', Fluid.of(('createdieselgenerators:biodiesel'), 1000)]).heated()

// Tin from pure daisy recipe
event.recipes.botania.pure_daisy("thermal:tin_block", "minecraft:copper_block")

// Soulstone from magic charcoal
event.recipes.botania.mana_infusion("malum:processed_soulstone", "malum:arcane_charcoal", 8000)

// Lapis from blue glass
event.recipes.botania.mana_infusion("minecraft:lapis_lazuli", "minecraft:blue_stained_glass", 20000)

// Silver from tartaric will infusion
event.custom({
  "type": "bloodmagic:soulforge",
  "drain": 64.0,
  "input0": {
    "item": "minecraft:gold_ingot"
  },
  "input1": {
    "item": "projecte:medium_covalence_dust"
  },
  "input2": {
    "tag": "forge:ingots/tin"
  },
  "input3": {
    "item": "bloodmagic:reinforcedslate"
  },
  "minimumDrain": 64.0,
  "output": {
  "item": "thermal:silver_ingot"
  }
})

// Coal from compressing charcoal
event.custom({
  "type": "pneumaticcraft:pressure_chamber",
  "inputs": [
    {
      "type": "pneumaticcraft:stacked_item",
      "count": 64,
      "item": "minecraft:charcoal"
    }
  ],
  "pressure": 3.0,
  "results": [
    {
      "item": "minecraft:coal"
    }
  ]
})

// Certus quartz using ars nouveau imbuement
event.recipes.ars_nouveau.imbuement(
        'minecraft:quartz', // input item
        'ae2:certus_quartz_crystal', // output
        1000, // source cost
        ['botania:mana_powder', 'bloodmagic:reinforcedslate', 'embers:dawnstone_aspectus', 'malum:arcane_spirit']
)

// Wouldn't it be funny
event.recipes.immersiveengineering.coke_oven('immersiveengineering:ingot_aluminum', '#forge:ingots/tin', 250, 300)

// Emeralds from AE2 charger
event.custom({
  "type": "ae2:charger",
  "ingredient": {
    "item": "enderio:vibrant_alloy_block"
  },
  "result": {
    "item": "minecraft:emerald"
  }
})

// Time for Oz
event.custom({
  "type": "enderio:alloy_smelting",
  "energy": 50000,
  "experience": 0.3,
  "inputs": [
    {
      "count": 4,
      "ingredient": {
        "item": "thermal:lumium_ingot"
      }
    },
    {
      "count": 4,
      "ingredient": {
        "item": "enderio:soularium_ingot"
      }
    },
    {
      "count": 1,
      "ingredient": {
        "item": "minecraft:coal_block"
      }
    }
  ],
  "result": {
    "item": "thermal_extra:osmium_ore_chunk"
  }
})

// Mushrooms
event.recipes.botania.mana_infusion("minecraft:brown_mushroom", "minecraft:melon_slice", 8000, 'botania:alchemy_catalyst')
event.recipes.botania.mana_infusion("minecraft:red_mushroom", "minecraft:brown_mushroom", 8000, 'botania:alchemy_catalyst')
event.recipes.botania.mana_infusion("minecraft:melon_slice", "minecraft:red_mushroom", 8000, 'botania:alchemy_catalyst')

// Raw Meats
event.recipes.botania.mana_infusion("minecraft:rabbit", "minecraft:beef", 8000, 'botania:alchemy_catalyst')
event.recipes.botania.mana_infusion("minecraft:chicken", "minecraft:rabbit", 8000, 'botania:alchemy_catalyst')
event.recipes.botania.mana_infusion("minecraft:mutton", "minecraft:chicken", 8000, 'botania:alchemy_catalyst')
event.recipes.botania.mana_infusion("minecraft:porkchop", "minecraft:mutton", 8000, 'botania:alchemy_catalyst')
event.recipes.botania.mana_infusion("minecraft:beef", "minecraft:porkchop", 8000, 'botania:alchemy_catalyst')

// Kelp
event.recipes.botania.mana_infusion("minecraft:kelp", "minecraft:oak_leaves", 8000, 'botania:alchemy_catalyst')

// Hefty Arc furnace into uranium
event.recipes.immersiveengineering.arc_furnace('mekanism:ingot_uranium', '16x immersiveengineering:ingot_hop_graphite', ['64x mekanism:ingot_refined_glowstone', '64x enderio:vibrant_alloy_ingot'], 'enderio:powdered_ender_pearl', 1200, 9600000)

// Cthonic Gold for malum shenanigans
event.custom({
  "type": "malum:spirit_infusion",
  "extra_items": [
    {
      "count": 8,
      "item": "malum:processed_soulstone"
    },
    {
      "count": 4,
      "item": "minecraft:glowstone_dust"
    },
    {
      "count": 4,
      "item": "projecte:medium_covalence_dust"
    }
  ],
  "input": {
    "count": 1,
    "item": "minecraft:gold_block"
  },
  "output": {
    "item": "malum:cthonic_gold"
  },
  "spirits": [
    {
      "type": "earthen",
      "count": 8
    },
    {
      "type": "infernal",
      "count": 16
    },
    {
      "type": "arcane",
      "count": 8
    }
  ]
})

// Brilliance
event.recipes.thermal.bottler('malum:cluster_of_brilliance', [Fluid.of('cofh_core:experience', 1000), 'malum:cthonic_gold']).energy(10000)

// Diamonds
event.custom({
  "type": "malum:spirit_infusion",
  "extra_items": [
    {
      "count": 1,
      "item": "minecraft:redstone"
    },
	{
      "count": 1,
      "item": "minecraft:glowstone_dust"
    },
	{
      "count": 1,
      "item": "minecraft:gold_ingot"
    },
	{
      "count": 1,
      "tag": "forge:ingots/silver"
    },
	{
      "count": 1,
      "tag": "forge:ingots/osmium"
    },
	{
      "count": 1,
      "tag": "forge:gems/ruby"
    },
	{
      "count": 1,
      "item": "ae2:certus_quartz_crystal"
    },
	{
      "count": 1,
      "item": "minecraft:emerald"
    }
  ],
  "input": {
    "count": 1,
    "item": "projecte:aeternalis_fuel"
  },
  "output": {
    "item": "minecraft:diamond"
  },
  "spirits": [
    {
      "type": "aerial",
      "count": 32
    },
    {
      "type": "sacred",
      "count": 32
    },
    {
      "type": "aqueous",
      "count": 32
    },
	{
      "type": "arcane",
      "count": 32
    },
	{
      "type": "earthen",
      "count": 32
    },
	{
      "type": "wicked",
      "count": 32
    },
	{
      "type": "eldritch",
      "count": 32
    },
	{
      "type": "infernal",
      "count": 32
    }
  ]
})

// Purpur Brick
event.shaped(
  Item.of('8x minecraft:purpur_block'),
  [
    'aaa',
    'aba',
    'aaa'
  ],
  {
    a: 'minecraft:end_stone_bricks',
    b: '#kubejs:dark_matter'
  }
)

// Chorus Fruit
event.shaped(
  Item.of('8x minecraft:chorus_fruit'),
  [
    'aaa',
    'aba',
    'aaa'
  ],
  {
    a: 'minecraft:apple',
    b: '#kubejs:dark_matter'
  }
)

// Ink Sac
event.recipes.ars_nouveau.imbuement(
        'minecraft:cod', // input item
        'minecraft:ink_sac', // output
        500, // source cost
        []
)

// Fluorine
event.custom({
	"type":"mekanism:injecting",
	"chemicalInput":{
		"amount":10,
		"gas":"mekanism:lithium"
	},
	"itemInput":{
		"ingredient":{
			"item":"ae2:certus_quartz_crystal"
		}
	},
	"output":{
		"item":"mekanism:fluorite_gem"
	}
})

// Ars Token swapping
event.recipes.botania.mana_infusion("ars_nouveau:drygmy_shard", "ars_nouveau:starbuncle_shards", 8000, 'botania:alchemy_catalyst')
event.recipes.botania.mana_infusion("ars_nouveau:starbuncle_shards", "ars_nouveau:whirlisprig_shards", 8000, 'botania:alchemy_catalyst')
event.recipes.botania.mana_infusion("ars_nouveau:whirlisprig_shards", "ars_nouveau:drygmy_shard", 8000, 'botania:alchemy_catalyst')

})