// priority: 9


/**
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * Thermal Recipe Changes
 */
ServerEvents.recipes((event) => {
  event.remove([
    { output: "thermal:flux_drill" },
    { output: "thermal:flux_saw" },
    { output: "thermal:machine_pulverizer" },
    { output: "thermal:area_radius_augment" },
    { output: "thermal:drill_head" },
    { output: "thermal:flux_capacitor" },
    { output: "thermal:hazmat_fabric" },
    { output: "thermal:diving_fabric" },

    { output: "thermal:diving_helmet" },

    { output: "thermal:hazmat_helmet" },
    { output: "thermal:hazmat_chestplate" },
    { output: "thermal:hazmat_leggings" },
    { output: "thermal:hazmat_boots" },
  ]);

  /**
   * New recipes
   */
  event.recipes.create.deploying('kubejs:steel_string', ['minecraft:string', 'createbigcannons:cast_iron_nugget']);

  event.shaped(Item.of('kubejs:aqua_machine', 1), [
    'GRG',
    'NMN',
    'GRG',
  ], {
    R: 'thermal:redstone_servo',
    G: 'minecraft:iron_ingot',
    // C: "create:netherite_backtank",
    M: "minecraft:heart_of_the_sea",
    // N: "minecraft:nautilus_shell",
    N: "create:golden_sheet",
  });

  event.shaped(Item.of('kubejs:light_aqua_machine', 8), [
    ' R ',
    'MAM',
    ' M ',
  ], {
    A: 'kubejs:aqua_machine',
    // G: 'minecraft:iron_ingot',
    M: "minecraft:prismarine_crystals",
    R: 'thermal:redstone_servo',
  });

  //Hazmat suit grants fire and lava protection but has less durability
  event.shaped(Item.of('thermal:hazmat_fabric', 1), [
    'SRS',
    'MRM',
    'SRS',
  ], {
    R: 'thermal:cured_rubber',
    S: "kubejs:steel_string",
    M: "minecraft:magma_cream",
  });

  event.shaped(Item.of('thermal:diving_fabric', 1), [
    'S S',
    'SRS',
    'S S',
  ], {
    R: 'minecraft:prismarine_crystals',
    S: "minecraft:string",
  });

  /**
   * To prevent the hazmat suit from eclipsing the phoenix armor, the hazmat suit requires tungsten
   * The hazmat suit has very low durability, so that is going to be a factor that would help with the balance
   * The hazmat suit also protects against harmful potions, increases air supply and reduces fall damage
   * If because of the low durability, I decide to make this easier to obtain, do so by reducing/removing magma cream
   */
  event.shaped(Item.of('thermal:hazmat_helmet', 1), [
    'FIF',
    'IGI',
    'IAI'
  ], {
    F: 'thermal:hazmat_fabric',
    I: "northstar:tungsten_ingot",
    G: "#forge:glass",
    A: "kubejs:light_aqua_machine"
  });

  event.shaped(Item.of('thermal:hazmat_chestplate', 1), [
    'F F',
    'IFI',
    'FFF',
  ], {
    F: 'thermal:hazmat_fabric',
    I: "northstar:tungsten_ingot",
  });

  event.shaped(Item.of('thermal:hazmat_leggings', 1), [
    'FFF',
    'I I',
    'F F',
  ], {
    F: 'thermal:hazmat_fabric',
    I: "northstar:tungsten_ingot",
  });

  event.shaped(Item.of('thermal:hazmat_boots', 1), [
    'F F',
    'IRI',
  ], {
    F: 'thermal:hazmat_fabric',
    I: "northstar:tungsten_ingot",
    // R: "thermal:cured_rubber",
    R: "minecraft:leather",
  });

  /**
   * The diving helmet doesnt run out of durability nor does the player die as long as they are wearing it
   * Lets prevent this from eclipsing create helmet and backtank
   * The aether iron bubble provides infinite water breathing, and doesnt run out of durability, it can be obtained in a gold dungeon
   */
  event.shaped(Item.of('thermal:diving_helmet', 1), [
    'FGF',
    'GIG',
    'TBT'
  ], {
    F: 'thermal:diving_fabric',
    G: 'minecraft:gold_ingot',
    // I: "minecraft:conduit",
    I: "#forge:glass",
    B: "aether:iron_bubble",
    T: "minecraft:iron_ingot",
  });
  //The diving helmet does a damage hit but you cant die because it regenerates, so I think it might also be fare to add an alternative tungsten recipe
  event.shaped(Item.of('thermal:diving_helmet', 1), [
    'FGF',
    'GIG',
    'TBT'
  ], {
    F: 'thermal:diving_fabric',
    G: 'minecraft:gold_ingot',
    // I: "minecraft:conduit",
    B: "kubejs:aqua_machine",
    I: "#forge:glass",
    T: "northstar:tungsten_ingot",
  });

  //Dont make this too hard, but radial enhanncment is pretty good for any item
  //Allows increased radius
  event.shaped(Item.of('thermal:area_radius_augment', 1), [
    'GrG',
    'PtP',
    'GrG',
  ], {
    // t: 'thermal:tin_ingot',
    t: 'thermal:silver_gear',
    r: 'thermal:redstone_servo',
    G: 'thermal:gold_gear',
    P: 'kubejs:precision_component',
  });


  //The pulverizer allows a chance to get additional stuff (sometimes ore doubling), if using a catalyst
  //Pulverizer affectively increases diamond yield to about 1.5x (50% chance of additional diamond)
  event.shaped(Item.of('thermal:machine_pulverizer', 1), [
    ' b ',
    'sfs',
    'iri',
  ], {
    b: 'minecraft:blast_furnace',
    r: 'thermal:rf_coil',
    f: 'thermal:machine_frame',
    s: flintBlockID,
    // i: 'thermal:copper_gear',
    //Changed copper to signalum
    i: 'thermal:signalum_gear',
  });

  //This is only used for the drill, so it makes sense to add diamond
  event.recipes.create.mechanical_crafting('thermal:drill_head', [
    ' D ',
    'DDD',
    'iii',
    'ici'
  ], {
    c: 'minecraft:copper_ingot',
    i: 'minecraft:iron_ingot',
    D: '#forge:dusts/diamond',
  });


  // Since this is like an unbreakable pick, it needs some diamonds, we will put most on the drill head
  // It has infinite durability and can be upgraded with radial enhancment to mine 3x3, 5x5 or 7x7 blocks
  // These recipes roughly require 1 diamond chestplate, 1 netherite ingot, silver, presicion mechanism and rubber
  event.recipes.create.mechanical_crafting('thermal:flux_drill', [
    ' d ',
    'GWG',
    'trt',
    'NNN',
    //
    'EPE',
    'RER',
  ], {
    d: 'thermal:drill_head',
    r: 'thermal:rf_coil',
    N: 'thermal:netherite_plate',
    // W: 'kubejs:black_netherite_ingot',
    W: 'cataclysm:witherite_ingot',
    t: 'thermal:silver_gear',
    G: 'northstar:tungsten_sheet',
    E: 'thermal:enderium_gear',
    P: 'kubejs:precision_machine',
    R: 'thermal:cured_rubber',
  });

  event.recipes.create.mechanical_crafting('thermal:flux_saw', [
    ' d ',
    'ggg',
    'trt',
    'GGG',
    //
    'PPP',
    'RER',
  ], {
    d: 'thermal:saw_blade',
    r: 'thermal:rf_coil',
    G: 'thermal:netherite_plate',
    // W: 'kubejs:black_netherite_ingot',
    // W: 'minecraft:netherite_axe',
    t: 'thermal:silver_gear',
    g: 'create:sturdy_sheet',

    // i: '#forge:plates/iron',

    E: 'thermal:enderium_gear',
    P: 'create:precision_mechanism',
    R: 'thermal:cured_rubber',
  });

  //Thermal battery has 4 lead ingots, 1 electrum gear and 4 cured rubber
  //The original capacitor had 3 lead ingots, 3 redstone, 1 rf coil
  //Can recharge all items in inventory
  event.recipes.create.mechanical_crafting('thermal:flux_capacitor', [
    'aEa',
    'RrR',
    'lal',
    'lal'
  ], {
    r: 'thermal:rf_coil',
    l: 'thermal:lead_ingot',
    a: 'minecraft:redstone',
    //added
    R: 'thermal:cured_rubber',
    E: 'thermal:electrum_ingot',
  });

});