// priority: 10

ServerEvents.recipes(event => {

    //Strainer Recipes
    //Fluid, DefaultChance, Additional Chance Per Tier, Duration, Input Item, Mesh Tier, Output Item, Output Count, Recipe ID

    strainerFluid("stoneopolis:blazing_fluid", 0.2, 0.2, 200, "minecraft:stone", 2, "minecraft:netherrack", 1, "stoneopolis:netherrack")
    strainerFluidTag("stoneopolis:blazing_fluid", 0.2, 0.2, 200, "minecraft:sand", 2, "minecraft:soul_sand", 1, "stoneopolis:soul_sand")
    strainerFluid("stoneopolis:blazing_fluid", 0.05, 0.1, 200, "minecraft:netherrack", 3, "geode_plus:budding_nether_quartz", 1, "stoneopolis:budding_nether_quartz")

    strainerFluid("strainers:purified_water_fluid", 1.0, 0.0, 250, "minecraft:quartz", 1, "ae2:certus_quartz_dust", 1, "stoneopolis:certus_quartz_dust")

    strainerFluid("strainers:purified_water_fluid", 1.0, 0.0, 100, "minecraft:magma_cream", 1, "minecraft:slime_ball", 1, "stoneopolis:slime_ball")

    strainerFluid('strainers:purified_water_fluid', 1, 0.0, 120, "stoneopolis:void_copper_ingot", 1, "alltheores:copper_dust", 1, "stoneopolis:copper_dust")
    strainerFluid('strainers:purified_water_fluid', 1, 0.0, 120, "stoneopolis:void_lead_ingot", 1, "alltheores:lead_dust", 1, "stoneopolis:lead_dust")
    strainerFluid('strainers:purified_water_fluid', 1, 0.0, 120, "stoneopolis:void_tin_ingot", 1, "alltheores:tin_dust", 1, "stoneopolis:tin_dust")
    strainerFluid('strainers:purified_water_fluid', 1, 0.0, 120, "stoneopolis:void_iron_ingot", 1, "alltheores:iron_dust", 1, "stoneopolis:iron_dust")
    strainerFluid("strainers:purified_water_fluid", 1.0, 0.0, 100, "stoneopolis:void_dirt", 1, "minecraft:dirt", 1, "stoneopolis:dirt")
    strainerFluid("strainers:purified_water_fluid", 1.0, 0.0, 100, "stoneopolis:sandy_dirt", 1, "minecraft:sand", 1, "stoneopolis:sand_pure")
    strainerFluid("minecraft:water", 0.5, 0.0, 100, "stoneopolis:sandy_dirt", 1, "minecraft:sand", 1, "stoneopolis:sand_water")
    strainerFluid("strainers:eroding_water_fluid", 0.6, 0.05, 50, "caveopolis:gray_colored_stone", 1, "strainers:deepslate_pebble", 1, "stoneopolis:deepslate_pebble")
    strainerFluid("strainers:eroding_water_fluid", 0.6, 0.05, 50, "minecraft:deepslate", 1, "stoneopolis:void_chunk", 1, "stoneopolis:void_chunk")
    strainerFluid("strainers:purified_water_fluid", 0.2, 0.2, 200, 'minecraft:netherrack', 3, 'minecraft:nether_gold_ore', 1, 'stoneopolis:nether_gold_ore')
    strainerFluid("strainers:eroding_water_fluid", 0.5, 0.1, 200, "minecraft:netherrack", 3, "minecraft:nether_wart", 1, "stoneopolis:nether_wart")

    strainerFluid("minecraft:water", 0.6, 0.1, 50, "caveopolis:gray_colored_leaves", 1, "caveopolis:mixed_stone_nugget", 1, "stoneopolis:mixed_stone_nugget")
    strainerFluid("minecraft:water", 0.6, 0.1, 50, "caveopolis:light_gray_colored_leaves", 3, "alltheores:silver_nugget", 1, "stoneopolis:silver_nugget")
    strainerFluid("minecraft:water", 0.6, 0.1, 50, "caveopolis:gray_colored_leaves", 3, "alltheores:aluminum_nugget", 1, "stoneopolis:aluminum_nugget")
    strainerFluid("minecraft:water", 0.6, 0.1, 50, "caveopolis:white_colored_leaves", 3, "alltheores:nickel_nugget", 1, "stoneopolis:nickel_nugget")
    strainerFluid("minecraft:water", 0.6, 0.1, 50, "caveopolis:lime_colored_leaves", 3, "alltheores:uranium_nugget", 1, "stoneopolis:uranium_nugget")
    strainerFluid("minecraft:water", 0.1, 0.2, 50, "caveopolis:purple_colored_leaves", 3, "minecraft:amethyst_shard", 1, "stoneopolis:amethyst")
    
    strainerFluid("bloodmagic:life_essence_fluid", 0.6, 0.05, 50, "caveopolis:orange_colored_leaves", 1, "stoneopolis:void_copper_nugget", 1, "stoneopolis:void_copper_nugget_strainers")
    strainerFluid("bloodmagic:life_essence_fluid", 0.6, 0.05, 50, "caveopolis:light_gray_colored_leaves", 1, "stoneopolis:void_tin_nugget", 1, "stoneopolis:void_tin_nugget_strainers")

    strainerFluid("minecraft:water", 0.2, 0.05, 50, "caveopolis:brown_colored_leaves", 1, "minecraft:brown_mushroom", 1, "stoneopolis:brown_mushroom")
    strainerFluid("minecraft:water", 0.2, 0.05, 50, "caveopolis:red_colored_leaves", 1, "minecraft:red_mushroom", 1, "stoneopolis:red_mushroom")

    strainerFluid("minecraft:water", 0.2, 0.05, 50, "caveopolis:green_colored_leaves", 1, "minecraft:cactus", 1, "stoneopolis:cactus")
    strainerFluid("minecraft:water", 0.2, 0.05, 50, "caveopolis:green_colored_leaves", 1, "minecraft:bamboo", 1, "stoneopolis:bamboo")
    strainerFluid("minecraft:water", 0.2, 0.05, 50, "caveopolis:green_colored_leaves", 1, "minecraft:sugar_cane", 1, "stoneopolis:sugar_cane")

    strainerFluid("strainers:eroding_water_fluid", 0.5, 0.1, 200, "minecraft:soul_sand", 3, "minecraft:glowstone_dust", 1, "stoneopolis:glowstone")
    
    strainerFluid("strainers:eroding_water_fluid", 0.3, 0.1, 200, "minecraft:nether_wart_block", 3, "minecraft:warped_fungus", 1, "stoneopolis:warped_fungus")
    strainerFluid("strainers:eroding_water_fluid", 0.3, 0.1, 200, "minecraft:nether_wart_block", 3, "minecraft:crimson_fungus", 1, "stoneopolis:crimson_fungus")

    strainerFluid("strainers:purified_water_fluid", 0.5, 0.1, 200, 'alltheores:diamond_dust', 3, 'minecraft:diamond', 1, 'stoneopolis:diamond')
    strainerFluid("strainers:purified_water_fluid", 0.5, 0.1, 200, 'stoneopolis:black_iron_dust', 3, 'extendedcrafting:black_iron_ingot', 1, 'stoneopolis:black_iron_dust')
    strainerFluid("strainers:purified_water_fluid", 0.8, 0.2, 400, 'minecraft:netherite_scrap', 5, 'alltheores:netherite_dust', 1, 'stoneopolis:netherite_dust_strainers')

    strainerFluid("strainers:purified_water_fluid", 1.0, 0.0, 200, 'stoneopolis:concrete_dust', 1, 'caveopolis:bright_shard', 1, 'stoneopolis:bright_shard_strainers')
    strainerFluid("strainers:purified_water_fluid", 1.0, 0.0, 200, 'minecraft:dandelion', 1, 'minecraft:sunflower', 1, 'stoneopolis:sunflower')

    strainerFluidTag("strainers:eroding_water_fluid", 1.0, 0.0, 200, "caveopolis:colored_concrete", 1, "stoneopolis:concrete_dust_pile", 1, "stoneopolis:concrete_dust_pile")

    strainerFluid("minecraft:water", 0.05, 0.05, 400, "minecraft:fishing_rod", 1, "minecraft:tropical_fish", 1, "stoneopolis:tropical_fish")
    strainerFluid("minecraft:water", 0.05, 0.05, 400, "minecraft:fishing_rod", 1, "minecraft:pufferfish", 1, "stoneopolis:pufferfish")
    strainerFluid("minecraft:water", 0.3, 0.05, 400, "minecraft:fishing_rod", 1, "minecraft:salmon", 1, "stoneopolis:salmon")
    strainerFluid("minecraft:water", 0.3, 0.05, 400, "minecraft:fishing_rod", 1, "minecraft:cod", 1, "stoneopolis:cod")


    //Strainers (Plates and Rods)
    //Material Name, Plate Name, Rod Name

    platesAndMolds("steel", "alltheores:steel_plate", "alltheores:steel_rod")
    platesAndMolds("iron", "alltheores:iron_plate", "alltheores:iron_rod")
    platesAndMolds("gold", "alltheores:gold_plate", "alltheores:gold_rod")

    //Summoning Block

    summoningBlockFluid("bloodmagic:life_essence_fluid", 'stoneopolis:nether_star_fragment', 'minecraft:warden_spawn_egg', 'minecraft:warden')
    summoningBlockFluid("bloodmagic:life_essence_fluid", 'stoneopolis:pig_iron', 'minecraft:pig_spawn_egg', 'minecraft:pig')
    summoningBlockFluid("bloodmagic:life_essence_fluid", 'minecraft:leather', 'minecraft:cow_spawn_egg', 'minecraft:cow')
    summoningBlockFluid("bloodmagic:life_essence_fluid", 'minecraft:feather', 'minecraft:chicken_spawn_egg', 'minecraft:chicken')
    summoningBlockFluid("bloodmagic:life_essence_fluid", 'stoneopolis:void_copper_nugget', 'minecraft:endermite_spawn_egg', 'minecraft:endermite')
    summoningBlockFluid("bloodmagic:life_essence_fluid", 'stoneopolis:netherite_bone', 'minecraft:wither_skeleton_spawn_egg', 'minecraft:wither_skeleton')
    summoningBlockFluid("bloodmagic:life_essence_fluid", 'minecraft:bone_meal', 'minecraft:skeleton_spawn_egg', 'minecraft:skeleton')
    summoningBlockFluid("bloodmagic:life_essence_fluid", 'minecraft:green_dye', 'minecraft:slime_spawn_egg', 'minecraft:slime')
    summoningBlockFluid("minecraft:lava", 'stoneopolis:fire_stick', 'minecraft:blaze_spawn_egg', 'minecraft:blaze')
    summoningBlockFluid("minecraft:lava", 'stoneopolis:lava_fragment', 'lava_monster:lava_monster_spawn_egg', 'lava_monster:lava_monster')
    summoningBlockFluid("stoneopolis:blazing_fluid", 'minecraft:blaze_powder', 'minecraft:magma_cube_spawn_egg', 'minecraft:magma_cube')

    //No Defaullt Summoning Block Recipes

    event.remove({id:'/strainers:summoning_block//'})
    event.remove({type: "strainers:strainer"})  

    //Recipe Functions

    
    function summoningBlockBlock(blockBelow, inItem, recipeItem, summonedMob) {

        event.custom({
          type: "strainers:summoning",
          blockBelow: blockBelow,
          ingredients: [{item: inItem}, {item: recipeItem}
          ],
          summonedMob: summonedMob
        }).id(`${summonedMob}_from_summoning_block`)
      }
    
      function summoningBlockFluid(fluidBelow, inItem, recipeItem, summonedMob) {
    
        event.custom({
          type: "strainers:summoning",
          fluidBelow: fluidBelow,
          ingredients: [{item: inItem}, {item: recipeItem}
          ],
          summonedMob: summonedMob
        }).id(`${summonedMob}_from_summoning_block`)
      }

    function strainerFluid(aboveFluid, chance, chanceIncreasePerTier, duration, inItem, minMeshTier, outItem, outCount, id) {
        event.custom({
            type: "strainers:strainer",
            aboveFluid: aboveFluid,
            chance: chance,
            chanceIncreasePerTier: chanceIncreasePerTier,
            duration: duration,
            ingredients: [{item: inItem}],
            minMeshTier: minMeshTier,
            output: {item: outItem, count: outCount}
            }).id(id)
    }

    function strainerFluidTag(aboveFluid, chance, chanceIncreasePerTier, duration, inItem, minMeshTier, outItem, outCount, id) {
        event.custom({
            type: "strainers:strainer",
            aboveFluid: aboveFluid,
            chance: chance,
            chanceIncreasePerTier: chanceIncreasePerTier,
            duration: duration,
            ingredients: [{tag: inItem}],
            minMeshTier: minMeshTier,
            output: {item: outItem, count: outCount}
        }).id(id)
    }

    function strainerBlock(aboveBlock, chance, chanceIncreasePerTier, duration, inItem, minMeshTier, outItem, outCount, id) {

        event.custom({
            type: "strainers:strainer",
            aboveBlock: aboveBlock,
            chance: chance,
            chanceIncreasePerTier: chanceIncreasePerTier,
            duration: duration,
            ingredients: [{item: inItem}],
            minMeshTier: minMeshTier,
            output: {item: outItem, count: outCount}
        }).id(id)
    }

    function platesAndMolds(material, plateOutput, rodOutput) { 
        
        strainerFluidTag("strainers:eroding_water_fluid", 1.0, 0.05, 200, `forge:storage_blocks/${material}`, 3, plateOutput, 7, `stoneopolis:${material}_plate_strainers`)
        strainerFluidTag("strainers:eroding_water_fluid", 0.85, 0.05, 200, `forge:ingots/${material}`, 3, rodOutput, 1, `stoneopolis:${material}_rod_strainers`)
    
    }

})
