ServerEvents.tags('item', event => {

  const items = Ingredient.of(/dungeons_and_combat:.*/).stacks

  items.forEach(item => {
    const id = item.id

    // =========================
    // 🟢 EXCEÇÕES (ITENS INICIAIS)
    // =========================
    if (
      id.includes('oni') ||
      id.includes('rogue') ||
      id.includes('broken') ||
      id.includes('titan') ||
      id.includes('forgotten') ||
      id.includes('rotten') ||
      id.includes('heavy') ||
      id.includes('executioner') ||
      id.includes('bounty') ||
      id.includes('exiled') ||
      id.includes('compensation') ||
      id.includes('vagabond') ||

      // 🔥 OLD corrigido (não afeta gold)
      id.endsWith('_old') ||
      id.includes('_old_') ||
      id.startsWith('dungeons_and_combat:old_') ||

      // 🔥 ITEM ESPECÍFICO
      id === 'dungeons_and_combat:long_katana'
    ) {
      return
    }

    // 🔪 liberar APENAS dagger base
    if (id === 'dungeons_and_combat:dagger') {
      return
    }

    // =========================
    // 🌱 WOOD (LIBERADO)
    // =========================
    if (id.includes('wood') || id.includes('wooden')) {
      return

    // =========================
    // 🪨 STONE (LIBERADO)
    // =========================
    } else if (
      (id.includes('stone') && !id.includes('sandstone')) || 
      id.includes('cobble') || 
      id.includes('flint')
    ) {
      return

    // =========================
    // 🟠 COPPER (LIBERADO)
    // =========================
    } else if (id.includes('copper')) {
      return

    // =========================
    // 🟡 ARENITO → DIAMOND
    // =========================
    } else if (id.includes('sandstone')) {
      event.add('forge:diamond_tools', id)
      event.add('forge:diamond_armor', id)

    // =========================
    // 🪨 IRON TIER
    // =========================
    } else if (
      id.includes('iron') ||
      id.includes('steel') ||
      id.includes('bronze')
    ) {
      event.add('forge:iron_tools', id)
      event.add('forge:iron_armor', id)

    // =========================
    // 💰 GOLD TIER
    // =========================
    } else if (
      id.includes('gold') ||
      id.includes('electrum')
    ) {
      event.add('forge:golden_tools', id)
      event.add('forge:golden_armor', id)

    // =========================
    // 💎 DIAMOND TIER
    // =========================
    } else if (
      id.includes('diamond') ||
      id.includes('obsidian') ||
      id.includes('mythril') ||
      id.includes('silver') ||
      id.includes('platinum') ||
      id.includes('ender')
    ) {
      event.add('forge:diamond_tools', id)
      event.add('forge:diamond_armor', id)

    // =========================
    // 🔥 NETHERITE TIER
    // =========================
    } else if (
      id.includes('netherite') ||
      id.includes('dragon') ||
      id.includes('legend') ||
      id.includes('boss')
    ) {
      event.add('forge:netherite_tools', id)
      event.add('forge:netherite_armor', id)

    // =========================
    // ⚠️ FALLBACK
    // =========================
    } else {
      event.add('forge:diamond_tools', id)
      event.add('forge:diamond_armor', id)
    }
  })

})