// priority: 0

onEvent('recipes', event => {
    removeRecipeByID(event, [
        EC("ultimate_singularity")
    ])

    const singularities = [
        { id: "antimatter_relay_mk3", core: PRE("relay_mk3") },
        { id: "pity_machine_frame", core: IF("machine_frame_pity") },
        { id: "electrum", core: F("#ingots/electrum") },
        { id: "lapis_lazuli", core: F("#gems/lapis") },
        { id: "white_matter", core: PREXP("white_matter") },
        { id: "blue_matter", core: PREXP("blue_matter") },
        { id: "klein_star_omega", core: PRE("klein_star_omega") },
        { id: "uranium", core: F("#ingots/uranium") },
        { id: "yellow_matter", core: PREXP("yellow_matter") },
        { id: "redstone", core: MC("redstone") },
        { id: "violet_matter", core: PREXP("violet_matter") },
        { id: "diamond", core: MC("diamond") },
        { id: "iron", core: F("#ingots/iron") },
        { id: "energy_condenser_mk2", core: PRE("condenser_mk2") },
        { id: "steel_casing", core: M("steel_casing") },
        { id: "nickel", core: F("#ingots/nickel") },
        { id: "cyan_matter", core: PREXP("cyan_matter") },
        { id: "steel", core: F("#ingots/steel") },
        { id: "red_matter", core: PRE("red_matter") },
        { id: "emerald", core: MC("emerald") },
        { id: "purple_matter", core: PREXP("purple_matter") },
        { id: "aluminum", core: F("#ingots/aluminum") },
        { id: "silver", core: F("#ingots/silver") },
        { id: "experience_pearl_x4", core: MU("experience_pearl_4x") },
        { id: "pink_matter", core: PREXP("pink_matter") },
        { id: "copper", core: F("#ingots/copper") },
        { id: "antimatter", core: M("pellet_antimatter") },
        { id: "bronze", core: F("#ingots/bronze") },
        { id: "invar", core: F("#ingots/invar") },
        { id: "dark_matter", core: PRE("dark_matter") },
        { id: "lime_matter", core: PREXP("lime_matter") },
        { id: "coal", core: MC("coal") },
        { id: "iron_opinium_core", core: MU("iron_opinium_core") },
        { id: "magenta_matter", core: PREXP("magenta_matter") },
        { id: "orange_matter", core: PREXP("orange_matter") },
        { id: "platinum", core: F("#ingots/platinum") },
        { id: "magnum_star_omega", core: PREXP("magnum_star_omega") },
        { id: "machine_frame", core: RTB("machine_frame") },
        { id: "glowstone", core: MC("glowstone_dust") },
        { id: "redstone_ingot", core: F("#ingots/red_alloy") },
        { id: "queens_slime_ingot", core: F("#ingots/queens_slime") },
        { id: "singularity", core: AE2("quantum_entangled_singularity") },
        { id: "fading_matter", core: PREXP("fading_matter") },
        { id: "green_matter", core: PREXP("green_matter") },
        { id: "tin", core: F("#ingots/tin") },
        { id: "16m_cell_component", core: AE2E("16m_cell_component") },
        { id: "lead", core: F("#ingots/lead") },
        { id: "colossal_star_omega", core: PREXP("colossal_star_omega") },
        { id: "energy_collector_mk3", core: PRE("collector_mk3") },
    ]
    let singIdList = []

    singularities.forEach(singularity => {
        const { id, core } = singularity

        event.recipes.extendedcrafting.shaped_table(Item.of(EC('singularity'), { Id:EC(id) }), [
            'B   B   B',
            ' B  B  B ',
            '  B B B  ',
            '   BBB   ',
            'BBBBABBBB',
            '   BBB   ',
            '  B B B  ',
            ' B  B  B ',
            'B   B   B',
        ], {
        A: core,
        B: AE2("singularity"),
        }).id(KJ(`${EC()}/singularity/${id}`))

        singIdList.push(Item.of(EC('singularity'), { Id:EC(id) }))
    })

    event.recipes.extendedcrafting.shapeless_table(EC("ultimate_singularity"), singIdList)
})