As of 14w10c, this is possible using scoreboard values.
First, you need to set up a dummy scoreboard variable. I used "sneaky" as my variable, but you can really use whatever you want (as long as you change the commands as appropriate). To set this up, you just need to use the command /scoreboard objectives add sneaky dummy
. You only need to do this once.
I had to set up the command blocks in a very specific pattern for them to work, as shown:
![Command block setup](https://i.stack.imgur.com/xOv8e.png)
I think this has something to do with how command blocks handle firing off "simultaneously". The comparator in this setup is in subtraction mode, creating a "comparator clock" which pulses very quickly.
The command blocks on the left are your scoreboard related commands. The one on the bottom left sets "sneaky" to 0 for all players:
/scoreboard players set @a sneaky 0
The command block on the top left sets "sneaky" to 1 for all players with the stealth boots equipped:
/scoreboard players set @a sneaky 1 {Inventory:[{Slot:100b,tag:{display:{Name:"Stealth Boots"}}}]}
The command blocks on the right are your effect commands. They give players the invisibility effect, or take it away, as appropriate. The one on the bottom clears the invisibility effect from all players without the stealth boots:
/effect @a[score_sneaky=0] 14 0 0
The top one gives the invisibility effect to all players with the stealth boots:
/effect @a[score_sneaky_min=1] 14 30000
In 1.13 and above you can add quotes to the name in the selector, like so:
/kill @e[name="Grumpy Bill"]
In 1.12 and below a selector cannot test for a name with spaces or most symbols; it is marked on the bug tracker as "Won't Fix" (but is fixed in 1.13+).
You can however select them by NBT data with their "CustomName" tag. Like this:
/testfor @e {CustomName:"Grumpy Bill"}
If you want to do something other than test for them existing, you'll need to create a dummy scoreboard objective, objectiveName, and then run something like this:
/scoreboard players set @e objectiveName 1 {CustomName:"Grumpy Bill"}
And then:
/kill @e[score_objectiveName_min=1]
Best Answer
The error you are getting simply means that no entity can be found that matches your target selector. Basically, the target selector then returns NULL, which is not a valid UUID, hence the message.
As to why your command fails, you have confused target selector arguments with data tags, which represent NBT data. While some target selector arguments duplicate checking for NBT data, for example
[name=Bob] <-> {CustomName:Bob}
, these are different things. In particular, some commands are unable to check NBT data altogether, such asexecute
(scoreboard
does, and is therefore a common very workaround to turn NBT into a target selector).Luckily,
testfor
is able to check matching NBT data as an optional argument:There is another issue with your command, which is that the
Inventory
data tag is only valid for players. Mobs have anEquipment
tag instead, which is a list of 5 Item tags (Hand, Feet, Legs, Chest, Head). Due to Minecraft's partial tag matching, you can leave the other 4 tags empty:In order to make your command work, you should use
For reasons unknown to me, you need to use the full item id, including the
minecraft:
prefix. Using onlyid:golden_helmet
does not work.