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: { item: 'kubejs:hop_graphite_rod' },
                C: { item: 'compactmachines:wall' },
                D: { item: 'kubejs:stainless_steel_block' }
            },
            relay_inputs: [
                { item: 'immersivepetroleum:petcoke_dust' },
                { item: 'emendatusenigmatica:obsidian_dust' },
                { item: 'immersivepetroleum:petcoke_dust' },
                { item: 'emendatusenigmatica:obsidian_dust' },
                { item: 'immersivepetroleum:petcoke_dust' },
                { item: 'emendatusenigmatica:obsidian_dust' },
                { item: 'immersivepetroleum:petcoke_dust' },
                { item: 'emendatusenigmatica:obsidian_dust' },
            ],
            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: '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: 'create:refined_radiance' },
                D: { item: 'astralsorcery:glass_lens' },
                E: { item: 'immersiveengineering:electron_tube' },
                F: { item: 'create:shadow_steel' }
            },
            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: 'projector_dish'
        },
        {
            output: Item.of('immersiveengineering:capacitor_hv', 1),
            pattern: ['ABCBA', 'BDEDB', 'FGEGF', 'BDEDB', 'HBHBH'],
            key: {
                A: { item: 'immersiveengineering:component_steel' },
                B: { item: 'kubejs:stainless_steel_rod' },
                C: { item: 'immersiveengineering:component_iron' },
                D: { item: 'kubejs:titanium_ingot' },
                E: { item: 'immersiveengineering:coil_hv' },
                F: { item: 'emendatusenigmatica:steel_gear' },
                G: { item: 'astralsorcery:resonating_gem' },
                H: { item: 'create:electron_tube' }
            },
            relay_inputs: [
                { item: 'immersiveengineering:treated_wood_horizontal' },
                { item: 'astralsorcery:infused_wood_infused' },
                { item: 'immersiveengineering:treated_wood_horizontal' },
                { item: 'astralsorcery:infused_wood_infused' },
                { item: 'immersiveengineering:treated_wood_horizontal' },
                { item: 'astralsorcery:infused_wood_infused' },
                { item: 'immersiveengineering:treated_wood_horizontal' },
                { item: 'astralsorcery:infused_wood_infused' }
            ],
            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: 'capacitor_hv'
        },
        {
            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' },
                { item: 'kubejs:holy_gear' },
                { item: 'astralsorcery:perk_gem_night' },
                { item: 'astralsorcery:perk_gem_night' },
                { item: 'kubejs:holy_gear' }
            ],
            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: '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: '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:stardust' },
                C: { item: 'eidolon:wicked_weave' },
                D: { item: 'alexsmobs:void_worm_eye' },
                E: { item: 'thermal:netherite_dust' },
                F: { item: 'kubejs:hop_graphite_rod' }
            },
            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: 'dimensional_carver'
        },
        {
            output: Item.of('jaept:machine_frame_pity'),
            pattern: ['ABCBA', 'BDEDB', 'CFGFC', 'BDEDB', 'ABCBA'],
            key: {
                A: Item.of('tconstruct:large_plate', '{Material:"tconstruct:wood"}').toJson(),
                B: { item: 'minecraft:cobblestone' },
                C: { item: 'immersiveengineering:ingot_hop_graphite' },
                D: { item: 'engineersdecor:metal_bar' },
                E: { item: 'create:refined_radiance_casing' },
                F: { item: 'kubejs:stainless_steel_gear' },
                G: { item: 'immersiveengineering:rs_engineering' }
            },
            focus_constellation: 'astralsorcery:mineralis',
            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: 'machine_frame_pity'
        },
        {
            output: Item.of('industrialforegoing:common_black_hole_unit'),
            pattern: ['AABAA', 'ACDCA', 'EFGFE', 'HCICH', 'HHJHH'],
            key: {
                A: { item: 'kubejs:stainless_steel_plate' },
                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: 'common_black_hole_unit'
        },
        {
            output: Item.of('industrialforegoing:common_black_hole_tank'),
            pattern: ['AABAA', 'ACDCA', 'EFGFE', 'HCICH', 'HHJHH'],
            key: {
                A: { item: 'kubejs:stainless_steel_plate' },
                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: '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: 'fertilizer'
        },
        {
            output: Item.of('kubejs:dielectric_frame'),
            pattern: ['ABCBA', 'B___B', 'D_E_D', 'B___B', 'ABCBA'],
            key: {
                A: { item: 'kubejs:stainless_steel_sheetmetal' },
                B: { item: 'jaept:dark_dough' },
                C: { item: 'powah:dielectric_rod_horizontal' },
                D: { item: 'powah:dielectric_rod' },
                E: { item: 'tconstruct:manyullyn_item_frame' }
            },
            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: '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: '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: 'battery_starter'
        },
        {
            output: Item.of('botania:brewery'),
            pattern: ['ABCBA', '__B__', '_DED_', '__B__', 'ABFBA'],
            key: {
                A: { item: 'botania:mana_powder' },
                B: { item: 'botania:livingrock' },
                C: { item: 'kubejs:holy_block' },
                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: 'brewery'
        },
        {
            output: Item.of('appliedenergistics2:spatial_pylon'),
            pattern: ['ABABA', 'BCDCB', 'ADEDA', 'BCDCB', 'ABABA'],
            key: {
                A: { item: 'kubejs:stainless_steel_rod' },
                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: 'spatial_pylon'
        },
        {
            output: Item.of('4x appliedenergistics2:controller'),
            pattern: ['ABCBA', 'BDEDB', 'CEFEC', 'BDEDB', 'ABCBA'],
            key: {
                A: { item: 'kubejs:stainless_steel_block' },
                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: 'controller'
        }
    ];

    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(`${id_prefix}/${recipe.id}`);
    });
});