ItemEvents.tooltip((event) => {
  // Tooltips existentes
  event.add(
    [
      "gobber2:gobber2_helmet_dragon",
      "gobber2:gobber2_chestplate_dragon",
      "gobber2:gobber2_leggings_dragon",
      "gobber2:gobber2_boots_dragon",
    ],
    "§4Não garante voo creativo!§r"
  );
  event.add(
    [
      "forbidden_arcanus:edelwood_stick",
      "forbidden_arcanus:edelwood_log",
      "forbidden_arcanus:carved_edelwood_log",
      "forbidden_arcanus:edelwood_branch",
    ],
    "§bFaça uma §9Growing Edelwood §b(sapling - muda)!§r"
  );
  event.add(
    [
      "extendedcrafting:basic_auto_table",
      "extendedcrafting:advanced_auto_table",
      "extendedcrafting:elite_auto_table",
      "extendedcrafting:ultimate_auto_table",
      "extendedcrafting:auto_ender_crafter",
      "extendedcrafting:auto_flux_crafter",
    ],
    [
      "§eApós setar a receita e clicar com o Shift no",
      "§enúmero para salvar, coloque os items em um Barril",
      "§eou Baú em cima. Não adianta colocar o",
      "§eProvedor de Padrões ou Crafter diretamente na máquina§r",
    ]
  );

  event.add(
    [
      "immersiveengineering:cloche",
      "thermal:machine_insolator",
      "industrialforegoing:hydroponic_bed",
    ],
    ["§l§4Este bloco tem seu uso limitado.", "§l§4Limite de uso:32x por base"]
  );

  event.add(
    [
      "botanypots:terracotta_botany_pot",
      "botanypots:terracotta_hopper_botany_pot",
      "botanypotstiers:elite_terracotta_botany_pot",
      "botanypotstiers:elite_terracotta_hopper_botany_pot",
      "botanypotstiers:ultra_terracotta_botany_pot",
      "botanypotstiers:ultra_terracotta_hopper_botany_pot",
      "botanypotstiers:creative_terracotta_botany_pot",
      "botanypotstiers:creative_terracotta_hopper_botany_pot",
    ],
    [
      "§l§4Este bloco tem seu uso limitado e conjugado com os outros tiers",
      "§l§4Limite de uso:50x por base",
      "(§l§ebotanypots:terracotta_botany_pot",
      "§l§ebotanypots:terracotta_hopper_botany_pot",
      "§l§ebotanypotstiers:elite_terracotta_botany_pot",
      "§l§ebotanypotstiers:elite_terracotta_hopper_botany_pot",
      "§l§ebotanypotstiers:ultra_terracotta_botany_pot",
      "§l§ebotanypotstiers:ultra_terracotta_hopper_botany_pot",
      "§l§ebotanypotstiers:creative_terracotta_botany_pot",
      "§l§ebotanypotstiers:creative_terracotta_hopper_botany_pot§r)",
    ]
  );

  event.add(
    ["infinity_nexus_mod:matter_condenser", "exmachinis:flux_sieve"],
    ["§l§4Este bloco tem seu uso limitado.", "§l§4Limite de uso:10x por base"]
  );
  event.add(
    ["exmachinis:flux_hammer"],
    ["§l§4Este bloco tem seu uso limitado.", "§l§4Limite de uso:30x por base"]
  );
  event.add(
    ["hostilenetworks:sim_chamber"],
    ["§l§4Este bloco tem seu uso limitado.", "§l§4Limite de uso:20x por base"]
  );

  // Adicionar tooltip para itens que podem ser empilhados até 64
  const stackSize64Items = [
    "minecraft:ender_pearl",
    "minecraft:snowball",
    "minecraft:egg",
    "minecraft:potion",
    "minecraft:splash_potion",
    "minecraft:lingering_potion",
    "minecraft:honey_bottle",
    "minecraft:armor_stand",
    "minecraft:end_crystal",
    "minecraft:turtle_egg",
    "reliquary:potion",
    "reliquary:splash_potion",
    "reliquary:lingering_potion",
  ];

  event.add(stackSize64Items, "§eEste item pode ser empilhado até 64.§r");

  event.add(
    [
      "enderio:clear_glass",
      "enderio:fused_quartz",
      "ae2:fluix_smart_cable",
      "ae2:fluix_covered_cable",
      "ae2:fluix_glass_cable",
      "ae2:fluix_covered_dense_cable",
      "ae2:fluix_smart_dense_cable",
    ],
    [
      "As variantes deste item foram apenas ocultas do JEI, mas ainda assim podem ser craftadas.",
      "Para ver o craft das variantes deste item aperte a tecla §6U§r ou o §6Botão direito do mouse§r sobre ele§r.",
    ]
  );

  event.add(
    ["infinity_nexus_miner:miner"],
    [
      "§fWood Structure: 5x5.",
      "§fStone Structure: 5x5.§r",
      "§eCopper Structure: 7x7.",
      "§eIron Structure: 7x7.",
      "§cGold Structure: 9x9.§r",
      "§cQuartz Structure: 9x9.§r",
      "§5Diamond Structure: 11x11.",
      "§5Emerald Structure: 11x11.§r",
      "§9Netherite Structure: 11x11.",
    ]
  );

  event.add(["infinity_nexus_mod:voxel_cube"], ["§6Eu sou você!!!"]);

  let colorfulnames = [
    {
      id: "infinity_nexus_mod:imperial_infinity_sword",
      name: "Imperial Infinity Sword",
      nodes: [
        [255, 255, 255],
        [0, 255, 255],
      ],
      length: 5,
      time: 3,
    },
    // add more items here
  ];

  for (let i = 0; i < colorfulnames.length; i++) {
    let cname = colorfulnames[i];
    event.addAdvanced(cname.id, (item, advanced, text) => {
      let offset =
        Math.floor(Client.player.age / cname.time) %
        (cname.nodes.length * cname.length);
      let namearray = cname.name.split("");
      let coloredname = [];
      for (let j = 0; j < namearray.length; j++) {
        let pos = (j + offset) % (cname.nodes.length * cname.length);
        let newcolor = 0;
        for (let k = 0; k < 3; k++) {
          newcolor +=
            Math.pow(256, 2 - k) *
            (cname.nodes[Math.floor(pos / cname.length) % cname.nodes.length][
              k
            ] +
              Math.floor(
                ((cname.nodes[
                  (Math.floor(pos / cname.length) + 1) % cname.nodes.length
                ][k] -
                  cname.nodes[
                    Math.floor(pos / cname.length) % cname.nodes.length
                  ][k]) /
                  cname.length) *
                  (pos % cname.length)
              ));
        }
        coloredname.push(Text.of(namearray[j]).color(newcolor));
      }
      text.set(0, coloredname);
    });
  }

  /*let itemsWithDurability = [
    {
      id: "minecraft:diamond_sword",
      color: Text.red, // specific color for this item
    },
    {
      id: "minecraft:iron_sword",
      color: Text.green, // specific color for this item
    },
    {
      id: "minecraft:netherite_sword",
      color: Text.blue, // specific color for this item
    },
    // add more items here if necessary
  ];

  for (let i = 0; i < itemsWithDurability.length; i++) {
    let itemConfig = itemsWithDurability[i];

    event.addAdvanced(itemConfig.id, (item, advanced, text) => {
      const maxDurability = item.getMaxDamage();
      const currentDurability = maxDurability - item.getDamageValue();

      // durability text (only if not been added yet)
      if (!text.toString().includes("durability")) {
        text.add(itemConfig.color(`${currentDurability} / ${maxDurability}`));
      }
    });
  }*/
});
