The bug
The has_property selector argument selects entities with a specified value for certain entity properties. For example has_property={minecraft:climate_variant="temperate"}selects all temperate farm animals.
When the value is inverted using !, it’s expected that the check is inverted. That is to say, in this example, it should select all entities except temperate farm animals. However, what it actually selects is all entities with the minecraft:climate_variant property set to a non-temperate value, as well as entities with no properties. It fails to select entities that have properties, but don’t have the minecraft:climate_variant property. This table demonstrates the issue:
Mob | Positive check ( | Negated check ( |
|---|---|---|
Temperate cow | Match ✅ | No match ✅ |
Cold pig | No match ✅ | Match ✅ |
Armadillo | No match ✅ | No match ❌ |
Goat | No match ✅ | Match ✅ |
How to reproduce
Spawn an armadillo and a goat
Run
/testfor @e[has_property={minecraft:climate_variant=!"temperate"}]
Expected result
Both entities should be found, since neither of them have the minecraft:climate_variant property set to temperate.
Observed result
Only the goat is found, since it has no properties at all. The armadillo is not found.
Notes
If it’s intended that all entities without the specified property are excluded, even when the value is negated, then the goat should be excluded as well. There is no reason that one should be found but not the other.
Comments 0
No comments.