ServerEvents.recipes((event) => {
  //NITER
  event.replaceOutput(
    //replace Thermal Niter dust with IE Nitrate dust
    { output: "thermal:niter_dust" }, // Arg 1: the filter
    "thermal:niter_dust", // Arg 2: the item to replace
    "immersiveengineering:dust_saltpeter", // Arg 3: the item to replace it with
  );
  event.replaceInput(
    //replace Thermal Niter dust with IE Nitrate dust
    { input: "thermal:niter_dust" },
    "thermal:niter_dust",
    "immersiveengineering:dust_saltpeter",
  );

  //FERTILIZERS
  event.replaceOutput(
    //replace IE industrial fertilizer with Thermal phyto-gro
    { output: "immersiveengineering:fertilizer" },
    "immersiveengineering:fertilizer",
    "thermal:phytogro",
  );
  event.replaceInput(
    //replace IE industrial fertilizer with Thermal phyto-gro
    { input: "immersiveengineering:fertilizer" },
    "immersiveengineering:fertilizer",
    "thermal:phytogro",
  );

  //GUNPOWDER
  event.remove(
    { id: "thermal:gunpowder_4" }, //4 gunpowder recipes use crystals
  );
  event.shapeless(
    //4 gunpowder recipes use crystals
    Item.of("minecraft:gunpowder", 4), // arg 1: output
    [
      "minecraft:charcoal",
      "2x thermal:niter", // arg 2: the array of inputs
      "thermal:sulfur",
    ],
  );

  //ROCKWOOL
  event.remove(
    [
      { id: "thermal:rockwool/white_rockwool_from_smelting" },
      { id: "thermal:furnace_1240187909" },
    ], //removing smelting recipes, blasting recipes stay. Increasing clarity of JEI results
  );

  // CREATE CRAFTS & ADDITIONS
  event.replaceInput(
    //barbed crafted with steel
    { output: "createaddition:barbed_wire" },
    "createaddition:iron_wire",
    "immersiveengineering:wire_steel",
  );
  event.replaceInput(
    //copper spool for ie wires
    { input: "createaddition:copper_spool" },
    "createaddition:copper_spool",
    "immersiveengineering:wirecoil_copper",
  );

  // XK'S DECO
  event.replaceInput(
    // cause roofs were removed
    { output: "xkdeco:roofed_lamp" },
    "xkdeco:black_roof_ridge",
    "minecraft:black_terracotta",
  );

  event.remove({ output: "xkdeco:bronze_block" }); // adding better recipes for xk's bronze blocks and steel
  event.stonecutting("thermal:bronze_block", "xkdeco:bronze_block");
  event.stonecutting("xkdeco:bronze_block", "thermal:bronze_block");
  event.remove({ id: "xkdeco:steel_block" });
  event.stonecutting(
    "immersiveengineering:storage_steel",
    "xkdeco:steel_block",
  );
  event.stonecutting(
    "xkdeco:steel_block",
    "immersiveengineering:storage_steel",
  );
});
