ServerEvents.recipes(event => {
    const knightSets = [
        { 
            name: 'crimson_guard', 
            stone: 'death_knights:blood_stone', 
            output: 'death_knights:crimson_guard_armor' 
        },
        { 
            name: 'plaguebringer', 
            stone: 'death_knights:unholy_stone', 
            output: 'death_knights:plaguebringer_armor' 
        },
        { 
            name: 'frozen_champion', 
            stone: 'runes:frost_stone', 
            output: 'death_knights:frozen_champion_armor' 
        }
    ];

    const pieces = ['head', 'chest', 'legs', 'feet'];

    knightSets.forEach(set => {
        pieces.forEach(piece => {
            // 1. Force remove any recipe resulting in this armor piece
            event.remove({ output: `${set.output}_${piece}` });

            // 2. Add the corrected smithing recipe
            event.smithing(
                `${set.output}_${piece}`,               // Result
                set.stone,                              // Template (Left slot)
                `death_knights:initiate_armor_${piece}`, // Base (Middle slot)
                'minecraft:iron_ingot'                  // Addition (Right slot)
            );
        });
    });
});