The presence of any data component, regardless of its exact value, is intended to be able to be checked within entity/block/item predicates via the predicates field.
Inexplicably, this works for all data components except for:
enchantmentspotion_contentsstored_enchantmentsvillager/variant
Steps to Reproduce:
Open a world with cheats enabled, or join a server with operator permissions.
Paste into the chat window either this command
execute if predicate {condition:"entity_properties",entity:"this",predicate:{predicates:{"minecraft:potion_contents":{}}}}or this command
execute if items entity @s weapon.mainhand *[minecraft:potion_contents~{}](they both show the same error, but the latter may be easier to navigate the component options as you can see the tab-complete list).
Try different data component IDs and see that they all are accepted, except for these 4 for some reason.
Expected Behavior:
The predicate can check for the existence of any data component by writing an empty object as its predicate.
Observed Behavior:
Only the previously mentioned 4 data components cause an error such as:
Malformed 'minecraft:potion_contents' predicate: 'Failed to parse either. First: Not a string; Second: Failed to parse either. First: Not a list: {}; Second: Not a string'
Thank you for your report!
We're tracking this issue in MC-307873, so this ticket is being resolved and linked as a Duplicate.
That ticket has already been resolved as Won't Fix, which means this is considered a bug but won't be fixed. The description of that ticket or the comments might explain the rationale. Please do not leave a comment on the linked ticket.
If you haven't already, please make use of the search feature to see if an issue you are about to report has already been reported.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki