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

    const id_prefix = 'astralsorcery:kubejs/altar';

    const recipes = [
        {
            output: Item.of('astralsorcery:altar_constellation'),
            pattern: ['B___B', '_CDC_', '_EAE_', '_FGF_', 'H___H'],
            key: {
                A: {
                    type: 'astralsorcery:crystal',
                    hasToBeAttuned: true,
                    hasToBeCelestial: false,
                    canBeAttuned: true,
                    canBeCelestialCrystal: true
                },
                B: { item: 'emendatusenigmatica:gold_gear' },
                C: { item: 'astralsorcery:illumination_powder' },
                D: { item: 'pedestals:coin/crafter3' },
                E: {
                    type: 'astralsorcery:fluid',
                    fluid: [{ fluid: 'industrialforegoing:ether_gas', amount: 1000 }]
                },
                F: { item: 'buildinggadgets:construction_paste' },
                G: { tag: 'forge:storage_blocks/nebu' },
                H: { item: 'astralsorcery:marble_chiseled' }
            },
            altar_type: 1,
            duration: 200,
            starlight: 1400,
            recipe_class: 'astralsorcery:constellation_upgrade',
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:upgrade_altar',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'altar_constellation'
        },
        {
            output: Item.of('mob_grinding_utils:mob_swab'),
            pattern: ['____A', '__BC_', '_BDB_', '_CB__', 'A____'],
            key: {
                A: { item: 'immersiveengineering:cushion' }, 
                B: { item: 'mob_grinding_utils:solid_xp_baby' },
                C: { item: 'kubejs:holy_rod' },
                D: Item.of('minecraft:enchanted_book').enchant('apotheosis:capturing', 1).toJson()
            },
            altar_type: 1,
            duration: 200,
            starlight: 1000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'mob_swab'
        },
        {
            output: Item.of('mob_grinding_utils:jumbo_tank'),
            pattern: ['A___A', '_BCB_', '_CDC_', '_BCB_', 'A___A'],
            key: {
                A: { item: 'immersiveengineering:sheetmetal_steel' }, 
                B: { item: 'buildinggadgets:construction_paste' },
                C: { item: 'engineersdecor:panzerglass_block' },
                D: { item: 'immersiveengineering:steel_scaffolding_standard' }
            },
            altar_type: 1,
            duration: 200,
            starlight: 1000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'jumbo_tank'
        },
        {
            output: Item.of('sophisticatedbackpacks:diamond_backpack'),
            pattern: ['A___A', '_BCB_', '_EDE_', '_BCB_', 'A___A'],
            key: {
                A: { item: 'occultism:spirit_attuned_gem' }, 
                B: { item: 'immersiveengineering:electron_tube' },
                C: { item: 'astralsorcery:shifting_star' },
                D: { item: 'occultism:satchel' },
                E: { item: 'emendatusenigmatica:diamond_gear' }
            },
            altar_type: 1,
            duration: 200,
            starlight: 1000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'diamond_backpack'
        },
        {
            output: Item.of('engineersdecor:small_electrical_furnace'),
            pattern: ['A___A', '_BCB_', '_DED_', '_FFF_', 'G___G'],
            key: {
                A: { item: 'immersiveengineering:component_steel' }, 
                B: { item: 'engineersdecor:dark_shingle_roof' },
                C: { item: 'immersiveengineering:wirecoil_copper' },
                D: { item: 'immersiveengineering:conveyor_basic' },
                E: { item: 'engineersdecor:small_lab_furnace' },
                F: { item: 'immersiveengineering:sheetmetal_lead' },
                G: { item: 'engineersdecor:metal_bar' }
            },
            altar_type: 1,
            duration: 160,
            starlight: 1000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'small_electrical_furnace'
        },
        {
            output: Item.of('immersiveengineering:dynamo'),
            pattern: ['A___A', '_FBF_', '_DED_', '_FGF_', 'A___A'],
            key: {
                A: Item.of('tconstruct:large_plate', '{Material:"tconstruct:steel"}').toJson(), 
                B: { item: 'immersiveengineering:coil_mv' },
                D: { item: 'immersiveengineering:generator' },
                E: { item: 'create:rotation_speed_controller' },
                F: { item: 'engineersdecor:metal_bar' },
                G: { item: 'occultism:otherstone_frame' }
            },
            altar_type: 1,
            duration: 200,
            starlight: 1000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'dynamo'
        },
        {
            output: Item.of('immersivepetroleum:gas_generator'),
            pattern: ['A___A', '_BCB_', '_DEF_', '_BGB_', 'H___H'],
            key: {
                A: { item: 'immersiveengineering:sheetmetal_constantan' }, 
                B: { item: 'immersiveengineering:generator' },
                C: { item: 'jaept:dark_dough' },
                D: { item: 'engineersdecor:straight_pipe_valve_redstone' },
                E: { item: 'engineersdecor:fluid_barrel' },
                F: { item: 'immersiveengineering:capacitor_lv' },
                G: { item: 'astralsorcery:colored_lens_fire' },
                H: { item: 'immersiveengineering:steel_scaffolding_standard' }
            },
            altar_type: 1,
            duration: 200,
            starlight: 1000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'gas_generator'
        },
        {
            output: Item.of('kubejs:bottling_machine_blueprint'),
            pattern: ['A___B', '__C__', '_DED_', '__F__', 'B___A'],
            key: {
                A: {
                    type: 'astralsorcery:fluid',
                    fluid: [{ fluid: 'mob_grinding_utils:fluid_xp', amount: 1000 }]
                },
                B: { item: 'immersiveengineering:hemp_fabric' },
                C: { item: 'create:spout' },
                D: { item: 'immersiveengineering:logic_circuit' },
                E: { item: 'create:empty_schematic' },
                F: { item: 'create:belt_connector' }
            },
            altar_type: 1,
            duration: 200,
            starlight: 1000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'bottling_machine_blueprint'
        },
        {
            output: Item.of('kubejs:mixer_blueprint'),
            pattern: ['A___B', '__C__', '_DED_', '__F__', 'B___A'],
            key: {
                A: { item: 'mob_grinding_utils:solid_xp_block' },
                B: { item: 'immersiveengineering:hemp_fabric' },
                C: { item: 'create:mechanical_mixer' },
                D: { item: 'immersiveengineering:logic_circuit' },
                E: { item: 'create:empty_schematic' },
                F: { item: 'create:basin' }
            },
            altar_type: 1,
            duration: 200,
            starlight: 1000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'mixer_blueprint'
        },
        {
            output: Item.of('kubejs:crusher_blueprint'),
            pattern: ['A___B', '__C__', '_DED_', '__C__', 'B___A'],
            key: {
                A: { item: 'mob_grinding_utils:solid_xp_block' },
                B: { item: 'immersiveengineering:hemp_fabric' },
                C: { item: 'immersiveengineering:coil_mv' },
                D: { item: 'create:crushing_wheel' },
                E: { item: 'create:empty_schematic' }
            },
            altar_type: 1,
            duration: 200,
            starlight: 1000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'crusher_blueprint'
        },
        {
            output: Item.of('astralsorcery:spectral_relay'),
            pattern: ['A___A', '_BBB_', '_BCB_', '_BBB_', 'A___A'],
            key: {
                C: { item: 'astralsorcery:glass_lens' },
                B: { item: 'astralsorcery:infused_wood_slab' },
                A: { item: 'atum:nebu_drop' }
            },
            altar_type: 1,
            duration: 80,
            starlight: 1200,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'spectral_relay'
        },
        {
            output: Item.of('astralsorcery:attunement_altar'),
            pattern: ['A___A', '__B__', '_CDC_', '_EFE_', 'G___G'],
            key: {
                A: { item: 'emendatusenigmatica:brass_block' },
                B: { item: 'atum:ptah_godshard' },
                C: { item: 'astralsorcery:illumination_powder' },
                D: { item: 'astralsorcery:spectral_relay' },
                E: { item: 'astralsorcery:marble_runed' },
                F: { item: 'occultism:otherstone_tablet' },
                G: { item: 'immersiveengineering:slab_steel_scaffolding_standard' }
            },
            altar_type: 1,
            duration: 200,
            starlight: 1600,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'attunement_altar'
        },
        {
            output: Item.of('kubejs:wither_bones'),
            pattern: ['A___A', '_BCB_', '_BDB_', '__B__', '_____'],
            key: {
                A: { item: 'alexsmobs:dropbear_claw' },
                B: { item: 'tconstruct:necrotic_bone' },
                C: { item: 'jaept:dark_dough' },
                D: { item: 'byg:hanging_bones' }
            },
            altar_type: 1,
            duration: 160,
            starlight: 1200,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'wither_bones'
        },
        {
            output: Item.of('pedestals:coin/crusher'),
            pattern: ['A___A', '_ABA_', '_CDC_', '_EFE_', 'E___E'],
            key: {
                A: { item: 'kubejs:bloodslate_dust' },
                B: { item: 'create:millstone' },
                C: { item: 'emendatusenigmatica:electrum_plate' },
                D: { item: 'pedestals:coin/import' },
                E: { item: 'emendatusenigmatica:coke_dust' },
                F: { item: 'createaddition:furnace_burner' },
            },
            altar_type: 1,
            duration: 160,
            starlight: 1000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'pedestal_upgrade_crusher'
        },
        {
            output: Item.of('pedestals:coin/sawmill'),
            pattern: ['A___A', '_ABA_', '_CDC_', '_EFE_', 'E___E'],
            key: {
                A: { item: 'emendatusenigmatica:wood_dust' },
                B: { item: 'create:mechanical_saw' },
                C: { item: 'emendatusenigmatica:electrum_plate' },
                D: { item: 'pedestals:coin/import' },
                E: { item: 'emendatusenigmatica:coke_dust' },
                F: { item: 'createaddition:furnace_burner' },
            },
            altar_type: 1,
            duration: 160,
            starlight: 1000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'pedestal_upgrade_sawmill'
        },
        {
            output: Item.of('pedestals:coin/smelter'),
            pattern: ['A___A', '_ABA_', '_CDC_', '_EFE_', 'E___E'],
            key: {
                A: { item: 'occultism:burnt_otherstone' },
                B: { item: 'bloodmagic:furnacecell_primitive' },
                C: { item: 'emendatusenigmatica:electrum_plate' },
                D: { item: 'pedestals:coin/import' },
                E: { item: 'emendatusenigmatica:coke_dust' },
                F: { item: 'createaddition:furnace_burner' },
            },
            altar_type: 1,
            duration: 160,
            starlight: 1000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'pedestal_upgrade_smelter'
        },
        {
            output: Item.of('pedestals:coin/effect'),
            pattern: ['A___A', '_ABA_', '_CDC_', '_EFE_', 'E___E'],
            key: {
                A: { item: 'minecraft:dragon_breath' },
                B: { item: 'bloodmagic:cyclingcatalyst' },
                C: { item: 'emendatusenigmatica:electrum_plate' },
                D: { item: 'pedestals:coin/default' },
                E: { item: 'emendatusenigmatica:coke_dust' },
                F: { item: 'createaddition:furnace_burner' },
            },
            altar_type: 1,
            duration: 160,
            starlight: 1000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'pedestal_upgrade_effect'
        }
    ];

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