// priority: 0

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

console.info('Hello, world! This is Thermal.')

onEvent('recipes', event => {
	// Change recipes here
		event.shapeless("flint", ["gravel", "gravel", "gravel"])
})

onEvent('recipes', event => {
  event.remove({output: 'thermal:rf_coil'})
  event.shaped('thermal:rf_coil', [
    ' AX',
    'ADA',
    'XA '
  ], {
    X: 'minecraft:redstone',
    A: 'minecraft:gold_nugget',
    D: 'immersiveengineering:component_electronic_adv'
  })
})

onEvent('recipes', event => {
    // Redstone Furnace
    // Turn 640 coal into one diamond
    event.recipes.thermal.furnace('minecraft:diamond', '640x minecraft:coal').energy(150000)
    // Dried kelp to leather, with a high energy cost
    event.recipes.thermal.furnace('minecraft:leather', 'minecraft:dried_kelp').energy(20000)
    
    // Sawmill
    // Input one oak leaf and have a 3% chance of an apple, and 10% of a sapling
    event.recipes.thermal.sawmill([Item.of('minecraft:apple').withChance(0.03), Item.of('minecraft:oak_sapling').withChance(0.1)], 'minecraft:oak_leaves')
    // Turn an acacia slab into 4 buttons
    event.recipes.thermal.sawmill('4x minecraft:acacia_button', 'minecraft:acacia_slab')
    
    // Pulverizer
    // Turn any leaf block into 4 sticks with a 50% chance of a fifth. Has a low energy cost.
    event.recipes.thermal.pulverizer(Item.of('minecraft:stick').withChance(4.5), '#minecraft:leaves').energy(100)
    // Pulverise a flint into an iron nugget with a 10% chance of a second
    event.recipes.thermal.pulverizer(Item.of('minecraft:iron_nugget').withChance(1.1), 'minecraft:flint')
    
    // Induction Smelter
    // Turn one coal block into 4 diamonds with a 50% chance of a fifth
    event.recipes.thermal.smelter(['4x minecraft:diamond', Item.of('minecraft:diamond').withChance(0.5)], 'minecraft:coal_block')
    // Turn an iron ingot and a copper ingot into a gold ingot and require 10,000 FE
    event.recipes.thermal.smelter('minecraft:gold_ingot', ['minecraft:iron_ingot', 'minecraft:copper_ingot']).energy(10000)
    
    // Centrifugal Separator
    // Centrifuge one sapling into 50% chance of a stick and 300mb of water
    event.recipes.thermal.centrifuge([Item.of('minecraft:stick').withChance(0.5), Fluid.of('minecraft:water', 300)], '#minecraft:saplings')
    // Turn 2 sweet berries into red dye
    event.recipes.thermal.centrifuge('minecraft:red_dye', '2x minecraft:sweet_berries')
    
    // Multiservo Press
    // Press seven bonemeal into a bone.
    event.recipes.thermal.press('minecraft:bone', '7x minecraft:bone_meal')
    // Press an iron dust into an iron nugget using the coin die. To use an item as a die they must have the thermal:crafting/dies tag!
    event.recipes.thermal.press('minecraft:iron_nugget', ['#forge:dusts/iron', 'thermal:press_coin_die'])
   
    event.recipes.thermal.crucible(Fluid.of('minecraft:water', 400), '#minecraft:saplings').energy(100)
    // Melt ores into lava
    event.recipes.thermal.crucible(Fluid.of('minecraft:lava', 500), '#forge:ores')

    // Blast Chiller
    // Chill an arrow into an arrow of slowness
    event.recipes.thermal.chiller(Item.of('minecraft:tipped_arrow', '{Potion:"minecraft:slowness"}'), [Fluid.of('minecraft:water', 100), 'minecraft:arrow'])
    // Chill lava into raw iron using the ball cast. For an item to count as a cast it needs to have the thermal:crafting/casts tag!
    event.recipes.thermal.chiller('minecraft:raw_iron', [Fluid.of('minecraft:lava', 1000), 'thermal:chiller_ball_cast'])
    
    // Fractionating Still
    // Refine Creosete oil into Tree oil and latex, with a chance of producing rubber
    event.recipes.thermal.refinery([Item.of('thermal:rubber').withChance(0.8), Fluid.of('thermal:tree_oil', 100), Fluid.of('thermal:latex', 50)], Fluid.of('thermal:creosote', 200))
    // Refine tree oil into a small amount of refined fuel with a high energy cost
    event.recipes.thermal.refinery(Fluid.of('thermal:refined_fuel', 50), Fluid.of('thermal:tree_oil', 100)).energy(20000)
    // Unbrew an awkward potion. This uses the cofh core potion fluid with some nbt.
    event.recipes.thermal.refinery([Fluid.of('minecraft:water', 1000), 'minecraft:nether_wart'], Fluid.of('cofh_core:potion', 1000, '{Potion:"minecraft:awkward"}'))
    
    // Fluid Encapsulator
    // Fill a sponge with water. Why? Well why not?
    event.recipes.thermal.bottler('minecraft:wet_sponge', [Fluid.of('minecraft:water', 10000), 'minecraft:sponge'])
    // Turn any gear into a machine frame by filling it with destabilized redstone. Nice and low energy cost too
    event.recipes.thermal.bottler('thermal:machine_frame', ['#forge:gears', Fluid.of('thermal:redstone', 500)]).energy(500)
})