In Java Minecraft 1.14, I tried to use the execute command as basics. And on some NBT Tags, it works (e.g. XP: /execute as @e[type=minecraft:villager] if entity @s[nbt={Xp:0}] run tp @p)
, but for most, it does not.
I especially tried to run commands for villagers of certain professions, and my best attempt was /execute as @e[type=minecraft:villager] if entity @s[nbt={VillagerData:{Profession:farmer}}] run tp @p
, but - as far as I understand - it detects no entities at all, no matter what entities exist (because without the run
part of both commands the first one tests for all villagers that meet the conditions successfully with - logically - one detected, but the second has just no output whatsoever).