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

    const id_prefix = 'astralsorcery:kubejs/altar';
    const recipes = [
        {
            output: Item.of('8x astralsorcery:marble_arch'),
            pattern: ['_____', '_AAA_', '_BBB_', '_AAA_', '_____'],
            key: {
                A: { item: 'astralsorcery:marble_raw' },
                B: { item: 'kubejs:holy_nugget' }
            },
            altar_type: 0,
            duration: 20,
            starlight: 50,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: 'marble_arch'
        },
        {
            output: Item.of('8x astralsorcery:marble_chiseled'),
            pattern: ['_____', '_ABA_', '_BAB_', '_ABA_', '_____'],
            key: {
                A: { item: 'astralsorcery:marble_raw' },
                B: { item: 'kubejs:holy_nugget' }
            },
            altar_type: 0,
            duration: 20,
            starlight: 50,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: '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: 'marble_pillar'
        },
        {
            output: Item.of('8x astralsorcery:marble_engraved'),
            pattern: ['_____', '_ABA_', '_BAB_', '_ABA_', '_____'],
            key: {
                B: { item: 'astralsorcery:marble_raw' },
                A: { item: 'kubejs:holy_nugget' }
            },
            altar_type: 0,
            duration: 20,
            starlight: 50,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: 'marble_engraved'
        },
        {
            output: Item.of('8x astralsorcery:marble_runed'),
            pattern: ['_____', '_AAA_', '_BCB_', '_AAA_', '_____'],
            key: {
                A: { item: 'astralsorcery:marble_raw' },
                B: { item: 'kubejs:holy_nugget' },
                C: { item: 'astralsorcery:nocturnal_powder' }
            },
            altar_type: 0,
            duration: 30,
            starlight: 50,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: '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: '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: '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: 'nocturnal_powder'
        },
        {
            output: Item.of('immersiveengineering:steel_scaffolding_standard'),
            pattern: ['_____', '_ACA_', '_CBC_', '_ACA_', '_____'],
            key: {
                A: { item: 'immersiveengineering:steel_wallmount' },
                B: { item: 'immersiveengineering:treated_scaffold' },
                C: { item: 'immersiveengineering:steel_fence' }
            },
            altar_type: 0,
            duration: 80,
            starlight: 200,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: 'steel_scaffolding'
        },
        {
            output: Item.of('immersiveengineering:alu_scaffolding_standard'),
            pattern: ['_____', '_ACA_', '_CBC_', '_ACA_', '_____'],
            key: {
                A: { item: 'immersiveengineering:alu_wallmount' },
                B: { item: 'immersiveengineering:treated_scaffold' },
                C: { item: 'immersiveengineering:alu_fence' }
            },
            altar_type: 0,
            duration: 80,
            starlight: 200,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: 'alu_scaffolding'
        },
        {
            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: 'golden_sacrificial_bowl'
        },
        {
            output: Item.of('mininggadgets:upgrade_empty'),
            pattern: ['_____', '_ACA_', '_CBC_', '_ACA_', '_____'],
            key: {
                A: { item: 'immersiveengineering:wire_steel' },
                B: Item.of('tconstruct:large_plate', '{Material:"tconstruct:osmium"}').toJson(),
                C: { item: 'occultism:burnt_otherstone' }
            },
            altar_type: 0,
            duration: 40,
            starlight: 200,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: '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: 'upgrade_base'
        },
        {
            output: Item.of('astralsorcery:altar_attunement'),
            pattern: ['_____', '_ABA_', '_CFC_', '_EDE_', '_____'],
            key: {
                A: { item: 'immersiveengineering:component_steel' },
                B: { tag: 'bloodmagic:crystals/demon' },
                C: {
                    type: 'astralsorcery:fluid',
                    fluid: [{ fluid: 'astralsorcery:liquid_starlight', amount: 1000 }]
                },
                D: { item: 'immersiveengineering:sheetmetal_steel' },
                E: { item: 'astralsorcery:marble_slab' },
                F: { item: 'kubejs:holy_gear' }
            },
            altar_type: 0,
            duration: 200,
            starlight: 500,
            recipe_class: 'astralsorcery:attunement_upgrade',
            effects: ['astralsorcery:built_in_effect_discovery_central_beam', 'astralsorcery:upgrade_altar'],
            id: '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(`${id_prefix}/${recipe.id}`);
    });
});
