How can I use /execute to run a command on a named item

How can I use /execute to run a command on a named item - Old tools on wooden surface

I'm trying to do /execute @e[type=Item,name=Test] ~ ~ ~ /setblock ~ ~ ~ minecraft:stone

Why does this not work? and what command should i be doing?



Best Answer

A workaround for this would be to use the Tag feature added in the 1.9 snapshots.
/scoreboard players tag @e[type=Item] add (tagname) {Item:{tag:{display:{Name:customname}}}}
This item is now marked with you tagname and you can use
/execute @e[type=Item,tag=tagname] ~ ~ ~ /setblock ~ ~ ~ minecraft:stone

If you cannot use the 1.9 snapshots, you can do the same thing by using a scoreboard objective instead of a tag, and setting the item's score to 1, then testing for that score.




Pictures about "How can I use /execute to run a command on a named item"

How can I use /execute to run a command on a named item - Strong sportsman using treadmill for cardio workout in gym
How can I use /execute to run a command on a named item - Stylish adult female using smartphone on street
How can I use /execute to run a command on a named item - Powerful young female athlete in activewear running along hill on background of mountainous landscape and listening to music in earphones during cardio training



How do you give a named item through commands?

How to Enter the Command
  • Open the Chat Window. The easiest way to run a command in Minecraft is within the chat window.
  • Type the Command. We will cover examples of how to use the /execute command that chain multiple execute commands together. Summon a Cat if within 5 blocks of a Specific Coordinate.


  • How do you use the execute command?

    How to get a Command Block
  • Enable cheats in your world or Realm settings.
  • Turn on Creative Mode in your world or Realm settings.
  • Open the chat box and enter \u201c/give [your username] command_block\u201d
  • Place the block where you want it.




  • ITEM DETECTION SYSTEM!? -- Command Block Tutorial




    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: Elijah O'Donnell, Andrea Piacquadio, Andrea Piacquadio, Andrea Piacquadio