There are two different types of potions for each potion even water. One can be tested for one can't and they both look identical. One type is by using the give command:
/give @p potion{Potion:fire_resistance}
The other is getting it from the creative inventory, brewing it, or if using water, filling it up with a water block.
/execute if entity @p[nbt={Inventory:[{id:"minecraft:potion",tag:{Potion:fire_resistance}}]}]
This detects only the ones that have to be produced by the command. The brewed can't be found.
Attachments
Comments 4
/give @p potion{Potion:"minecraft:fire_resistance"}
/execute if entity @p[nbt={Inventory:[{id:"minecraft:potion",tag:{Potion:"minecraft:fire_resistance"}}]}]
The brewed potions include the
minecraft:
namespace that you left out.