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

    Celestial Altar
    altar_type: 2
    max_starlight: 4000
    */

    const id_prefix = 'astralsorcery:kubejs/altar';
    const recipes = [
        {
            output: Item.of('immersiveengineering:heavy_engineering', 1),
            pattern: ['AB_BA', 'BCDEB', '_DFD_', 'BGDCB', 'AB_BA'],
            key: {
                A: { item: 'immersiveengineering:steel_scaffolding_standard' },
                B: { item: 'emendatusenigmatica:iron_rod' },
                C: { item: 'immersiveengineering:wirecoil_steel' },
                D: { item: 'immersiveengineering:component_steel' },
                E: { item: 'create:shadow_steel' },
                F: { item: 'immersiveengineering:sheetmetal_steel' },
                G: { item: 'emendatusenigmatica:gold_gear' }
            },
            altar_type: 2,
            duration: 80,
            starlight: 2000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:gateway_edge',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'heavy_engineering'
        },
        {
            output: Item.of('immersiveengineering:blastfurnace_preheater', 2),
            pattern: ['_A_A_', '_BCB_', '_D_D_', '_BEB_', 'FG_GH'],
            key: {
                A: { item: 'immersiveengineering:slab_sheetmetal_iron' },
                B: { item: 'immersiveengineering:sheetmetal_iron' },
                C: { item: 'immersiveengineering:wirecoil_electrum' },
                D: { item: 'emendatusenigmatica:signalum_plate' },
                E: { item: 'immersiveengineering:furnace_heater' },
                F: { item: 'immersiveengineering:fluid_pipe' },
                G: { item: 'bloodmagic:reagentair' },
                H: { item: 'create:encased_fan' }
            },
            altar_type: 2,
            duration: 100,
            starlight: 2000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:gateway_edge',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'blastfurnace_preheater'
        },
        {
            output: Item.of('minecraft:beacon', 1),
            pattern: ['AA_AA', 'ABCBA', '_CDC_', 'ABCBA', 'AE_EA'],
            key: {
                A: { item: 'engineersdecor:panzerglass_block' },
                B: { item: 'bloodmagic:corrupted_dust' },
                C: { item: 'kubejs:holy_block' },
                D: { item: 'create:refined_radiance_casing' },
                E: { item: 'astralsorcery:black_marble_slab' }
            },
            altar_type: 2,
            duration: 160,
            starlight: 2800,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:gateway_edge',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'beacon'
        },
        {
            output: Item.of('astralsorcery:colored_lens_spectral', 1),
            pattern: ['AB_BA', 'B_C_B', '_DED_', 'B_C_B', 'FB_BF'],
            key: {
                A: {
                    type: 'astralsorcery:fluid',
                    fluid: [{ fluid: 'kubejs:otherworld_plantoil', amount: 1000 }]
                },
                B: { item: 'tconstruct:ender_slime_crystal' },
                C: { item: 'occultism:spirit_attuned_gem' },
                D: { item: 'bloodmagic:reagentvoid' },
                E: { item: 'astralsorcery:glass_lens' },
                F: { item: 'integratedterminals:chorus_glass' },
            },
            altar_type: 2,
            duration: 80,
            starlight: 3000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:gateway_edge',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'colored_lens_spectral'
        },
        {
            output: Item.of('astralsorcery:colored_lens_break', 1),
            pattern: ['AB_BA', 'B_C_B', '_DED_', 'B_C_B', 'FB_BF'],
            key: {
                A: {
                    type: 'astralsorcery:fluid',
                    fluid: [{ fluid: 'immersiveengineering:herbicide', amount: 1000 }]
                },
                B: { item: 'bloodmagic:destructivecrystal' },
                C: { item: 'emendatusenigmatica:sulfur_gem' },
                D: { item: 'bloodmagic:reagentfastminer' },
                E: { item: 'astralsorcery:glass_lens' },
                F: { item: 'atum:ceramic_yellow' },
            },
            altar_type: 2,
            duration: 80,
            starlight: 3000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:gateway_edge',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'colored_lens_break'
        },
        {
            output: Item.of('astralsorcery:colored_lens_fire', 1),
            pattern: ['AB_BA', 'B_C_B', '_DED_', 'B_C_B', 'FB_BF'],
            key: {
                A: {
                    type: 'astralsorcery:fluid',
                    fluid: [{ fluid: 'immersiveengineering:biodiesel', amount: 1000 }]
                },
                B: { item: 'tconstruct:blazing_bone' },
                C: { item: 'atum:geb_godshard' },
                D: { item: 'bloodmagic:reagentlava' },
                E: { item: 'astralsorcery:glass_lens' },
                F: { item: 'emendatusenigmatica:coke_block' },
            },
            altar_type: 2,
            duration: 80,
            starlight: 3000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:gateway_edge',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'colored_lens_fire'
        },
        {
            output: Item.of('astralsorcery:colored_lens_damage', 1),
            pattern: ['AB_BA', 'B_C_B', '_DED_', 'B_C_B', 'FB_BF'],
            key: {
                A: {
                    type: 'astralsorcery:fluid',
                    fluid: [{ fluid: 'bloodmagic:life_essence_fluid', amount: 1000 }]
                },
                B: { item: 'bloodmagic:vengefulcrystal' },
                C: { item: 'kubejs:scarlet_gem' },
                D: { item: 'immersiveengineering:buckshot' },
                E: { item: 'astralsorcery:glass_lens' },
                F: { item: 'immersiveengineering:gunpowder_barrel' },
            },
            altar_type: 2,
            duration: 80,
            starlight: 3000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:gateway_edge',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'colored_lens_damage'
        },
        {
            output: Item.of('astralsorcery:colored_lens_growth', 1),
            pattern: ['AB_BA', 'B_C_B', '_DED_', 'B_C_B', 'FB_BF'],
            key: {
                A: {
                    type: 'astralsorcery:fluid',
                    fluid: [{ fluid: 'mob_grinding_utils:fluid_xp', amount: 1000 }]
                },
                B: { item: 'tconstruct:earth_slime_crystal' },
                C: { item: 'atum:osiris_godshard' },
                D: { item: 'bloodmagic:reagentgrowth' },
                E: { item: 'astralsorcery:glass_lens' },
                F: { item: 'immersiveengineering:insulating_glass' },
            },
            altar_type: 2,
            duration: 80,
            starlight: 3000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:gateway_edge',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'colored_lens_growth'
        },
        {
            output: Item.of('astralsorcery:colored_lens_regeneration', 1),
            pattern: ['AB_BA', 'B_C_B', '_DED_', 'B_C_B', 'FB_BF'],
            key: {
                A: Item.of('minecraft:potion', '{Potion:"minecraft:long_regeneration"}').toJson(),
                B: { item: 'create:polished_rose_quartz' },
                C: { item: 'atum:isis_godshard' },
                D: { item: 'byg:ametrine_gems' },
                E: { item: 'astralsorcery:glass_lens' },
                F: { item: 'atum:ceramic_pink' },
            },
            altar_type: 2,
            duration: 80,
            starlight: 3000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:gateway_edge',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'colored_lens_regeneration'
        },
        {
            output: Item.of('astralsorcery:colored_lens_push', 1),
            pattern: ['AB_BA', 'B_C_B', '_DED_', 'B_C_B', 'FB_BF'],
            key: {
                A: {
                    type: 'astralsorcery:fluid',
                    fluid: [{ fluid: 'tconstruct:sky_slime', amount: 1000 }]
                },
                B: { item: 'bloodmagic:steadfastcrystal' },
                C: Item.of('jaept:overcharged_alloy', '{Energy:100000}').toJson(),
                D: { item: 'bloodmagic:reagentair' },
                E: { item: 'astralsorcery:glass_lens' },
                F: { item: 'integrateddynamics:crystalized_menril_block' },
            },
            altar_type: 2,
            duration: 80,
            starlight: 3000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:gateway_edge',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'colored_lens_push'
        },
        {
            output: Item.of('astralsorcery:rock_collector_crystal', 1),
            pattern: ['AB_BA', 'C_D_C', '_EFH_', 'C_D_C', 'GB_BG'],
            key: {
                A: {
                    type: 'astralsorcery:fluid',
                    fluid: [{ fluid: 'kubejs:industrial_adhesives', amount: 1000 }]
                },
                B: { item: 'astralsorcery:illumination_powder' },
                C: { item: 'kubejs:holy_dust' },
                D: { item: 'create:refined_radiance' },
                H: { item: 'astralsorcery:perk_gem_night' },
                E: {
                    type: 'astralsorcery:crystal',
                    hasToBeAttuned: true,
                    hasToBeCelestial: false,
                    canBeAttuned: false,
                    canBeCelestialCrystal: false
                },
                F: { item: 'occultism:dimensional_matrix' },
                G: { item: 'astralsorcery:glass_lens' }
            },
            altar_type: 2,
            duration: 400,
            starlight: 3500,
            recipe_class: 'astralsorcery:constellation_copy_stats',
            options: { constellationSlot: 11 },
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'rock_collector_crystal'
        },
        {
            output: Item.of('astralsorcery:celestial_collector_crystal', 1),
            pattern: ['AB_BA', 'C_D_C', '_EFH_', 'C_D_C', 'GB_BG'],
            key: {
                A: {
                    type: 'astralsorcery:fluid',
                    fluid: [{ fluid: 'kubejs:industrial_adhesives', amount: 1000 }]
                },
                B: { item: 'astralsorcery:nocturnal_powder' },
                C: { item: 'astralsorcery:resonating_gem' },
                D: { item: 'astralsorcery:starmetal_ingot' },
                H: { item: 'astralsorcery:perk_gem_sky' },
                E: {
                    type: 'astralsorcery:crystal',
                    hasToBeAttuned: true,
                    hasToBeCelestial: true,
                    canBeAttuned: false,
                    canBeCelestialCrystal: false
                },
                F: { item: 'occultism:dimensional_matrix' },
                G: { item: 'astralsorcery:colored_lens_push' }
            },
            altar_type: 2,
            duration: 400,
            starlight: 3500,
            recipe_class: 'astralsorcery:constellation_copy_stats',
            options: { constellationSlot: 11 },
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'celestial_collector_crystal'
        },
        {
            output: Item.of('astralsorcery:celestial_gateway'),
            pattern: ['A___A', '_BCB_', '_CDC_', 'EFGFE', '_E_E_'],
            key: {
                A: { item: 'astralsorcery:stardust' },
                B: { item: 'astralsorcery:nocturnal_powder' },
                C: { item: 'mob_grinding_utils:tinted_glass' },
                D: {
                    type: 'astralsorcery:crystal',
                    hasToBeAttuned: true,
                    hasToBeCelestial: false,
                    canBeAttuned: false,
                    canBeCelestialCrystal: true
                },
                E: { item: 'emendatusenigmatica:brass_plate' },
                F: { item: 'astralsorcery:marble_runed' },
                G: { item: 'pedestals:coin/teleporter' }
            },
            altar_type: 2,
            duration: 200,
            starlight: 3000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:gateway_edge',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'celestial_gateway'
        },
        {
            output: Item.of('astralsorcery:infuser', 1),
            pattern: ['AB_BA', 'CADAC', '_EFE_', 'GHIHG', 'HJ_JH'],
            key: {
                A: { item: 'emendatusenigmatica:lumium_plate' },
                B: { item: 'astralsorcery:stardust' },
                C: { item: 'astralsorcery:glass_lens' },
                D: { item: 'immersiveengineering:ingot_hop_graphite' },
                E: { item: 'astralsorcery:infused_wood_column' },
                F: { item: 'pedestals:pedestal/stone333' },
                G: { item: 'astralsorcery:marble_pillar' },
                H: { item: 'atum:nebu_ingot' },
                I: { item: 'bloodmagic:sigilofsuppression' },
                J: { item: 'immersiveengineering:slab_sheetmetal_electrum' },
            },
            altar_type: 2,
            duration: 240,
            starlight: 3500,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:gateway_edge',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'infuser'
        },
        {
            output: Item.of('astralsorcery:enchantment_amulet'),
            pattern: ['A___A', '_BCB_', '_DED_', 'A_F_A', '_A_A_'],
            key: {
                A: { item: 'astralsorcery:stardust' },
                B: { item: 'atum:relic_gold_brooch' },
                C: { item: 'immersiveengineering:wire_aluminum' },
                D: { item: 'occultism:spirit_attuned_gem' },
                E: { item: 'astralsorcery:shifting_star' },
                F: { item: 'astralsorcery:perk_gem_sky' }
            },
            altar_type: 2,
            duration: 100,
            starlight: 3500,
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'enchantment_amulet'
        },
        {
            output: Item.of('astralsorcery:altar_radiance', 1),
            pattern: ['FB_BF', 'CFDFC', '_EAG_', 'HIJIH', 'KK_KK'],
            key: {
                A: {
                    type: 'astralsorcery:crystal',
                    hasToBeAttuned: false,
                    hasToBeCelestial: true,
                    canBeAttuned: true,
                    canBeCelestialCrystal: true
                },
                B: { item: 'astralsorcery:resonating_gem' },
                C: { item: 'bloodmagic:etherealslate' },
                D: { item: 'draconicevolution:dragon_heart' },
                E: { item: 'astralsorcery:infused_glass' },
                F: { item: 'create:refined_radiance' },
                G: { item: 'immersiveengineering:heavy_engineering' },
                H: { item: 'astralsorcery:marble_runed' },
                I: {
                    type: 'astralsorcery:fluid',
                    fluid: [{ fluid: 'immersivepetroleum:lubricant', amount: 1000 }]
                },
                J: { item: 'astralsorcery:starmetal' },
                K: { item: 'immersivepetroleum:petcoke_block' }
            },
            altar_type: 2,
            duration: 400,
            starlight: 3500,
            recipe_class: 'astralsorcery:trait_upgrade',
            effects: [
                'astralsorcery:built_in_effect_constellation_finish',
                'astralsorcery:pillar_sparkle',
                'astralsorcery:luminescence_flare',
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:upgrade_altar',
                'astralsorcery:altar_default_sparkle',
                'astralsorcery:built_in_effect_constellation_lines',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'altar_radiance'
        }
    ];

    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;
        }
        if (recipe.options) {
            constructed_recipe.options = recipe.options;
        }

        event.custom(constructed_recipe).id(`${id_prefix}/${recipe.id}`);
    });
});