#tilda rather than equal
1 messages · Page 1 of 1 (latest)
= does exact match
~ does performs a item sub-predicate data component predicate
Data component predicates (historically known as item sub-predicates) are used to check conditions about data components. They are used in minecraft:item_predicate argument type, item modifiers, loot predicates, advancement criteria, and entity and block predicates. They return a pass or fail result to the invoker, who acts differently based on ...
the = checks for an exact match. This means that it will fail if your item's custom data contains {gui_chest:1b,another_key:1b} because that contains one more key. That's why we use ~ which only checks if all keys specified match which in this case is just gui_chest
There are other cases where the ~ can do even more powerful checks, like counting the number of diamonds in a shulkerbox etc.
thanks