events.listen("recipes", function (e) {
  function CastGearTinker(entree, quantite, resultat1, name, resultat2, durée) {
    e.remove({ id: "thermal:parts/" + name + "_gear" });
    //cast sand
    e.custom({
      type: "tconstruct:casting_table",

      cast: {
        tag: "tconstruct:casts/single_use/" + resultat2,
      },
      cast_consumed: true,
      fluid: {
        name: entree + name,
        amount: quantite,
      },
      result: resultat1 + name + "_" + resultat2,

      cooling_time: durée,
    });
    // cast gold
    e.custom({
      type: "tconstruct:casting_table",

      cast: {
        tag: "tconstruct:casts/multi_use/" + resultat2,
      },
      cast_consumed: false,
      fluid: {
        name: entree + name,
        amount: quantite,
      },
      result: resultat1 + name + "_" + resultat2,

      cooling_time: durée,
    });
  }
  //gear
  var types = ["signalum", "lumium", "enderium"];
  types.forEach((S) => {
    CastGearTinker("kubejs:molten_", 576, "thermal:", S, "gear", 250);
    CastGearTinker("kubejs:molten_", 144, "thermal:", S, "plate", 100);
    CastGearTinker("kubejs:molten_", 16, "thermal:", S, "nugget", 20);
    CastGearTinker("kubejs:molten_", 144, "thermal:", S, "ingot", 100);
  });
  var types2 = ["diamond", "emerald", "quartz"];
  types2.forEach((A) => {
    CastGearTinker("tconstruct:molten_", 576, "thermal:", A, "gear", 130);
  });
  var types = [
    "iron",
    "gold",
    "copper",
    "lead",
    "silver",
    "nickel",
    "electrum",
    "constantan",
  ];
  types.forEach((S) => {
    CastGearTinker("tconstruct:molten_", 144, "thermal:", S, "plate", 100);
  });

  var types = ["lapis"];
  types.forEach((S) => {
    CastGearTinker("kubejs:molten_", 576, "thermal:", S, "gear", 250);
  });
});
