ServerEvents.recipes(event => {
    const colors = ['white', 'orange', 'magenta', 'light_blue', 'yellow', 'lime', 'pink', 'gray', 'light_gray', 'cyan', 'purple', 'blue', 'brown', 'green', 'red', 'black'];
    const types = ['terracotta', 'concrete', 'glazed_terracotta'];
    const planter = 'supplementaries:planter';
    const chute = 'engineersdecor:factory_hopper';

    const createRecipe = (output, pattern, key, id) => {
      return {
          "output": output,
          "pattern": pattern,
          "key": key,
          "id": id
      };
    }


    let recipes = [
        createRecipe('botanypots:terracotta_botany_pot', ['T T', 'TPT', ' T '], {T: 'minecraft:terracotta', P: planter}, 'botanypots:botanypots/crafting/terracotta_botany_pot'),
        createRecipe('botanypots:terracotta_hopper_botany_pot', ['THT', 'TPT', ' T '], {T: 'minecraft:terracotta', P: planter, H: chute}, 'botanypots:botanypots/crafting/terracotta_compact_hopper_botany_pot'),
        createRecipe('botanypots:terracotta_hopper_botany_pot', ['P', 'C'], {P: 'botanypots:terracotta_botany_pot', C: chute}, 'botanypots:botanypots/crafting/terracotta_hopper_botany_pot')
    ];

    colors.forEach(color => {
        types.forEach(type => {
            const idPrefix = `botanypots:botanypots/crafting/${color}_${type}`;
            const outputPrefixHopper = `botanypots:${color}_${type}_hopper_botany_pot`;
            const outputPrefix = `botanypots:${color}_${type}_botany_pot`;
            const minecraftType = `minecraft:${color}_${type}`;
            recipes.push(
                createRecipe(`${outputPrefix}`, ['T T', 'TPT', ' T '], {T: minecraftType, P: planter}, `${idPrefix}_botany_pot`),
                createRecipe(`${outputPrefixHopper}`, ['THT', 'TPT', ' T '], {T: minecraftType, P: planter, H: chute}, `${idPrefix}_compact_hopper_botany_pot`),
                createRecipe(`${outputPrefixHopper}`, ['T', 'H'], {T: `${outputPrefix}`, H: chute}, `${idPrefix}_hopper_botany_pot`)
            );
        });
    });

    recipes.forEach(recipe => {
        event.shaped(recipe.output, recipe.pattern, recipe.key).id(recipe.id);
    });
});

//Elite Botany Pots
ServerEvents.recipes(event => {
    event.remove({mod: 'botanypotstiers'})

    const colors = ['white', 'orange', 'magenta', 'light_blue', 'yellow', 'lime', 'pink', 'gray', 'light_gray', 'cyan', 'purple', 'blue', 'brown', 'green', 'red', 'black'];
    const types = ['terracotta', 'concrete', 'glazed_terracotta'];
    const planter = 'botanypots:terracotta_botany_pot';
    const chute = 'engineersdecor:factory_hopper';
    const upgrade_base = 'naturesaura:depth_ingot_block';
    const upgrade_core = 'naturesaura:calling_spirit';

    const createRecipe = (output, pattern, key, id) => {
      return {
          "output": output,
          "pattern": pattern,
          "key": key,
          "id": id
      };
    }


    let recipes = [
        createRecipe('botanypotstiers:elite_terracotta_botany_pot', ['   ', ' T ', 'UPU'], {T: upgrade_core, P: planter, U: upgrade_base}, 'botanypotstiers:crafting/elite_terracotta_botany_pot'),
        createRecipe('botanypotstiers:elite_terracotta_hopper_botany_pot', ['   ', ' T ', 'UPU'], {T: upgrade_core, P: 'botanypots:terracotta_hopper_botany_pot', U: upgrade_base}, 'botanypotstiers:crafting/elite_terracotta_botany_pot_2'),
        createRecipe('botanypotstiers:elite_terracotta_hopper_botany_pot', [' C ', ' T ', 'UPU'], {T: upgrade_core, P: planter, U: upgrade_base, C: chute}, 'botanypotstiers:crafting/elite_terracotta_hopper_botany_pot_2'),
        createRecipe('botanypotstiers:elite_terracotta_hopper_botany_pot', ['P', 'C'], {P: 'botanypotstiers:elite_terracotta_botany_pot', C: chute}, 'botanypotstiers:crafting/elite_terracotta_hopper_botany_pot')
    ];

    colors.forEach(color => {
        types.forEach(type => {
            const idPrefix = `botanypotstiers:crafting/elite_${color}_${type}`;
            const outputPrefixHopper = `botanypotstiers:elite_${color}_${type}_hopper_botany_pot`;
            const outputPrefix = `botanypotstiers:elite_${color}_${type}_botany_pot`;
            const inputOGHopper = `botanypots:${color}_${type}_hopper_botany_pot`;
            const inputOG = `botanypots:${color}_${type}_botany_pot`;
            recipes.push(
                createRecipe(`${outputPrefix}`, ['   ', ' C ', 'BPB'], {P: inputOG, B: upgrade_base, C: upgrade_core}, `${idPrefix}_botany_pot`), //Upgrade - No Hopper
                createRecipe(`${outputPrefixHopper}`, ['   ', ' C ', 'BPB'], {P: inputOGHopper, B: upgrade_base, C: upgrade_core}, `${idPrefix}_botany_pot_2`), //Upgrade - Existing Hopper
                createRecipe(`${outputPrefixHopper}`, [' H ', ' C ', 'BPB'], {P: inputOG, B: upgrade_base, C: upgrade_core, H: chute}, `${idPrefix}_compact_hopper_botany_pot`), //Upgrade - Add Hopper
                createRecipe(`${outputPrefixHopper}`, ['T', 'H'], {T: `${outputPrefix}`, H: chute}, `${idPrefix}_hopper_botany_pot`) //No Upgrade - Add Hopper
            );
        });
    });

    recipes.forEach(recipe => {
        event.shaped(recipe.output, recipe.pattern, recipe.key).id(recipe.id);
    });
});

//Ultra Botany Pots
ServerEvents.recipes(event => {
    event.remove({mod: 'botanypotstiers'})

    const colors = ['white', 'orange', 'magenta', 'light_blue', 'yellow', 'lime', 'pink', 'gray', 'light_gray', 'cyan', 'purple', 'blue', 'brown', 'green', 'red', 'black'];
    const types = ['terracotta', 'concrete', 'glazed_terracotta'];
    const planter = 'botanypotstiers:elite_terracotta_botany_pot';
    const chute = 'engineersdecor:factory_hopper';
    const upgrade_base = 'bigreactors:cyanite_block';
    const upgrade_core = 'hostilenetworks:overworld_prediction';

    const createRecipe = (output, pattern, key, id) => {
      return {
          "output": output,
          "pattern": pattern,
          "key": key,
          "id": id
      };
    }


    let recipes = [
        createRecipe('botanypotstiers:ultra_terracotta_botany_pot', ['   ', ' T ', 'UPU'], {T: upgrade_core, P: planter, U: upgrade_base}, 'botanypotstiers:crafting/ultra_terracotta_botany_pot'),
        createRecipe('botanypotstiers:ultra_terracotta_hopper_botany_pot', ['   ', ' T ', 'UPU'], {T: upgrade_core, P: 'botanypotstiers:elite_terracotta_hopper_botany_pot', U: upgrade_base}, 'botanypotstiers:crafting/ultra_terracotta_botany_pot_2'),
        createRecipe('botanypotstiers:ultra_terracotta_hopper_botany_pot', [' C ', ' T ', 'UPU'], {T: upgrade_core, P: planter, U: upgrade_base, C: chute}, 'botanypotstiers:crafting/ultra_terracotta_hopper_botany_pot_2'),
        createRecipe('botanypotstiers:ultra_terracotta_hopper_botany_pot', ['P', 'C'], {P: 'botanypotstiers:ultra_terracotta_botany_pot', C: chute}, 'botanypotstiers:crafting/ultra_terracotta_hopper_botany_pot')
    ];

    colors.forEach(color => {
        types.forEach(type => {
            const idPrefix = `botanypotstiers:crafting/ultra_${color}_${type}`;
            const outputPrefixHopper = `botanypotstiers:ultra_${color}_${type}_hopper_botany_pot`;
            const outputPrefix = `botanypotstiers:ultra_${color}_${type}_botany_pot`;
            const inputOGHopper = `botanypotstiers:elite_${color}_${type}_hopper_botany_pot`;
            const inputOG = `botanypotstiers:elite_${color}_${type}_botany_pot`;
            recipes.push(
                createRecipe(`${outputPrefix}`, ['   ', ' C ', 'BPB'], {P: inputOG, B: upgrade_base, C: upgrade_core}, `${idPrefix}_botany_pot`), //Upgrade - No Hopper
                createRecipe(`${outputPrefixHopper}`, ['   ', ' C ', 'BPB'], {P: inputOGHopper, B: upgrade_base, C: upgrade_core}, `${idPrefix}_botany_pot_2`), //Upgrade - Existing Hopper
                createRecipe(`${outputPrefixHopper}`, [' H ', ' C ', 'BPB'], {P: inputOG, B: upgrade_base, C: upgrade_core, H: chute}, `${idPrefix}_compact_hopper_botany_pot`), //Upgrade - Add Hopper
                createRecipe(`${outputPrefixHopper}`, ['T', 'H'], {T: `${outputPrefix}`, H: chute}, `${idPrefix}_hopper_botany_pot`) //No Upgrade - Add Hopper
            );
        });
    });

    recipes.forEach(recipe => {
        event.shaped(recipe.output, recipe.pattern, recipe.key).id(recipe.id);
    });
});

//Creative Botany Pots
ServerEvents.recipes(event => {
    event.remove({mod: 'botanypotstiers'})

    const colors = ['white', 'orange', 'magenta', 'light_blue', 'yellow', 'lime', 'pink', 'gray', 'light_gray', 'cyan', 'purple', 'blue', 'brown', 'green', 'red', 'black'];
    const types = ['terracotta', 'concrete', 'glazed_terracotta'];
    const planter = 'botanypotstiers:ultra_terracotta_botany_pot';
    const chute = 'engineersdecor:factory_hopper';
    const upgrade_base = 'kubejs:mystian_blossom';
    const upgrade_core = 'mysticalagradditions:creative_essence';

    const createRecipe = (output, pattern, key, id) => {
      return {
          "output": output,
          "pattern": pattern,
          "key": key,
          "id": id
      };
    }


    let recipes = [
        createRecipe('botanypotstiers:creative_terracotta_botany_pot', ['   ', ' T ', 'UPU'], {T: upgrade_core, P: planter, U: upgrade_base}, 'botanypotstiers:crafting/creative_terracotta_botany_pot'),
        createRecipe('botanypotstiers:creative_terracotta_hopper_botany_pot', ['   ', ' T ', 'UPU'], {T: upgrade_core, P: 'botanypotstiers:ultra_terracotta_hopper_botany_pot', U: upgrade_base}, 'botanypotstiers:crafting/creative_terracotta_botany_pot_2'),
        createRecipe('botanypotstiers:creative_terracotta_hopper_botany_pot', [' C ', ' T ', 'UPU'], {T: upgrade_core, P: planter, U: upgrade_base, C: chute}, 'botanypotstiers:crafting/creative_terracotta_hopper_botany_pot_2'),
        createRecipe('botanypotstiers:creative_terracotta_hopper_botany_pot', ['P', 'C'], {P: 'botanypotstiers:creative_terracotta_botany_pot', C: chute}, 'botanypotstiers:crafting/creative_terracotta_hopper_botany_pot')
    ];

    colors.forEach(color => {
        types.forEach(type => {
            const idPrefix = `botanypotstiers:crafting/creative_${color}_${type}`;
            const outputPrefixHopper = `botanypotstiers:creative_${color}_${type}_hopper_botany_pot`;
            const outputPrefix = `botanypotstiers:creative_${color}_${type}_botany_pot`;
            const inputOGHopper = `botanypotstiers:ultra_${color}_${type}_hopper_botany_pot`;
            const inputOG = `botanypotstiers:ultra_${color}_${type}_botany_pot`;
            recipes.push(
                createRecipe(`${outputPrefix}`, ['   ', ' C ', 'BPB'], {P: inputOG, B: upgrade_base, C: upgrade_core}, `${idPrefix}_botany_pot`), //Upgrade - No Hopper
                createRecipe(`${outputPrefixHopper}`, ['   ', ' C ', 'BPB'], {P: inputOGHopper, B: upgrade_base, C: upgrade_core}, `${idPrefix}_botany_pot_2`), //Upgrade - Existing Hopper
                createRecipe(`${outputPrefixHopper}`, [' H ', ' C ', 'BPB'], {P: inputOG, B: upgrade_base, C: upgrade_core, H: chute}, `${idPrefix}_compact_hopper_botany_pot`), //Upgrade - Add Hopper
                createRecipe(`${outputPrefixHopper}`, ['T', 'H'], {T: `${outputPrefix}`, H: chute}, `${idPrefix}_hopper_botany_pot`) //No Upgrade - Add Hopper
            );
        });
    });

    recipes.forEach(recipe => {
        event.shaped(recipe.output, recipe.pattern, recipe.key).id(recipe.id);
    });
});