// priority: 976

ServerEvents.recipes((event) => {
  //MI Forge hammer additions
  event
    .custom({
      type: "modern_industrialization:forge_hammer",
      ingredient: {
        tag: "minecraft:logs",
      },
      result: {
        count: 1,
        id: "mekanism:sawdust",
      },
    })
    .id("ftb:forge_hammer_logs");

  //MI Coke Dust Recipes
  event.custom({
    type: "mekanism:crushing",
    input: { count: 1, item: "modern_industrialization:coke" },
    output: { count: 1, id: "modern_industrialization:coke_dust" }
  })
  .id("ftb:coke_crushing");

  event.custom({
    type: "mekanism:crushing",
    input: { count: 1, item: "modern_industrialization:coke_block" },
    output: { count: 9, id: "modern_industrialization:coke_dust" }
  })
  .id("ftb:coke_block_crushing");

  // //Enriched carbon from geode
  // event.custom({
  //     type: "mekanism:enriching",
  //     input: { count: 1, item: "geore:coal_shard" },
  //     output: { count: 1, id: "mekanism:enriched_carbon" },
  //   })
  //   .id("ftb:enriched_carbon_geode");

  // //Prosperity
  // event
  //   .custom({
  //     type: "mekanism:enriching",
  //     input: { count: 1, id: "jaopca:mekanism_dirty_dusts.prosperity" },
  //     output: { count: 1, id: "mysticalagriculture:prosperity_shard" },
  //   })
  //   .id("ftb:prosperity_shard");

  // Biofuel Rebalancing
  event.remove({ type: "mekanism:crushing", input: "#minecraft:leaves", output: "mekanism:bio_fuel"});
  event.custom({
      type: "mekanism:crushing",
      input: { count: 1, tag: "minecraft:leaves" },
      output: { count: 2, id: "mekanism:bio_fuel" },
  }).id(`ftb:biocrushing_broken_leaves`);

  // Biofuel
  event
    .custom({
      type: "mekanism:crushing",
      input: { count: 1, item: "xycraft_machines:resin_ball" },
      output: { count: 9, id: "mekanism:bio_fuel" },
    })
    .id(`ftb:biocrushing_resin`);

    //Fixing Meka's Netherite Dust being a valid output in certain recipes.
    let netherite_output_recipes = [
      "mekanism:processing/netherite/ingot_to_dust",
      "mekanism:processing/netherite/scrap_to_dust",
    ];

    netherite_output_recipes.forEach(recipe => {
        event.replaceOutput(
          { id: recipe },
          'mekanism:dust_netherite',
          'ftbmaterials:netherite_dust'
        );
    });

    //Fixing Meka's Fluorite Dust being a valid output in certain recipes.
    event.stonecutting("ftbmaterials:fluorite_stone_ore", "mekanism:fluorite_ore").id("ftbevolution:fluorite_ore_conversion");

    let fluorite_output_recipes = [
      "mekanism:processing/fluorite/to_ore",
      "modern_industrialization:quarry/titanium",
    ];

    fluorite_output_recipes.forEach(recipe => {
        event.replaceOutput(
          { id: recipe },
          "mekanism:fluorite_ore",
          "ftbmaterials:fluorite_stone_ore"
        );
    });

    //Fixing Deepslate Fluorite Ore Meka Recipe
    event.replaceOutput({ id: "mekanism:processing/fluorite/to_deepslate_ore" }, "mekanism:deepslate_fluorite_ore","ftbmaterials:fluorite_deepslate_ore");


});
