The custom_data component sub-predicate can succeed for items with no custom_data component
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]
2024-11-20, 01:35 AM
2024-12-19, 08:36 AM
2
1
-