How to detect if a player is wearing a piece of armor with a custom model data?
I am trying to detect if a player is wearing a custom armor piece to then give them an effect, up to now I have gotten to the point were I can detect the armor piece but not the custom model data:
/execute if entity @p[nbt={abilities:{flying:0b},FallFlying:1b},nbt={Inventory:[{Slot:102b,id:"minecraft:elytra"}]}] run say detected
This is the item:
/give @p minecraft:elytra{CustomModleData:phanom_glider} 1
You misspelled CustomModelData
as CustomModleData
in the 2nd command.
And you don't seem to have a check for the CustomModelData
in your first command, perhaps you should include one?
Inventory:[{Slot:102b,id:"minecraft:elytra",tag:{CustomModelData:1}}]
Additionally, the CustomModelData
is an integer tag, not a string, perhaps check your setup?