-
Bug
-
Resolution: Unresolved
-
None
-
1.21.3
-
None
-
Community Consensus
-
(Unassigned)
The custom_data component sub-predicate succeeds if the sub-predicate value is an empty object (or string containing an empty SNBT compound), even if the item itself doesn't have any custom_data component present. This doesn't make any sense and is inconsistent with all other sub-predicates.
Steps to Reproduce
- Hold any item that does not have a custom_data component (e.g. any item from the creative inventory or the world) in your main hand.
- Use a predicate or if items to test this sub-predicate against the item you are holding
/execute if items entity @s weapon *[custom_data~{}]
or
/execute if predicate {condition:"minecraft:entity_properties",entity:"this",predicate:{equipment:{mainhand:{predicates:{"minecraft:custom_data":{}}}}}}
Observed Results
The sub-predicate always succeeds, even if the item does not have the custom_data component at all.
Expected Result
The sub-predicate only succeeds if the custom_data component is present, as there should be no NBT compound to compare against if there is no component, and to be more in-line with other component sub-predicates.
i.e. *[custom_data~{}] should behave identically to *[custom_data]