#test if minecraft:custom_name has any value (26.2).
1 messages · Page 1 of 1 (latest)
iirc match_tool only has any use for loot contexts (and maybe some advancements?) so if this is just for a predicate on its own you'd need to use something like entity_properties testing a specific slot or equipment
the actual item predicate should be correct, though. just needs to be placed in a context with information the predicate has access to
You have to use if data I am afraid
That or a predicate like: { "condition": "minecraft:entity_properties", "entity": "this", "predicate": { "minecraft:slots": { "container.0": { "predicates": { "minecraft:custom_name": {} } } } } }
The slot here is wrong, but this is basically the same as your if items
So if your if items doesn't work this won't either
i have an advancement with trigger "item_durability_changed" and i am referencing the predicate. i feel like there is no consistency in the predicates.
this passes when the item has any name and fails when it has no name - meaning it is testing for the exictence of the component.
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"minecraft:equipment": {
"mainhand": {
"predicates": {
"minecraft:custom_name": {}
}
}
}
}
}
this is trying to test for the value of custom_name to be an empty object {}. Therefor it passes when the item has no name and fails when it has a name.
{
"condition": "minecraft:match_tool",
"predicate": {
"predicates": {
"minecraft:custom_name": {}
}
}
}
What is the actual thing you are trying to achieve. We usually use custom_data or actual behavior driving components
using customname to branch behavior is a bad idea to begin with.
this should work. i have done a lot of testing but i cannot exactly get to the bottom of why they act so differently - i am 99% sure i found a solution for both my cases tho
i am trying to test if an item is named or has any enchantments to evaluate if that item is meaningful