The syntax for clear is as following:
/clear [player] [item] [data] [maxCount] [dataTag]
Your command is as following:
/clear @a torch 1 1 {display:{Name:"Special Torch"}}
You are trying to clear (for everyone in the server) torches with a data value of 1, a max count of 1 and a name of "Special Torch".
Seeing as there are no torches with a data value of 1, try using the following:
/clear @a torch 0 1 {display:{Name:"Special Torch"}}
The item-specific data is stored in the tag
tag, meaning you'll have to add
tag:{HideFlags:1,display:{Name:"The Hulk",Lore:[The head of the Hulk]},SkullOwner:Oconna,ench:[{id:0,lvl:10}]}
to the id
and Slot
tags in the scoreboard command (cf. Item Structure), as shown below.
/scoreboard players set @a Hulk 1
{
Inventory:[
{
Slot:103b,
id:"minecraft:skull",
tag:
{
HideFlags:1,
display:{Name:"The Hulk",Lore:[The head of the Hulk]},
SkullOwner:Oconna,
ench:[{id:0,lvl:10}]
}
}]
}
Non-exploded view for copy-pasting:
/scoreboard players set @a Hulk 1 {Inventory:[{Slot:103b,id:"minecraft:skull",tag:{HideFlags:1,display:{Name:"The Hulk",Lore:[The head of the Hulk]},SkullOwner:Oconna,ench:[{id:0,lvl:10}]}}]}
Best Answer
You can actually combine this into one command. Prior to 1.13, this would look like this:
This will return an output if the player is holding a named diamond sword in the selected slot.
However, the above command has been completely deprecated in 1.13.
testfor
is now Bedrock only, and the[r=]
selector has been changed. You also can't really do anything with this testfor anyway, all it does is give a redstone output. A better and updated version for Java Edition 1.13 would be something along the following lines:This command executes <your item spawning command> at the position of a player within 10 blocks that matches the SelectedItem NBT.