How to testfor a dropped item?
Solution 1:
You want this command:
/testfor @e[type=Item] {Item:{tag:{display:{Name:"spear"}}}}
Or, if you have more items named "spear" use this:
/testfor @e[type=Item] {Item:{id:minecraft:stick,tag:{display:{Name:"spear"}}}}
Now just hook this on a Redstone clock/Put it into a Repeat Command block and you're done!
If you have only 1 command following this, use tags and the /execute
command:
/scoreboard players tag @e[type=Item] add IsSpear {Item:{tag:{display:{Name:spear}}}}
And instead of the /testfor
command use /execute
:
/execute @e[type=Item,tag=IsSpear] ~ ~ ~ /yourcommand