// priority: 0

// Visit the wiki for more info - https://kubejs.com/

// onEvent('recipes', event => {
    
ServerEvents.recipes(event => {
    let nutTypes = ["peanut", "walnut", "almond", "chestnut", "hazelnut", "pistachio", "macadamia", "pecan"]
    let all_nutTypes = ["peanut", "walnut", "almond", "chestnut", "hazelnut", "pistachio", "macadamia", "pecan", "cashew"]
    nutTypes.forEach(i => {
        event.recipes.thermal.insolator([Item.of(`garnished:ungarnished_${i}`, 4), Item.of(`garnished:ungarnished_${i}`, 1), Item.of('garnished:nut_log', 6), Item.of('minecraft:apple', 1).withChance(0.05)], `garnished:cracked_${i}`).id(`kubejs:${i}_from_insolator`)
    });
    event.recipes.thermal.insolator([Item.of('garnished:ungarnished_cashew', 4), Item.of('garnished:ungarnished_cashew', 1).withChance(0.65), Item.of('garnished:nut_log', 6), Item.of('garnished:cashew_fruit', 1).withChance(0.05)], 'garnished:cracked_cashew').id('kubejs:cashew_from_insolator')
    
    all_nutTypes.forEach(i => {
        event.recipes.thermal.pulverizer([Item.of(`garnished:cracked_${i}`, 2), Item.of(`garnished:cracked_${i}`).withChance(0.25)], `#forge:crops/${i}`).id(`bttk:pulverizer/cracked_${i}`)
    })

    event.recipes.thermal.insolator([Item.of('garnished:aureate_shrub', 2)], 'garnished:aureate_shrub').id('bttk:insolator/aureate_shrub')
    event.recipes.thermal.insolator([Item.of('garnished:voltaic_sea_grass', 2)], 'garnished:voltaic_sea_grass').id('bttk:insolator/voltaic_sea_grass')
    event.recipes.thermal.insolator([Item.of('garnished:dulse_kelp', 2)], 'garnished:dulse_kelp').id('bttk:insolator/dulse_kelp')
    event.recipes.thermal.insolator([Item.of('garnished:vermilion_kelp', 2)], 'garnished:vermilion_kelp').id('bttk:insolator/vermilion_kelp')
    event.recipes.thermal.insolator([Item.of('garnished:barren_roots', 2)], 'garnished:barren_roots').id('bttk:insolator/barren_roots')
    event.recipes.thermal.insolator([Item.of('minecraft:chorus_fruit', 2).withChance(1.1), Item.of('garnished:chorus_tuft', 1).withChance(1.41), Item.of('garnished:small_chorus_plant')], 'garnished:small_chorus_plant').id('bttk:insolator/small_chorus_plant')
    event.recipes.thermal.insolator([Item.of('garnished:pansophical_daisy', 2)], 'garnished:pansophical_daisy').id('bttk:insolator/pansophical_daisy')
    event.recipes.thermal.insolator([Item.of('garnished:incandescent_lily', 2)], 'garnished:incandescent_lily').id('bttk:insolator/incandescent_lily')
    event.recipes.thermal.insolator([Item.of('garnished:sorrowful_lichen', 2)], 'garnished:sorrowful_lichen').id('bttk:insolator/sorrowful_lichen')
    event.recipes.thermal.insolator([Item.of('garnished:soul_roots', 2)], 'garnished:soul_roots').id('bttk:insolator/soul_roots')
    event.recipes.thermal.insolator([Item.of('garnished:sepia_fungus', 1).withChance(1.1), Item.of('garnished:sepia_stem', 6), Item.of('garnished:sepia_wart_block', 8).withChance(1.41)], 'garnished:sepia_fungus').id('bttk:insolator/sepia_fungus')
    event.recipes.thermal.insolator([Item.of('garnished:bok_choy', 1).withChance(1.0), Item.of('garnished:bok_choy', 1).withChance(0.20)], 'garnished:bok_choy_seeds').id('bttk:insolator/bok_choy')

    event.recipes.create.haunting('garnished:sorrowful_lichen', 'minecraft:glow_lichen').id('bttk:haunting/sorrowful_lichen')

    event.recipes.thermal.pulverizer([Item.of('garnished:garnish_compound', 6), Item.of('garnished:garnish_compound', 2).withChance(0.15)], 'garnished:solidified_garnish').id('bttk:pulverizer/garnish_compound')

    event.remove('garnished:sequenced_assembly/hardened_wrap')
    let incompleteHardenedWrap = 'garnished:incomplete_hardened_wrap'
    event.recipes.create.sequenced_assembly([
        Item.of('garnished:hardened_wrap', 1)
    ], 'minecraft:paper', [
        event.recipes.create.deploying(incompleteHardenedWrap, [incompleteHardenedWrap, 'minecraft:iron_nugget']),
        event.recipes.create.deploying(incompleteHardenedWrap, [incompleteHardenedWrap, 'thermal:quartz_dust'])
    ]).transitionalItem(incompleteHardenedWrap).loops(2).id('bttk:sequenced_assembly/hardened_wrap')

    event.remove('garnished:integration/hatchet/fluix_hatchet')
    event.smithing('garnished:fluix_hatchet', 'ae2:fluix_upgrade_smithing_template', '#garnished:quartz_hatchet', 'ae2:fluix_block').id('bttk:temp_fix/fluix_hatchet')

    event.remove('garnished:crushing/materials_from_unstable_stone')

    event.shapeless('4x minecraft:sugar', 'garnished:sugar_cube')

    /* let colours = ['red', 'orange', 'yellow', 'green', 'blue', 'purple']
    colours.forEach(i => {
        let incompleteVenerableDelicacy = 'kubejs:incomplete_venerable_delicacy'
        event.remove(`garnished:sequenced_assembly/venerable_delicacy/${i}`)
        event.recipes.create.sequenced_assembly([
            Item.of(`garnished:venerable_delicacy_${i}`, 1)
        ], 'garnished:venerable_dough', [
            event.recipes.create.deploying(incompleteVenerableDelicacy, [incompleteVenerableDelicacy, `garnished:mastic_paste_${i}`]),
            event.recipes.create.deploying(incompleteVenerableDelicacy, [incompleteVenerableDelicacy, 'minecraft:sugar']),
            event.recipes.create.deploying(incompleteVenerableDelicacy, [incompleteVenerableDelicacy, `garnished:mastic_paste_${i}`])
        ]).transitionalItem(incompleteVenerableDelicacy).loops(2).id(`bttk:sequenced_assembly/incomplete_item_fix/${i}_venerable_delicacy`)
    }) */

    event.remove('garnished:integration/phantom_burger')
    event.remove('garnished:integration/glow_ink_roll')
    event.remove('garnished:integration/glow_ink_roll_slice')
    event.remove('garnished:integration/cutting/pecan_pie')
    event.remove('garnished:integration/phantom_beef')

    event.shapeless('1x garnished:phantom_burger', ['minecraft:bread', 'garnished:phantom_beef_patty', 'garnished:senile_dust', 'garnished:soul_roots']).id('bttk:farmers_delight_replaced/phantom_burger')
    event.shapeless('3x garnished:glow_ink_roll', ['3x minecraft:dried_kelp', '2x minecraft:glow_ink_sac']).id('bttk:farmers_delight_replaced/glow_ink_roll')
    event.recipes.create.cutting('4x garnished:glow_ink_roll_slice', 'garnished:glow_ink_roll').id('bttk:farmers_delight_replaced/glow_ink_roll_slice')
    event.recipes.create.cutting('4x garnished:pecan_pie_slice', 'garnished:pecan_pie').id('bttk:farmers_delight_replaced/pecan_pie_slice')
    event.recipes.create.cutting('3x garnished:phantom_beef_patty', 'garnished:phantom_steak').id('bttk:farmers_delight_replaced/phantom_beef_patty')

})