#test if minecraft:custom_name has any value (26.2).

1 messages · Page 1 of 1 (latest)

static tigerBOT
quasi citrus
#

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

south iris
#

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

wide aspen
# quasi citrus iirc `match_tool` only has any use for loot contexts (and maybe some advancement...

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": {}
}
}
}

south iris
#

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.

wide aspen
wide aspen
static tigerBOT
static tigerBOT