// Brass & Sigil — ComputerCraft recipe overhaul (full coverage, v3)
//
// Two design principles:
//   1. Every electronic CC item contains TFMG plastic_sheet -- plastic is
//      the electrical insulator and the gate that forces players to build
//      out TFMG's full oil-refining chain (crude oil -> naphtha -> molten
//      plastic -> sheet) before any CC tech.
//   2. Advanced versions contain their basic counterpart in the recipe.
//      Computer Advanced contains Computer Normal; Monitor Advanced
//      contains Monitor Normal; etc. This makes the upgrade chain
//      literal -- you can't skip basic tier, you upgrade through it.
//
// Tier outline (with both principles applied):
//   T1 Cable           plastic + copper_wire + redstone (cheap commodity)
//   T2 Basic CC        plastic + brass_casing + electron_tube + p_mech +
//                      steel + silicon-or-cogwheel (Create T2 + TFMG oil
//                      + steel chain)
//   T3 Networking+bots plastic + electromagnetic_coil + mech_arm/bearing
//                      + constantan_wire (TFMG advanced electrical)
//   T4 Advanced        Basic item + silicon + rose_quartz + gold +
//                      industrial_iron_block (or display_link / large_coil)
//   T5 Mobile          Pocket Normal -> Pocket Advanced via same pattern

ServerEvents.recipes(event => {
    // ─── T1 - CABLING ──────────────────────────────────────────────────
    // Cable (x8): plastic insulator + copper_wire core + redstone signal.
    // Outputs 8 so network laying is still viable.
    event.remove({ output: 'computercraft:cable' });
    event.shaped(Item.of('computercraft:cable', 8), [
        'PWP',
        'WRW',
        'PWP',
    ], {
        P: 'tfmg:plastic_sheet',
        W: 'tfmg:copper_wire',
        R: 'minecraft:redstone',
    });

    // ─── T2 - BASIC COMPUTING ──────────────────────────────────────────

    // Computer (Basic): plastic shell + electron_tube CPU + brass_casing
    // chassis + steel reinforcement + precision_mechanism core.
    event.remove({ output: 'computercraft:computer_normal' });
    event.shaped('computercraft:computer_normal', [
        'PEP',
        'SBS',
        'PMP',
    ], {
        P: 'tfmg:plastic_sheet',
        E: 'create:electron_tube',
        S: 'tfmg:steel_ingot',
        B: 'create:brass_casing',
        M: 'create:precision_mechanism',
    });

    // Monitor (Basic): plastic frame + nixie_tube (retro CRT) + glass.
    event.remove({ output: 'computercraft:monitor_normal' });
    event.shaped('computercraft:monitor_normal', [
        'PNP',
        'GGG',
        'PNP',
    ], {
        P: 'tfmg:plastic_sheet',
        N: 'create:nixie_tube',
        G: 'minecraft:glass_pane',
    });

    // Disk Drive: plastic frame + cogwheel (spinning read head) +
    // rose_quartz (data medium) + steel + p_mech.
    event.remove({ output: 'computercraft:disk_drive' });
    event.shaped('computercraft:disk_drive', [
        'PCP',
        'RQR',
        'SMS',
    ], {
        P: 'tfmg:plastic_sheet',
        C: 'create:cogwheel',
        R: 'minecraft:redstone',
        Q: 'create:rose_quartz',
        S: 'tfmg:steel_ingot',
        M: 'create:precision_mechanism',
    });

    // Floppy Disk: 2 plastic + redstone, shapeless.
    event.remove({ output: 'computercraft:disk' });
    event.shapeless('computercraft:disk', [
        'tfmg:plastic_sheet',
        'tfmg:plastic_sheet',
        'minecraft:redstone',
    ]);

    // Wired Modem: plastic shell + copper_wire signal lines + brass_casing
    // chassis + electron_tube amplifier.
    event.remove({ output: 'computercraft:wired_modem' });
    event.shaped('computercraft:wired_modem', [
        'PWP',
        'BEB',
        'PWP',
    ], {
        P: 'tfmg:plastic_sheet',
        W: 'tfmg:copper_wire',
        B: 'create:brass_casing',
        E: 'create:electron_tube',
    });

    // Wired Modem Full: 1 modem -> block form (toggle).
    event.remove({ output: 'computercraft:wired_modem_full' });
    event.shapeless('computercraft:wired_modem_full',
        ['computercraft:wired_modem']);

    // Speaker: plastic + electron_tube amplifier + brass_casing + note_block.
    event.remove({ output: 'computercraft:speaker' });
    event.shaped('computercraft:speaker', [
        'PEP',
        'BMB',
        'PNP',
    ], {
        P: 'tfmg:plastic_sheet',
        E: 'create:electron_tube',
        B: 'create:brass_casing',
        M: 'create:precision_mechanism',
        N: 'minecraft:note_block',
    });

    // Printer: plastic + steel + ink_sac + precision_mech + cogwheel.
    event.remove({ output: 'computercraft:printer' });
    event.shaped('computercraft:printer', [
        'PSP',
        'IMI',
        'PCP',
    ], {
        P: 'tfmg:plastic_sheet',
        S: 'tfmg:steel_ingot',
        I: 'minecraft:ink_sac',
        M: 'create:precision_mechanism',
        C: 'create:cogwheel',
    });

    // ─── T3 - NETWORKING + ROBOTICS ────────────────────────────────────

    // Wireless Modem (Basic): plastic + copper/aluminum wire + TFMG
    // electromagnetic_coil antenna + brass_casing chassis.
    event.remove({ output: 'computercraft:wireless_modem_normal' });
    event.shaped('computercraft:wireless_modem_normal', [
        'WAW',
        'PLP',
        'WBW',
    ], {
        W: 'tfmg:copper_wire',
        A: 'tfmg:aluminum_wire',
        P: 'tfmg:plastic_sheet',
        L: 'tfmg:electromagnetic_coil',
        B: 'create:brass_casing',
    });

    // Redstone Relay: plastic + copper_wire + electron_tube switching +
    // brass_casing.
    event.remove({ output: 'computercraft:redstone_relay' });
    event.shaped('computercraft:redstone_relay', [
        'PEP',
        'RBR',
        'PEP',
    ], {
        P: 'tfmg:plastic_sheet',
        E: 'create:electron_tube',
        R: 'minecraft:redstone',
        B: 'create:brass_casing',
    });

    // Turtle (Basic): steel + mechanical_bearing (movement axis) +
    // gantry_shaft (arm reach) + computer_normal (the brain) + chest.
    // Contains the basic computer, so turtle inherits its plastic cost.
    event.remove({ output: 'computercraft:turtle_normal' });
    event.shaped('computercraft:turtle_normal', [
        'SBS',
        'GCG',
        'SHS',
    ], {
        S: 'tfmg:steel_ingot',
        B: 'create:mechanical_bearing',
        G: 'create:gantry_shaft',
        C: 'computercraft:computer_normal',
        H: 'minecraft:chest',
    });

    // ─── T4 - ADVANCED ─────────────────────────────────────────────────
    // All advanced items: contain their basic counterpart + premium
    // upgrade materials (silicon, rose_quartz, gold, industrial_iron_blk,
    // constantan).

    // Computer (Advanced): Computer Normal core, silicon + rose_quartz
    // upgrades, industrial_iron_block premium chassis, gold trim.
    event.remove({ output: 'computercraft:computer_advanced' });
    event.shaped('computercraft:computer_advanced', [
        'GQG',
        'SCS',
        'GIG',
    ], {
        G: 'minecraft:gold_ingot',
        Q: 'create:rose_quartz',
        S: 'tfmg:silicon_ingot',
        C: 'computercraft:computer_normal',
        I: 'create:industrial_iron_block',
    });

    // Monitor (Advanced): Monitor Normal as the screen, display_link as
    // the data binding layer, gold trim + nixie_tube accents, plastic
    // insulation on the sides.
    event.remove({ output: 'computercraft:monitor_advanced' });
    event.shaped('computercraft:monitor_advanced', [
        'GNG',
        'PMP',
        'GDG',
    ], {
        G: 'minecraft:gold_ingot',
        N: 'create:nixie_tube',
        P: 'tfmg:plastic_sheet',
        M: 'computercraft:monitor_normal',
        D: 'create:display_link',
    });

    // Wireless Modem (Advanced): contains Wireless Modem Normal,
    // wrapped in constantan_wire + spool for high-Q tuning, large_coil
    // for the powerful antenna, gold trim.
    event.remove({ output: 'computercraft:wireless_modem_advanced' });
    event.shaped('computercraft:wireless_modem_advanced', [
        'WCW',
        'PMP',
        'GLG',
    ], {
        W: 'tfmg:constantan_wire',
        C: 'tfmg:constantan_spool',
        P: 'tfmg:plastic_sheet',
        M: 'computercraft:wireless_modem_normal',
        G: 'minecraft:gold_ingot',
        L: 'tfmg:large_coil',
    });

    // Turtle (Advanced): contains Computer Advanced (so the upgrade
    // chain forces Basic -> Computer Normal -> Computer Advanced ->
    // Turtle Advanced). Mechanical_arm for proper robotic manipulation,
    // gold trim.
    event.remove({ output: 'computercraft:turtle_advanced' });
    event.shaped('computercraft:turtle_advanced', [
        'GAG',
        'GCG',
        'GHG',
    ], {
        G: 'minecraft:gold_ingot',
        A: 'create:mechanical_arm',
        C: 'computercraft:computer_advanced',
        H: 'minecraft:chest',
    });

    // ─── T5 - MOBILE (POCKET COMPUTERS) ────────────────────────────────

    // Pocket Computer (Basic): miniaturised. Plastic shell, electron_tube,
    // silicon CPU, precision_mech, glass pane screen.
    event.remove({ output: 'computercraft:pocket_computer_normal' });
    event.shaped('computercraft:pocket_computer_normal', [
        'PEP',
        'SMS',
        'PgP',
    ], {
        P: 'tfmg:plastic_sheet',
        E: 'create:electron_tube',
        S: 'tfmg:silicon_ingot',
        M: 'create:precision_mechanism',
        g: 'minecraft:glass_pane',
    });

    // Pocket Computer (Advanced): contains Pocket Computer Normal,
    // upgraded with rose_quartz, gold-trim, silicon doubled.
    event.remove({ output: 'computercraft:pocket_computer_advanced' });
    event.shaped('computercraft:pocket_computer_advanced', [
        'PQP',
        'SCS',
        'PGP',
    ], {
        P: 'tfmg:plastic_sheet',
        Q: 'create:rose_quartz',
        S: 'tfmg:silicon_ingot',
        C: 'computercraft:pocket_computer_normal',
        G: 'minecraft:gold_ingot',
    });
});
