TransWikia.com

How do I detect if an armour stand has something on its head?

Arqade Asked by Lago on May 15, 2021

I need to know how to detect if an armour stand has a helmet on its head.
By that, I mean any item, such as a player head or other item.
I already tested something like :

execute as @e[type=armor_stand,nbt:{ArmorItems:[{},{},{},{id:"player_head",Count:1b}]}]

But unfortunately, this is not working. How can I make it work?

(I’m porting this to a data pack if anyone is curious)

I am in 1.16.5.

One Answer

Well a way to test this would be to use the replace item command, as you might already know, when a command block is executed it emits a redstone signal, so you could have a command block running to test if there is a helmet on the armor stand, you can do this by constantly replacing the armor stands helmet piece with air, and once someone puts a helmet on it, it will emit a redstone signal and then be removed. Here's the command:

/replaceitem entity <target> slot.armor.head air 1

Just make sure there is a slight delay between the time the helmet is placed and the time the helmet is removed. If you have any further questions feel free to ask me.

Answered by Crazed on May 15, 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