ServerEvents.recipes((event) => {
  const recipes = [
    // ores
    {
      output: "minecraft:iron_ore",
      input: "9x exdeorum:iron_ore_chunk",
    },
    {
      output: "minecraft:gold_ore",
      input: "9x exdeorum:gold_ore_chunk",
    },
    {
      output: "minecraft:copper_ore",
      input: "9x exdeorum:copper_ore_chunk",
    },
    {
      output: "immersiveengineering:ore_aluminum",
      input: "9x exdeorum:aluminum_ore_chunk",
    },
    {
      output: "thermal:silver_ore",
      input: "9x exdeorum:silver_ore_chunk",
    },
    {
      output: "thermal:lead_ore",
      input: "9x exdeorum:lead_ore_chunk",
    },
    {
      output: "thermal:nickel_ore",
      input: "9x exdeorum:nickel_ore_chunk",
    },
    {
      output: "immersiveengineering:ore_uranium",
      input: "9x exdeorum:uranium_ore_chunk",
    },
    {
      output: "mekanism:osmium_ore",
      input: "9x exdeorum:osmium_ore_chunk",
    },
    {
      output: "thermal:tin_ore",
      input: "9x exdeorum:tin_ore_chunk",
    },
    {
      output: "infinity_nexus_mod:zinc_ore",
      input: "9x exdeorum:zinc_ore_chunk",
    },
    {
      output: "infinity_nexus_mod:infinity_ore",
      input: "9x kubejs:infinity_ore_chunk",
    },
    {
      output: "occultism:iesnium_ore",
      input: "9x kubejs:iesnium_ore_chunk",
    },
    {
      output: "silentgear:crimson_iron_ore",
      input: "9x kubejs:crimson_ore_chunk",
    },
    {
      output: "silentgear:azure_silver_ore",
      input: "9x kubejs:azure_silver_ore_chunk",
    },

    //raw ores

    {
      output: "minecraft:raw_iron",
      input: "4x exdeorum:iron_ore_chunk",
    },
    {
      output: "minecraft:raw_gold",
      input: "4x exdeorum:gold_ore_chunk",
    },
    {
      output: "minecraft:raw_copper",
      input: "4x exdeorum:copper_ore_chunk",
    },
    {
      output: "immersiveengineering:raw_aluminum",
      input: "4x exdeorum:aluminum_ore_chunk",
    },
    {
      output: "thermal:raw_silver",
      input: "4x exdeorum:silver_ore_chunk",
    },
    {
      output: "thermal:raw_lead",
      input: "4x exdeorum:lead_ore_chunk",
    },
    {
      output: "thermal:raw_nickel",
      input: "4x exdeorum:nickel_ore_chunk",
    },
    {
      output: "immersiveengineering:raw_uranium",
      input: "4x exdeorum:uranium_ore_chunk",
    },
    {
      output: "mekanism:raw_osmium",
      input: "4x exdeorum:osmium_ore_chunk",
    },
    {
      output: "thermal:raw_tin",
      input: "4x exdeorum:tin_ore_chunk",
    },
    {
        output: "infinity_nexus_mod:raw_zinc",
        input: "4x exdeorum:zinc_ore_chunk",
    },
    {
        output: "infinity_nexus_mod:raw_infinity",
        input: "4x kubejs:infinity_ore_chunk",
    },
    {
        output: "occultism:raw_iesnium",
        input: "4x kubejs:iesnium_ore_chunk",
    },
    {
        output: "silentgear:raw_crimson_iron",
        input: "4x kubejs:crimson_ore_chunk",
    },
    {
        output: "silentgear:raw_azure_silver",
        input: "4x kubejs:azure_silver_ore_chunk",
    }
  ];

  recipes.forEach((recipe) => {
    const parts = recipe.output.split(":");
    const itemName = parts[1];
    const id = `infinitynexus:${itemName}_from_chunks`;

    // Separar a quantidade e o item do input
    const inputParts = recipe.input.split("x ");
    const quantity = parseInt(inputParts[0].trim(), 10);
    const item = inputParts[1].trim();

    // Adicionar a receita personalizada com a quantidade correta
    event
      .custom({
        type: "minecraft:crafting_shapeless",
        result: {
          item: recipe.output,
        },
        ingredients: Array(quantity).fill({ item: item }), // Usar um array de objetos repetidos conforme a quantidade
      })
      .id(id);
  });
});
