{
  "criteria": {
    "requirement": {
      "trigger": "minecraft:villager_trade",
      "conditions": {
        "player": {
          "equipment": {
            "head": {
              "predicates": {
                "minecraft:custom_data": "{tradehat:tag}"
              }
            }
          }
        },
        "item": {
          "items": [
            "minecraft:emerald"
          ]
        }
      }
    }
  },
  "rewards": {
    "function": "survivalplus:tools/ability_hats/trade"
  }
}