//priority: 0

//hazmat
onEvent('recipes', event => {

    //dark/red matter armors
    armorPieces.vanilla.forEach(piece => {
        ['dm', 'rm'].forEach(dmrm => {
    
            //remove
            removeRecipeByOutput(event, [
                PRE(`${dmrm}_${piece}`)
            ])

            //mechanical crafting
            event.recipes.createMechanicalCrafting(
                PRE(`${dmrm}_${piece}`),
                templates.advanced[piece],
                armorObj.advanced(armorMats[dmrm], piece)
            ).id(KJ(`${PRE()}/mechanical_crafting/${dmrm}_${piece}`))

            //extended crafting
            event.recipes.extendedcrafting.shaped_table(
                PRE(`${dmrm}_${piece}`),
                templates.advanced[piece],
                armorObj.advanced(armorMats[dmrm], piece)
            ).id(KJ(`${PRE()}/extended_crafting/${dmrm}_${piece}`))
    
        })
    })



    //hazmat armor
    armorPieces.hazmat.forEach((piece, i) => {
		const vanillaEq = armorPieces.vanilla[i]

		//remove
		removeRecipeByOutput(event, [
			M(`hazmat_${piece}`)
		])

		//extended crafting
		event.recipes.extendedcrafting.shaped_table(
            M(`hazmat_${piece}`),
            templates.ultimate[vanillaEq],
            armorObj.ultimate(armorMats.hazmat, vanillaEq)
        ).id(KJ(`${M()}/extended_crafting/hazmat_${piece}`))
	})



    //meka suit
    armorPieces.meka.forEach((piece, i) => {
		const vanillaEq = armorPieces.vanilla[i]

		//remove
		removeRecipeByOutput(event, [
			M(`mekasuit_${piece}`)
		])

		//extended crafting
		event.recipes.extendedcrafting.shaped_table(
            M(`mekasuit_${piece}`),
            templates.ultimate[vanillaEq],
            armorObj.ultimate(armorMats.meka, vanillaEq)
        ).id(KJ(`${M()}/extended_crafting/mekasuit_${piece}`))
    })



    //space suit
    armorPieces.space.forEach((piece, i) => {
		const vanillaEq = armorPieces.vanilla[i]

		//remove
		removeRecipeByOutput(event, [
			BT(piece)
		])

		//extended crafting
		event.recipes.extendedcrafting.shaped_table(
            BT(piece),
            templates.ultimate[vanillaEq],
            armorObj.ultimate(armorMats.space, vanillaEq)
        ).id(KJ(`${BT()}/extended_crafting/${piece}`))
    })



    //netherite space suit
    armorPieces.space.forEach((piece, i) => {
		const vanillaEq = armorPieces.vanilla[i]

		//remove
		removeRecipeByOutput(event, [
			BT(`netherite_${piece}`)
		])

		//extended crafting
		event.recipes.extendedcrafting.shaped_table(
            BT(`netherite_${piece}`),
            templates.ultimate[vanillaEq],
            armorObj.ultimate(armorMats.spaceNetherite, vanillaEq)
        ).id(KJ(`${BT()}/extended_crafting/netherite_${piece}`))
    })



    //gem armor
    armorPieces.vanilla.forEach(piece => {
		//remove
		removeRecipeByOutput(event, [
			PRE(`gem_${piece}`)
		])

		//extended crafting
		event.recipes.extendedcrafting.shaped_table(
            PRE(`gem_${piece}`),
            templates.elite[piece],
            armorObj.elite(armorMats.gem, piece, piece === "boots")
        ).id(KJ(`${PRE()}/extended_crafting/gem_${piece}`))
    })



    //infused armor
    armorPieces.vanilla.forEach(piece => {
		//remove
		removeRecipeByOutput(event, [
			MU(`infused_${piece}`)
		])

		//extended crafting
		event.recipes.extendedcrafting.shaped_table(
            MU(`infused_${piece}`),
            templates.ultimate[piece],
            armorObj.ultimate(armorMats.infused, piece)
        ).id(KJ(`${MU()}/extended_crafting/infused_${piece}`))
    })



    //infinity armor
    armorPieces.vanilla.forEach(piece => {
		//remove
		removeRecipeByOutput(event, [
			AV(`infinity_armor_${piece}`)
		])

		//extended crafting
		event.recipes.extendedcrafting.shaped_table(
            AV(`infinity_armor_${piece}`),
            templates.ultimate[piece],
            armorObj.ultimate(armorMats.infinity, piece)
        ).id(KJ(`${AV()}/extended_crafting/infinity_armor_${piece}`))
    })
})