// baked into kubejs
// auto adds to create when possible
ServerEvents.recipes(event => {

    // shaped crafting recipe
    event.shaped(
        Item.of('minecraft:stone', 3),
        [
            'A B',
            ' C ',
            'B A'
        ],
        {
            A: "minecraft:andesite",
            B: 'minecraft:diorite',
            C: 'minecraft:granite'
        }
    )

    // shapeless crafting recipe
    event.shapeless(
        Item.of('minecraft:dandelion', 3),
        [
            'minecraft:bone_meal',
            'minecraft:yellow_dye',
            '3x minecraft:ender_pearl'
        ]
    )

    // smithing table
    // arg 1: output
    // arg 2: the smithing template
    // arg 3: the item to be upgraded
    // arg 4: the upgrade item
    event.smithing(
        'minecraft:netherite_ingot',
        'minecraft:netherite_upgrade_smithing_template',
        'minecraft:iron_ingot',
        'minecraft:black_dye'
    )

    // smelting (normal furnace)
    event.smelting(
        '3x minecraft:gravel',
        'minecraft:stone'
    )

    // blast furnace
    event.blasting(
        '10x minecraft:iron_nugget',
        'minecraft:iron_ingot'
    )

    // smoker
    event.smoking(
        'minecraft:tinted_glass', 
        'minecraft:glass'
    ).xp(0.35)

    // Burn sticks into torches on the Campfire, give 0.35XP and take 30 seconds:
    event.campfireCooking(
        'minecraft:torch',
        'minecraft:stick',
        0.35,
        600
    )

    //allow cutting 3 sticks from any plank on the stonecutter
    event.stonecutting(
        '3x minecraft:stick', 
        '#minecraft:planks'
    )

})


// Custom recipes json formating for adding recipes to the cutting board and cooking pot from farmers delight
ServerEvents.recipes(event => {

    // CUTTING BOARD
    event.custom({
        "type": "farmersdelight:cutting",
        "ingredients": [
            {"item": "minecraft:beef"}
        ],
        "result": [
            {"count": 2,
            "item":"farmersdelight:minced_beef"}
        ],
        "tool": {"tag": "forge:tools/knives"}
    })

    // COOKING
    event.custom({
        "type": "farmersdelight:cooking",
        "cookingtime": 200,
        "experience": 1.0,
        "ingredients": [
            {"item": "minecraft:apple"},
            { "item": "minecraft:apple"},
            {"item": "minecraft:sugar"}
        ],
        "recipe_book_tab": "drinks",
        "result": {"item": "farmersdelight:apple_cider"}
    })
})


// Custom recipes json formating for adding recipes for all the different types of crafting that create adds
ServerEvents.recipes(event => {
    //
    event.custom({
        "type": "create:compacting",
        "ingredients": [
            {"item": "minecraft:flint"},
            {"item": "minecraft:flint"},
            {"item": "minecraft:gravel"},
            {"type": "fluid_stack","amount": 100,"fluid": "minecraft:lava"}],
        "results": [
            {"id": "minecraft:andesite"}
        ]
    })    
    //
    event.custom({
        "type": "create:crushing",
        "ingredients": [{"item": "minecraft:blaze_rod"}],
        "processing_time": 100,
        "results": [
            {"count": 3,"id": "minecraft:blaze_powder"},
            {"chance": 0.25,"count": 3,"id": "minecraft:blaze_powder"}
        ]
    })

    //
    event.custom({
        "type": "create:cutting",
        "ingredients": [
            {"item": "create:andesite_alloy"}

        ],
        "processing_time": 200,
        "results": [
            {"count": 6,"id": "create:shaft"}

        ]
    })

    //
    event.custom({
        "type": "create:deploying",
        "ingredients": [
            {"item": "minecraft:exposed_chiseled_copper"},
            {"tag": "minecraft:axes"}
        ],
        "keep_held_item": true,
        "results": [
            {"id": "minecraft:chiseled_copper"}
        ]
    })

    // emputies and item of its fluid using an item drain
    event.custom({
        "type": "create:emptying",
        "ingredients": [
            {"item": "create:builders_tea"}
        ],
        "results": [
            {"amount": 250,"id": "create:tea"},
            {"id": "minecraft:glass_bottle"}
        ]
    })

    // filling which is done by pooring a fluid on an item using a spout
    event.custom({
        "type": "create:filling",
        "ingredients": [
            {"item": "minecraft:dirt"},
            {"type": "fluid_stack","amount": 500,"fluid": "minecraft:water"}
        ],
        "results": [
            {"id": "minecraft:grass_block"}
        ]
    })

    // haunting which is done with a soul fire in front of a fan
    event.custom({
        "type": "create:haunting",
        "ingredients": [
            {"tag": "c:cobblestones"}
        ],
        "results": [
            {"id": "minecraft:blackstone"}
        ]
    })

    // changes a block into another one by right clicking an item on the orginal block
    event.custom({
        "type": "create:item_application",
        "ingredients": [
            {"tag": "c:stripped_logs"},
            {"item": "create:andesite_alloy"}
        ],
        "results": [
            {"id": "create:andesite_casing"}
        ]
    })

    // customizable crafting grid size 
    event.custom({
        "type": "create:mechanical_crafting",
        "accept_mirrored": false,
        "category": "misc",
        "key": {
            "A": {"item": "create:andesite_alloy"},
            "P": {"tag": "minecraft:planks"},
            "S": {"tag": "c:stones"}
        },
        "pattern": [
            " AAA ",
            "AAPAA",
            "APSPA",
            "AAPAA",
            " AAA "
        ],
        "result": {"count": 2,"id": "create:crushing_wheel"}
    })

    // milling which is done with a millstone
    // processing_time is in ticks
    event.custom({
        "type": "create:milling",
        "ingredients": [
            {"item": "minecraft:andesite"}
        ],
        "processing_time": 200,
        "results": [
            {"id": "minecraft:cobblestone"}
        ]
    })

    // mixing whichs is done with a mechanical mixer and basin
    // add  tag heat_requirement to make heating required for a recipe
    event.custom({
        "type": "create:mixing",
        "ingredients": [
            {"item": "minecraft:andesite"},
            {"tag": "c:nuggets/iron"}
        ],
        "results": [
            {"id": "create:andesite_alloy"}
        ]
    })
    
    // pressing which is done with a mechanical press
    event.custom({
        "type": "create:pressing",
        "ingredients": [
            [
                {"item": "minecraft:grass_block"},
                {"item": "minecraft:dirt"},
                {"item": "minecraft:coarse_dirt"},
                {"item": "minecraft:rooted_dirt"}
            ]
        ],
        "results": [
            {"id": "minecraft:dirt_path"}
        ]
    })
    
    // sanding which is done with sand paper by hand or with a deployer
    event.custom({
        "type": "create:sandpaper_polishing",
        "ingredients": [
            {"item": "create:rose_quartz"}
        ],
        "results": [
            {"id": "create:polished_rose_quartz"}
        ]
    })

    // splashing which is done with water in front of a fan
    event.custom({
        "type": "create:splashing",
        "ingredients": [
            {"item": "minecraft:black_concrete_powder"}
        ],
        "results": [
            {"id": "minecraft:black_concrete"}
        ]
    })

    // formating for sequenced assembly
    event.custom({
        "type": "create:sequenced_assembly",
        "ingredient": {"tag": "create:sleepers"},
        "loops": 1,
        "results": [
            {"id": "create:track"}
        ],
        "sequence": [
            {"type": "create:deploying",
                "ingredients": [
                    {"item": "create:incomplete_track"},
                    [
                        {"tag": "c:nuggets/iron"},
                        {"tag": "c:nuggets/zinc"}
                    ]
                ]
                ,"results": [
                    {"id": "create:incomplete_track"}
                ]
            },
            {"type": "create:deploying",
                "ingredients": [
                    {"item": "create:incomplete_track"},
                    [
                        {"tag": "c:nuggets/iron"},
                        {"tag": "c:nuggets/zinc"}
                    ]
                ],
                "results": [
                    {"id": "create:incomplete_track"}
                ]
            },
            {"type": "create:pressing",
                "ingredients": [
                    {"item": "create:incomplete_track"}
                ],
                "results": [
                    {"id": "create:incomplete_track"}
                ]
            }
        ],
        "transitional_item": {"id": "create:incomplete_track"}
    })




})
