ServerEvents.recipes(event => {
    event.recipes.thermal.pulverizer("3x croptopia:flour", ['minecraft:wheat']);
    event.shapeless('2x croptopia:flour', ['minecraft:wheat', '#alltheores:ore_hammers']);

    let jamFruits = ['apricot', 'blackberry', 'blueberry', 'cherry', 'elderberry', 'grape', 'peach', 'raspberry', 'straberry'];
    jamFruits.forEach(fruit => {
        event.replaceInput({output: `croptopia:${fruit}_jam`}, 'minecraft:glass_bottle', 'thermal:jar');
    });

    event.custom({
        type: "thermal:press",
        ingredients: [
            { tag: 'forge:peanuts', count: 3},
            { item: "croptopia:food_press" }
        ],
        result: ["croptopia:peanut_butter"]
    });

    let saplingTag = Ingredient.of("#forge:saplings");

    saplingTag.getStacks().toArray().forEach(sapling => {
        let saplingID = sapling.getId().split(':');
        let fruitOutput = saplingID[1].split('_')[0];
        let outputTag = Ingredient.of(`#forge:crops/${fruitOutput}`).getStacks().toArray()[0].getId();
        console.log("Insolating " + outputTag + " from " + sapling);
        event.recipes.thermal.insolator(outputTag, sapling).water(400);
        // forge:crops/pear
    });

    event.recipes.thermal.bottler('croptopia:steamed_rice', [Fluid.of("minecraft:water", 50), '#forge:grain/rice']);
    event.recipes.thermal.bottler('croptopia:dough', [Fluid.of("minecraft:water", 50), '#forge:flour']);

    let _ = ['pizza', 'supreme_pizza', 'cheese_pizza', 'pineapple_pepperoni_pizza', 'anchovy_pizza'].forEach(pizza => {
        event.replaceInput(
            {output: `croptopia:${pizza}`},
            '#forge:tomatoes',
            '#forge:tomato_sauces'
        );
    });
});