#is my predicate working as intended?
1 messages · Page 1 of 1 (latest)
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"type_specific": {
"type": "minecraft:player",
"looking_at": {
"type_specific": {
"type": "minecraft:player"
},
"equipment": {
"head": {
"items": "minecraft:barrier",
"components": {
"minecraft:equippable": {
"slot": "head",
"asset_id": "ghostfreak-tentacles"
}
}
}
}
}
}
}
}```
my goal is
to have this predicate be true when a player is looking at a player with an equippable barrier to the head slot on their head, with the asset_idea "ghostfreak-tentacles"
I tested this on essential (idk if that could've messed with it), and my friends didn't have the predicate run as true when looking at me under the desired conditions
You're close, but not quite
In your looking_at predicate, which is correctly under type_specific, you're again trying to add another type_specific predicate, instead of just checking if the entity type is a player
what's wrong w it?
I just said...
Remove the second type_specific, and instead check just if the "type" is minecraft:player
The other issue is probably that you're doing a components check on the barrier item. You're right that you want to check the component of the item, but a "components" check is different from a "predicates" check. "components" only returns true on an exact match, which it can't have if you don't define all of the fields of the specified component. A "predicates" check will however return true on a partial match--which is to say, as long as the specified fields are included in that component, regardless of what the other fields are
What you would probably want to do instead is a "predicates" check, but the equippable component can't be checked with a predicates check, so you'd instead need to give that item some custom data so you can check that component
oh damn
Yeah not quite, it's probably going to return true if the player is looking at any player right now
Or always false, could go either way
so I should instead check a custom data you're saying? instead of all the asset_id and equippable stuff?
Yep
so this is where I'm at
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"type_specific": {
"type": "minecraft:player",
"looking_at": {
"type": "minecraft:player",
"equipment": {
"head": {
"items": "minecraft:barrier",
"components": {
"minecraft:custom_data":
}
}
}
}
}
}
}
how do 'insert' ig my custom data into this
or wait
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"type_specific": {
"type": "minecraft:player",
"looking_at": {
"type": "minecraft:player",
"equipment": {
"head": {
"items": "minecraft:barrier",
"components": {
"minecraft:custom_data": "{ghostf-tent:1b}"
}
}
}
}
}
}
}```
so this is correct formatting?
Looks fine at a glance
okay thanks!
resolved