// Priority: 0

ServerEvents.recipes(event => {

    // ==========================================================================
    // 1. RECIPE REMOVALS
    // ==========================================================================
    
    const recipesByID = [
        // Naturalist & World
        'naturalist:leather_from_reptile_hide',
        'incendium:upgrade_elytra', 
        'minecraft:bread',
        'minecraft:cake',
        'naturalist:cake',
        'chas:leather_horse_armor',

        // RPG & Combat
        'forcemaster_rpg:golden_knuckle',

	// Early Stage & Utility (Add these to your recipesByID list)
        'explorerscompass:explorers_compass',
        'explorerscompass:explorers_compass_alternate',

        // No Tree Punching (Processing & Sticks)
        'notreepunching:sticks_from_logs_with_saw',
        'notreepunching:sticks_from_logs_with_flint_axe',
        'notreepunching:sticks_from_planks_with_saw',
        'notreepunching:sticks_from_planks_with_flint_axe',
        'notreepunching:clay_brick_from_blocks',
        'notreepunching:clay_brick_from_balls',
        'notreepunching:leather_from_boots_with_knife',
        'notreepunching:leather_from_chestplate_with_knife',
        'notreepunching:leather_from_helmet_with_knife',
        'notreepunching:leather_from_leggings_with_knife',
        'notreepunching:melon_slices_with_knife',
        
        // NTP Fiber Removals (Surgical IDs)
        'notreepunching:plant_fiber_from_wheat_with_knife',
        'notreepunching:plant_fiber_from_cactus_with_knife',
        'notreepunching:plant_fiber_from_leaves_with_knife',
        'notreepunching:plant_fiber_from_saplings_with_knife',
        'notreepunching:plant_fiber_from_small_flowers_with_knife',
        'notreepunching:plant_fiber_from_tall_flowers_with_knife',
        'notreepunching:plant_fiber_from_sugarcane_with_knife',

        // Conflict Resolution
        'minecraft:kjs/notreepunching_plant_fiber_3',
        'minecraft:kjs/notreepunching_plant_fiber_4',
        'notreepunching:crafting/plant_fiber_from_cactus'
    ];

    recipesByID.forEach(recipeID => {
        event.remove({ id: recipeID });
    });

    // Removals by Filter (Safety nets for Knife processing)
    event.remove({ output: 'notreepunching:plant_fiber', input: 'notreepunching:flint_knife', ingredients: ['minecraft:sugar_cane', 'minecraft:cactus', '#minecraft:flowers'] });
    event.remove({ output: 'minecraft:string', input: 'notreepunching:flint_knife' });
    event.remove({ output: 'minecraft:leather', input: 'notreepunching:flint_knife' });
    event.remove({ output: 'minecraft:melon_slice', input: 'notreepunching:flint_knife' });

    // Explicit Output Nuke
    event.remove({ output: 'naturalist:reptile_hide' });

    // ==========================================================================
    // 2. INPUT REPLACEMENTS
    // ==========================================================================
    event.replaceInput({ input: 'naturalist:reptile_hide' }, 'naturalist:reptile_hide', 'minecraft:leather');

    // ==========================================================================
    // 3. SHAPED & SHAPELESS RECIPES
    // ==========================================================================
    event.shaped('minecraft:iron_horse_armor',   ['  H', 'IBI', 'I I'], { H: 'minecraft:iron_helmet', I: 'minecraft:iron_ingot', B: 'minecraft:iron_block' });
    event.shaped('minecraft:golden_horse_armor', ['  H', 'IBI', 'I I'], { H: 'minecraft:golden_helmet', I: 'minecraft:gold_ingot', B: 'minecraft:gold_block' });
    event.shaped('minecraft:diamond_horse_armor', ['  H', 'IBI', 'I I'], { H: 'minecraft:diamond_helmet', I: 'minecraft:diamond', B: 'minecraft:diamond_block' });

    // ==========================================================================
    // 4. SMITHING RECIPES (Knight Sets)
    // ==========================================================================
    const knightSets = [
        { stone: 'death_knights:blood_stone',  output: 'death_knights:crimson_guard_armor' },
        { stone: 'death_knights:unholy_stone', output: 'death_knights:plaguebringer_armor' },
        { stone: 'runes:frost_stone',          output: 'death_knights:frozen_champion_armor' }
    ];
    
    knightSets.forEach(set => {
        ['head', 'chest', 'legs', 'feet'].forEach(piece => {
            event.smithing(`${set.output}_${piece}`, 'minecraft:iron_block', `death_knights:initiate_armor_${piece}`, set.stone);
        });
    });
});