onEvent('recipes', (event) => {
    /*
    Note, max starlight is theoretical. In practice, assume roughly 95% as the max reasonable level

    Iridescent Altar
    altar_type: 3
    max_starlight: 8000

    */

    const id_prefix = 'astralsorcery:kubejs/altar';
    const recipes = [
        {
            output: Item.of('compactcrafting:base', 1),
            pattern: ['__A__', '__B__', '__B__', 'CCDCC', 'CCCCC'],
            key: {
                A: { item: 'jaept:dark_dough' },
                B: { tag: 'forge:rods/hop_graphite' },
                C: { item: 'compactmachines:wall' },
                D: { tag: 'forge:storage_blocks/stainless_steel' }
            },
            relay_inputs: [
                { item: 'immersivepetroleum:petcoke_dust' },
                { item: 'astralsorcery:nocturnal_powder' },
                { item: 'immersivepetroleum:petcoke_dust' },
                { item: 'astralsorcery:nocturnal_powder' },
                { item: 'immersivepetroleum:petcoke_dust' },
                { item: 'astralsorcery:nocturnal_powder' },
                { item: 'immersivepetroleum:petcoke_dust' },
                { item: 'astralsorcery:nocturnal_powder' },
            ],
            altar_type: 3,
            duration: 400,
            starlight: 6000,
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:built_in_effect_trait_relay_highlight',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_trait_focus_circle',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/compact_crafting_base`
        },
        {
            output: Item.of('compactcrafting:projector_dish', 1),
            pattern: ['ABFBA', 'BCDCB', 'FDEDF', 'BCDCB', 'ABFBA'],
            key: {
                A: { item: 'minecraft:netherite_ingot' },
                B: { item: 'immersiveengineering:ingot_hop_graphite' },
                C: Item.of('tconstruct:large_plate', '{Material:"materialis:refined_radiance"}').toJson(),
                D: { item: 'astralsorcery:glass_lens' },
                E: { tag: 'forge:gears/stainless_steel' },
                F: Item.of('tconstruct:large_plate', '{Material:"materialis:shadow_steel"}').toJson()
            },
            relay_inputs: [
                { item: 'bloodmagic:reagentsuppression' },
                { item: 'astralsorcery:illumination_powder' },
                { item: 'pedestals:coin/compactor3' },
                { item: 'astralsorcery:illumination_powder' }
            ],
            altar_type: 3,
            duration: 400,
            starlight: 6000,
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:built_in_effect_trait_relay_highlight',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_trait_focus_circle',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/projector_dish`
        },
        {
            output: Item.of('astralsorcery:chalice', 1),
            pattern: ['AB_BA', 'CBDBC', '_CEC_', '__E__', 'FGHGF'],
            key: {
                A: { item: 'immersiveengineering:sheetmetal_electrum' },
                B: { item: 'astralsorcery:infused_wood_enriched' },
                C: { item: 'emendatusenigmatica:lumium_plate' },
                D: { item: 'bloodmagic:sigilofmagnetism' },
                E: { item: 'create:shadow_steel_casing' },
                F: { item: 'atum:nebu_ingot' },
                G: { item: 'astralsorcery:starmetal_ingot' },
                H: { item: 'eidolon:gold_inlay' }
            },
            relay_inputs: [
                { item: 'kubejs:scarab_body' },
                { tag: 'forge:rods/holy' },
                { item: 'astralsorcery:perk_gem_night' },
                { item: 'astralsorcery:perk_gem_night' },
                { tag: 'forge:rods/holy' }
            ],
            altar_type: 3,
            duration: 600,
            starlight: 6500,
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:built_in_effect_trait_relay_highlight',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_trait_focus_circle',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'astralsorcery:altar/chalice'
        },
        {
            output: Item.of('astralsorcery:fountain'),
            pattern: ['ABBBA', 'CDEDC', '_FGF_', 'HIEIH', '_JFJ_'],
            key: {
                A: { item: 'astralsorcery:infused_wood_arch' },
                B: { item: 'astralsorcery:black_marble_raw' },
                C: { item: 'astralsorcery:infused_wood_engraved' },
                D: { item: 'emendatusenigmatica:lumium_rod' },
                E: { item: 'astralsorcery:resonating_gem' },
                F: { item: 'immersiveengineering:sheetmetal_electrum' },
                G: { item: 'astralsorcery:perk_gem_night' },
                H: { item: 'astralsorcery:starmetal_ingot' },
                I: { item: 'astralsorcery:stardust' },
                J: { item: 'astralsorcery:infused_wood_enriched' }
            },
            relay_inputs: [
                { item: 'astralsorcery:attuned_rock_crystal' },
                { item: 'appliedenergistics2:purified_nether_quartz_crystal' },
                { item: 'astralsorcery:attuned_rock_crystal' },
                { item: 'appliedenergistics2:purified_nether_quartz_crystal' }
            ],
            altar_type: 3,
            duration: 600,
            starlight: 6500,
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:built_in_effect_trait_relay_highlight',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_trait_focus_circle',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'astralsorcery:altar/fountain'
        },
        {
            output: Item.of('alexsmobs:dimensional_carver', '{Unbreakable:1b}'),
            pattern: ['_ABC_', '__CDC', '_EFCB', 'EFE_A', 'FE___'],
            key: {
                A: { item: 'alexsmobs:void_worm_mandible' },
                B: { item: 'astralsorcery:starmetal_ingot' },
                C: { item: 'eidolon:wicked_weave' },
                D: { item: 'alexsmobs:void_worm_eye' },
                E: { item: 'thermal:netherite_dust' },
                F: { tag: 'forge:rods/hop_graphite' }
            },
            focus_constellation: 'astralsorcery:evorsio',
            altar_type: 3,
            duration: 500,
            starlight: 6000,
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:built_in_effect_trait_relay_highlight',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_trait_focus_circle',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/dimensional_carver`
        },
        {
            output: Item.of('industrialforegoing:common_black_hole_unit'),
            pattern: ['AABAA', 'ACDCA', 'EFGFE', 'HCICH', 'HHJHH'],
            key: {
                A: { tag: 'forge:plates/stainless_steel' },
                B: { item: 'occultism:otherstone_frame' },
                C: { item: 'immersiveengineering:electron_tube' },
                D: { item: 'create:chute' },
                E: { item: 'thermal:cured_rubber' },
                F: { item: 'immersiveengineering:conveyor_basic' },
                G: { item: 'immersiveengineering:reinforced_crate' },
                H: { item: 'emendatusenigmatica:steel_plate' },
                I: { item: 'jaept:machine_frame_pity' },
                J: { item: 'immersiveengineering:ingot_hop_graphite' }
            },
            altar_type: 3,
            duration: 400,
            starlight: 5000,
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:built_in_effect_trait_relay_highlight',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_trait_focus_circle',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/common_black_hole_unit`
        },
        {
            output: Item.of('industrialforegoing:common_black_hole_tank'),
            pattern: ['AABAA', 'ACDCA', 'EFGFE', 'HCICH', 'HHJHH'],
            key: {
                A: { tag: 'forge:plates/stainless_steel' },
                B: { item: 'occultism:otherstone_frame' },
                C: { item: 'immersiveengineering:electron_tube' },
                D: { item: 'create:item_drain' },
                E: { item: 'thermal:cured_rubber' },
                F: { item: 'immersiveengineering:fluid_pipe' },
                G: { item: 'immersiveengineering:metal_barrel' },
                H: { item: 'emendatusenigmatica:steel_plate' },
                I: { item: 'jaept:machine_frame_pity' },
                J: { item: 'immersiveengineering:ingot_hop_graphite' }
            },
            altar_type: 3,
            duration: 400,
            starlight: 5000,
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:built_in_effect_trait_relay_highlight',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_trait_focus_circle',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/common_black_hole_tank`
        },
        {
            output: Item.of('botania:fertilizer', 16),
            pattern: ['ABABA', 'BACAB', 'ACDCA', 'BACAB', 'ABABA'],
            key: {
                A: { item: 'minecraft:bone_meal' },
                B: { tag: 'forge:dyes' },
                C: { item: 'bloodmagic:reagentgrowth' },
                D: { item: 'atum:fertile_soil' }
            },
            focus_constellation: 'astralsorcery:aevitas',
            altar_type: 3,
            duration: 600,
            starlight: 6500,
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:built_in_effect_trait_relay_highlight',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_trait_focus_circle',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/fertilizer`
        },
        {
            output: Item.of('kubejs:dielectric_frame'),
            pattern: ['ABCBA', 'B___B', 'D___D', 'B___B', 'ABCBA'],
            key: {
                A: { tag: 'forge:sheetmetals/stainless_steel' },
                B: { item: 'jaept:dark_dough' },
                C: { item: 'powah:dielectric_rod_horizontal' },
                D: { item: 'powah:dielectric_rod' },
            },
            altar_type: 3,
            duration: 200,
            starlight: 5000,
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:built_in_effect_trait_relay_highlight',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_trait_focus_circle',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/dielectric_frame`
        },
        {
            output: Item.of('powah:capacitor_basic', 2),
            pattern: ['___A_', '__BCA', '_BDB_', 'ACB__', '_A___'],
            key: {
                A: { item: 'powah:dielectric_paste' },
                B: { item: 'industrialforegoing:plastic' },
                C: { item: 'immersiveengineering:wirecoil_steel' },
                D: { item: 'createaddition:capacitor' }
            },
            altar_type: 3,
            duration: 120,
            starlight: 5000,
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:built_in_effect_trait_relay_highlight',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_trait_focus_circle',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/capacitor_basic`
        },
        {
            output: Item.of('powah:battery_starter'),
            pattern: ['_ABA_', 'ABCBA', 'BCDCB', 'ABCBA', 'AABAA'],
            key: {
                A: { item: 'powah:dielectric_paste' },
                B: { item: 'powah:capacitor_basic_tiny' },
                C: { item: 'immersiveengineering:ingot_hop_graphite' },
                D: { item: 'immersiveengineering:capacitor_lv' }
            },
            altar_type: 3,
            duration: 200,
            starlight: 5000,
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:built_in_effect_trait_relay_highlight',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_trait_focus_circle',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/battery_starter`
        },
        {
            output: Item.of('botania:brewery'),
            pattern: ['ABCBA', '__B__', '_DED_', '__B__', 'ABFBA'],
            key: {
                A: { item: 'botania:mana_powder' },
                B: { item: 'botania:livingrock' },
                C: { tag: 'forge:storage_blocks/holy' },
                D: { item: 'botania:manasteel_ingot' },
                E: Ingredient.customNBT('rftoolspower:blazing_rod', (tag) => {
                    return (tag.time <= 0);
                }).toJson(),
                F: { item: 'botania:rune_mana' }
            },
            relay_inputs: [
                { item: 'botania:livingrock_slab' },
                { item: 'botania:livingrock_slab' },
                { item: 'botania:livingrock_slab' },
                { item: 'botania:livingrock_slab' },
                { item: 'botania:livingrock_slab' },
                { item: 'botania:livingrock_slab' }
            ],
            altar_type: 3,
            duration: 400,
            starlight: 6000,
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:built_in_effect_trait_relay_highlight',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_trait_focus_circle',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/brewery`
        },
        {
            output: Item.of('appliedenergistics2:spatial_pylon'),
            pattern: ['ABABA', 'BCDCB', 'ADEDA', 'BCDCB', 'ABABA'],
            key: {
                A: { tag: 'forge:rods/stainless_steel' },
                B: { item: 'appliedenergistics2:quartz_glass' },
                C: { item: 'appliedenergistics2:fluix_glass_cable' },
                D: { item: 'emendatusenigmatica:fluix_dust' },
                E: { item: 'rftoolsbase:infused_enderpearl' }
            },
            altar_type: 3,
            duration: 100,
            starlight: 5000,
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:built_in_effect_trait_relay_highlight',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_trait_focus_circle',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/spatial_pylon`
        },
        {
            output: Item.of('4x appliedenergistics2:controller'),
            pattern: ['ABCBA', 'BDEDB', 'CEFEC', 'BDEDB', 'ABCBA'],
            key: {
                A: { tag: 'forge:storage_blocks/stainless_steel' },
                B: { item: 'appliedenergistics2:fluix_smart_dense_cable' },
                C: { item: 'integrateddynamics:logic_director' },
                D: { item: 'appliedenergistics2:engineering_processor' },
                E: { item: 'kubejs:smart_circuit' },
                F: { item: 'appliedenergistics2:dense_energy_cell' }
            },
            altar_type: 3,
            duration: 400,
            starlight: 5000,
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:built_in_effect_trait_relay_highlight',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_trait_focus_circle',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/controller`
        },
        {
            output: Item.of('lazierae2:logic_unit'),
            pattern: ['_ABA_', 'ACDCA', 'EFGFE', 'HEDEH', 'H_H_H'],
            key: {
                A: { item: 'appliedenergistics2:quartz_vibrant_glass' },
                B: { item: 'botania:quartz_lavender' },
                C: { item: 'botania:lavender_quartz' },
                D: { item: 'lazierae2:parallel_processor' },
                E: { tag: 'forge:plates/fluix_steel' },
                F: { item: 'appliedenergistics2:logic_processor' },
                G: { item: 'kubejs:smart_circuit' },
                H: { tag: 'forge:rods/stainless_steel' }
            },
            altar_type: 3,
            duration: 200,
            starlight: 5000,
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:built_in_effect_trait_relay_highlight',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_trait_focus_circle',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/logic_unit`
        },
        {
            output: Item.of('botania:natura_pylon'),
            pattern: ['ABCBA', 'BDEDB', 'CEFEC', 'BDEDB', 'ABCBA'],
            key: {
                A: { item: 'botania:glimmering_livingwood' },
                B: { item: 'naturesaura:infused_iron_block' },
                C: { item: 'botania:terrasteel_ingot' },
                D: { item: 'twilightforest:naga_scale' },
                E: { item: 'astralsorcery:colored_lens_growth' },
                F: { item: 'botania:mana_pylon' }
            },
            focus_constellation: 'naturesstarlight:naritis',
            altar_type: 3,
            duration: 800,
            starlight: 6500,
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:built_in_effect_trait_relay_highlight',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_trait_focus_circle',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/natura_pylon`
        },
        {
            output: Item.of('appliedenergistics2:quantum_ring'),
            pattern: ['ABCBA', 'BDEDB', 'FGHGF', 'BDEDB', 'ABCBA'],
            key: {
                A: { item: 'botania:black_pavement' },
                B: { tag: 'forge:rods/dimension' },
                C: { item: 'thermal:netherite_gear' },
                D: { item: 'appliedenergistics2:fluix_smart_cable' },
                E: { item: 'appliedenergistics2:engineering_processor' },
                F: { tag: 'forge:gears/fluix_steel' },
                G: { item: 'appliedenergistics2:logic_processor' },
                H: { item: 'appliedenergistics2:energy_cell' }
            },
            altar_type: 3,
            duration: 400,
            starlight: 5000,
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:built_in_effect_trait_relay_highlight',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_trait_focus_circle',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/quantum_ring`
        }
    ];

    recipes.forEach((recipe) => {
        let constructed_recipe = {
            type: 'astralsorcery:altar',
            altar_type: recipe.altar_type,
            duration: recipe.duration,
            starlight: recipe.starlight,
            pattern: recipe.pattern,
            key: recipe.key,
            output: [recipe.output.toResultJson()],
            effects: recipe.effects
        };

        if (recipe.relay_inputs) {
            constructed_recipe.relay_inputs = recipe.relay_inputs;
        }
        if (recipe.focus_constellation) {
            constructed_recipe.focus_constellation = recipe.focus_constellation;
        }
        if (recipe.recipe_class) {
            constructed_recipe.recipe_class = recipe.recipe_class;
        }

        event.custom(constructed_recipe).id(recipe.id);
    });
});