onEvent('recipes', (event) => {

    const id_prefix = 'astralsorcery:kubejs/altar';
    const recipes = [
        {
            output: Item.of('2x astralsorcery:parchment'),
            pattern: ['_____', '_ABA_', '_BCB_', '_ABA_', '_____'],
            key: {
                A: { item: 'farmersdelight:canvas' },
                B: { item: 'atum:papyrus_plant' },
                C: { item: 'astralsorcery:aquamarine' }
            },
            altar_type: 0,
            duration: 20,
            starlight: 50,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: 'astralsorcery:altar/parchment'
        },
        {
            output: Item.of('8x astralsorcery:marble_arch'),
            pattern: ['_____', '_AAA_', '_BBB_', '_AAA_', '_____'],
            key: {
                A: { item: 'astralsorcery:marble_raw' },
                B: { tag: 'forge:nuggets/holy' }
            },
            altar_type: 0,
            duration: 20,
            starlight: 50,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: 'astralsorcery:altar/marble_arch'
        },
        {
            output: Item.of('8x astralsorcery:marble_chiseled'),
            pattern: ['_____', '_ABA_', '_BAB_', '_ABA_', '_____'],
            key: {
                A: { item: 'astralsorcery:marble_raw' },
                B: { tag: 'forge:nuggets/holy' }
            },
            altar_type: 0,
            duration: 20,
            starlight: 50,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: 'astralsorcery:altar/marble_chiseled'
        },
        {
            output: Item.of('2x astralsorcery:marble_pillar'),
            pattern: ['_____', '__A__', '__A__', '_____', '_____'],
            key: {
                A: { item: 'astralsorcery:marble_chiseled' }
            },
            altar_type: 0,
            duration: 20,
            starlight: 50,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: 'astralsorcery:altar/marble_pillar'
        },
        {
            output: Item.of('8x astralsorcery:marble_engraved'),
            pattern: ['_____', '_ABA_', '_BAB_', '_ABA_', '_____'],
            key: {
                B: { item: 'astralsorcery:marble_raw' },
                A: { tag: 'forge:nuggets/holy' }
            },
            altar_type: 0,
            duration: 20,
            starlight: 50,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: 'astralsorcery:altar/marble_engraved'
        },
        {
            output: Item.of('8x astralsorcery:marble_runed'),
            pattern: ['_____', '_AAA_', '_BCB_', '_AAA_', '_____'],
            key: {
                A: { item: 'astralsorcery:marble_raw' },
                B: { tag: 'forge:nuggets/holy' },
                C: { item: 'astralsorcery:nocturnal_powder' }
            },
            altar_type: 0,
            duration: 30,
            starlight: 50,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: 'astralsorcery:altar/marble_runed'
        },
        {
            output: Item.of('4x astralsorcery:illumination_powder'),
            pattern: ['_____', '_ADA_', '_DBD_', '_ADA_', '_____'],
            key: {
                A: { item: 'emendatusenigmatica:lumium_dust' },
                B: {
                    type: 'astralsorcery:crystal',
                    hasToBeAttuned: false,
                    hasToBeCelestial: false,
                    canBeAttuned: false,
                    canBeCelestialCrystal: true
                },
                D: { item: 'occultism:otherworld_ashes' }
            },
            altar_type: 0,
            duration: 40,
            starlight: 400,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: 'astralsorcery:altar/illumination_powder'
        },
        {
            output: Item.of('8x astralsorcery:illumination_powder'),
            pattern: ['_____', '_ADA_', '_DBD_', '_ADA_', '_____'],
            key: {
                A: { item: 'emendatusenigmatica:lumium_dust' },
                B: {
                    type: 'astralsorcery:crystal',
                    hasToBeAttuned: true,
                    hasToBeCelestial: false,
                    canBeAttuned: true,
                    canBeCelestialCrystal: true
                },
                D: { item: 'occultism:otherworld_ashes' }
            },
            altar_type: 0,
            duration: 80,
            starlight: 800,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: `${id_prefix}/illumination_powder_attuned`
        },
        {
            output: Item.of('4x astralsorcery:nocturnal_powder'),
            pattern: ['_____', '_ACA_', '_CBC_', '_ACA_', '_____'],
            key: {
                A: { item: 'eidolon:death_essence' },
                B: { item: 'occultism:burnt_otherstone' },
                C: { item: 'kubejs:bloodslate_dust' },
            },
            altar_type: 0,
            duration: 40,
            starlight: 400,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: 'astralsorcery:altar/nocturnal_powder'
        },
        {
            output: Item.of('occultism:golden_sacrificial_bowl'),
            pattern: ['_____', '_ACA_', '_CBC_', '_ACA_', '_____'],
            key: {
                A: { item: 'emendatusenigmatica:electrum_dust' },
                B: { item: 'occultism:sacrificial_bowl' },
                C: { item: 'jaept:dark_dough' }
            },
            altar_type: 0,
            duration: 80,
            starlight: 200,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: `${id_prefix}/golden_sacrificial_bowl`
        },
        {
            output: Item.of('apotheosis:hellshelf'),
            pattern: ['_____', '_AEA_', '_CBD_', '_AEA_', '_____'],
            key: {
                A: { tag: 'forge:treated_wood' },
                B: { item: 'apotheosis:seashelf' },
                C: { item: 'tconstruct:netherite_item_frame' },
                D: { item: 'occultism:purified_ink' },
                E: { item: 'emendatusenigmatica:steel_plate' }
            },
            altar_type: 0,
            duration: 80,
            starlight: 200,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: `${id_prefix}/hellshelf`
        },
        {
            output: Item.of('mininggadgets:upgrade_empty'),
            pattern: ['_____', '_ACA_', '_CBC_', '_ACA_', '_____'],
            key: {
                A: { item: 'immersiveengineering:wire_steel' },
                B: Item.of('tconstruct:large_plate', '{Material:"tconstruct:invar"}').toJson(),
                C: { item: 'occultism:burnt_otherstone' }
            },
            altar_type: 0,
            duration: 40,
            starlight: 200,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: `${id_prefix}/upgrade_empty`
        },
        {
            output: Item.of('sophisticatedbackpacks:upgrade_base'),
            pattern: ['_____', '_ACA_', '_CBC_', '_ACA_', '_____'],
            key: {
                A: { item: 'emendatusenigmatica:electrum_rod' },
                B: { item: 'kubejs:linen_leather' },
                C: { item: 'jaept:scarlet_rope' }
            },
            altar_type: 0,
            duration: 40,
            starlight: 200,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: `${id_prefix}/upgrade_base`
        },
        {
            output: Item.of('jaopca:gears.holy'),
            pattern: ['_____', '_ACA_', '_CBC_', '_ACA_', '_____'],
            key: {
                A: { tag: 'forge:rods/holy' },
                B: { item: 'emendatusenigmatica:silver_gear' },
                C: { tag: 'forge:plates/holy' }
            },
            altar_type: 0,
            duration: 80,
            starlight: 400,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: `${id_prefix}/holy_gear`
        },
        {
            output: Item.of('astralsorcery:altar_attunement'),
            pattern: ['_____', '_ABA_', '_CFC_', '_EDE_', '_____'],
            key: {
                A: { item: 'immersiveengineering:circuit_board' },
                B: { item: 'mininggadgets:upgrade_range_1' },
                C: {
                    type: 'astralsorcery:fluid',
                    fluid: [{ fluid: 'astralsorcery:liquid_starlight', amount: 1000 }]
                },
                D: { item: 'immersiveengineering:steel_scaffolding_standard' },
                E: { item: 'astralsorcery:marble_slab' },
                F: { tag: 'forge:gears/holy' }
            },
            altar_type: 0,
            duration: 200,
            starlight: 500,
            recipe_class: 'astralsorcery:attunement_upgrade',
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam', 
                'astralsorcery:upgrade_altar'
            ],
            id: 'astralsorcery:altar/altar_attunement'
        }
    ];

    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);
    });
});
