TransWikia.com

How to detect if a player is wearing a piece of armor with a custom model data?

Arqade Asked by Nikolai on March 18, 2021

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

One Answer

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?

Answered by ExpertCoder14 on March 18, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP