0

I am using an armor stand to display items by using the following command:

/summon armor_stand ~0 ~5.1 ~-1.1 {Invisible:1b,Invulnerable:1b,NoBasePlate:1b,NoGravity:1b,ShowArms:1b,Rotation:[180f],Pose:{RightArm:[270f,0f,90f]}}

I usually give the armor stand a custom wooden shovel by hand. The custom wooden shovel is the following command:

 /give @p minecraft:wooden_shovel{display:{Name:"[{\"text\":\"Ultimate Sniper\",\"bold\":true,\"color\":\"gold\"}]",},Enchantments:[{id:"mending",lvl:1}]} 1

Now what I want to do is to check if the armor stand is missing the wooden shovel from their hand, but I was not able to figure. I have tried the following command but it doesn't check for the item, it only check for the existence of the armor stand.

execute if entity @e[type=armor_stand,limit=1,sort=nearest,nbt=!{TileX:-1532,TileY:153,TileZ:-279,HandItems:[{id:"minecraft:wooden_shovel"}]}] run say test
2
  • Why are you using TileX, TileY, and TileZ? Those NBT tags only exist for the Item Frame, not in armor stands. Sep 1, 2020 at 23:06
  • It seems like they do work, the Tile system did detect the armor stand.
    – Firal
    Sep 3, 2020 at 22:01

1 Answer 1

1

So, I figured it out by myself. The solution was the following

execute as @e[x=-1532.5,y=153.6,z=-279,type=armor_stand,nbt={HandItems:[{id:"minecraft:wooden_shovel"}]}] run say test

Just use "as" instead of "if"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .