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.of('bloodmagic:sigilofholding', '{currentSigil:0}').ignoreNBT().toJson(),
                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: 'astralsorcery:altar/altar_constellation'
        },
        {
            output: Item.of('astralsorcery:linking_tool'),
            pattern: ['_____', '__AB_', '_CDA_', '_EC__', 'C____'],
            key: {
                A: { item: 'immersiveengineering:stick_treated' }, 
                B: { item: 'astralsorcery:aquamarine' },
                C: { item: 'astralsorcery:infused_wood_enriched' },
                D: { item: 'integrateddynamics:logic_director' },
                E: Item.of('pedestals:linkingtool').ignoreNBT().toJson()
            },
            altar_type: 1,
            duration: 200,
            starlight: 1200,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: 'astralsorcery:altar/linking_tool'
        },
        {
            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: { tag: 'forge:rods/holy' },
                D: {
                    item: 'minecraft:enchanted_book',
                    type: 'nbt_ingredient_predicate:nbt_includes',
                    nbt: {
                        StoredEnchantments: [{
                            //lvl: 1,
                            id: 'apotheosis:capturing'
                        }]
                    }
                }
            },
            altar_type: 1,
            duration: 200,
            starlight: 1000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/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: 160,
            starlight: 1000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/jumbo_tank`
        },
        {
            output: Item.of('integratedtunnels:part_interface_item'),
            pattern: ['A___A', '__C__', '_BDB_', '__C__', 'A___A'],
            key: {
                C: { item: 'immersiveengineering:component_steel' },
                B: { item: 'create:portable_storage_interface' },
                A: { item: 'integrateddynamics:crystalized_chorus_chunk' },
                D: { item: 'immersiveengineering:sheetmetal_aluminum' }
            },
            altar_type: 1,
            duration: 160,
            starlight: 1000,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: `${id_prefix}/item_interface`
        },
        {
            output: Item.of('integratedtunnels:part_interface_fluid'),
            pattern: ['A___A', '__C__', '_BDB_', '__C__', 'A___A'],
            key: {
                C: { item: 'immersiveengineering:component_steel' },
                B: { item: 'create:portable_fluid_interface' },
                A: { item: 'integrateddynamics:crystalized_chorus_chunk' },
                D: { item: 'immersiveengineering:sheetmetal_gold' }
            },
            altar_type: 1,
            duration: 160,
            starlight: 1000,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: `${id_prefix}/fluid_interface`
        },
        {
            output: Item.of('integratedtunnels:part_interface_energy'),
            pattern: ['A___A', '__C__', '_BDB_', '__C__', 'A___A'],
            key: {
                C: { item: 'immersiveengineering:component_steel' },
                B: { item: 'immersiveengineering:connector_hv' },
                A: { item: 'integrateddynamics:crystalized_chorus_chunk' },
                D: { item: 'createaddition:overcharged_casing' }
            },
            altar_type: 1,
            duration: 160,
            starlight: 1000,
            effects: ['astralsorcery:built_in_effect_discovery_central_beam'],
            id: `${id_prefix}/energy_interface`
        },
        {
            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: 240,
            starlight: 1000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/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: `${id_prefix}/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: `${id_prefix}/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: 'occultism:otherstone_frame' },
                D: { item: 'engineersdecor:straight_pipe_valve_redstone' },
                E: { item: 'engineersdecor:fluid_barrel' },
                F: { item: 'immersiveengineering:capacitor_mv' },
                G: { item: 'astralsorcery:colored_lens_fire' },
                H: { item: 'immersiveengineering:steel_scaffolding_standard' }
            },
            altar_type: 1,
            duration: 160,
            starlight: 1000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/gas_generator`
        },
        {
            output: Item.of('immersiveengineering:fluid_pump'),
            pattern: ['_____', '__A__', '_BCB_', '_DED_', 'F___F'],
            key: {
                A: { item: 'immersiveengineering:coil_lv' },
                B: { item: 'emendatusenigmatica:iron_plate' },
                C: { item: 'immersiveengineering:sheetmetal_colored_cyan' },
                D: { item: 'immersiveengineering:fluid_pipe' },
                E: { item: 'create:mechanical_pump' },
                F: { item: 'bloodmagic:reagentwater' }
            },
            altar_type: 1,
            duration: 160,
            starlight: 1000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/fluid_pump`
        },
        {
            output: Item.of('4x immersiveengineering:blastbrick_reinforced'),
            pattern: ['A___A', '_BCB_', '_CDC_', '_BCB_', 'A___A'],
            key: {
                A: { item: 'immersiveengineering:dust_hop_graphite' },
                B: { item: 'immersiveengineering:steel_scaffolding_standard' },
                C: { item: 'immersiveengineering:blastbrick' },
                D: { item: 'create:shadow_steel_casing' }
            },
            altar_type: 1,
            duration: 200,
            starlight: 1000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/blastbrick_reinforced`
        },
        /*
        {
            output: Item.of('kubejs:assembler_blueprint'),
            pattern: ['A___B', '_CCC_', '_CEC_', '_CCC_', 'B___A'],
            key: {
                A: {
                    type: 'astralsorcery:fluid',
                    fluid: [{ fluid: 'mob_grinding_utils:fluid_xp', amount: 1000 }]
                },
                B: { item: 'immersiveengineering:hemp_fabric' },
                C: { item: 'create:mechanical_crafter' },
                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: `${id_prefix}/assembler_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: `${id_prefix}/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: `${id_prefix}/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: 'astralsorcery:altar/spectral_relay'
        },
        {
            output: Item.of('astralsorcery:attunement_altar'),
            pattern: ['A___A', '__B__', '_CDC_', '_EFE_', 'G___G'],
            key: {
                A: { item: 'emendatusenigmatica:electrum_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: 'astralsorcery:altar/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: `${id_prefix}/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: `${id_prefix}/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: `${id_prefix}/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: `${id_prefix}/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: `${id_prefix}/pedestal_upgrade_effect`
        },
        {
            output: Item.of('pedestals:coin/cobble'),
            pattern: ['A___A', '_BCB_', '_DED_', '_BCB_', 'A___A'],
            key: {
                A: { item: 'immersiveengineering:circuit_board' },
                B: { item: 'emendatusenigmatica:electrum_plate' },
                C: Item.of('bloodmagic:lavasigil').ignoreNBT().toJson(),
                D: Item.of('bloodmagic:watersigil').ignoreNBT().toJson(),
                E: Item.of('pedestals:coin/breaker').ignoreNBT().toJson()
            },
            altar_type: 1,
            duration: 160,
            starlight: 1000,
            effects: [
                'astralsorcery:built_in_effect_discovery_central_beam',
                'astralsorcery:built_in_effect_attunement_sparkle'
            ],
            id: `${id_prefix}/pedestal_upgrade_cobble`
        }
    ];

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