1

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?

  • I think you had to include quotes around the names. – nine Aug 28 '15 at 18:04
  • Could you explain what you want to do with this command and what you want to fill in the name variable? – Gerret Aug 28 '15 at 18:26
  • That command does work if the item entity is called Test. I assume what you want is to select an item entity containing an item that has been renamed in an anvil? – SirBenet Aug 28 '15 at 18:26
  • @colorfusion yea, I want to use the item thats named with an anvil, I could just summon an item with a custom name but that would be temporary, and as soon as I pick it up it would be worthless – Enderploop Aug 28 '15 at 18:31
  • @Enderploop I'm pretty sure the name selector doesn't work on the Item entity. Correct me if I'm wrong. – Judge2020 Aug 28 '15 at 21:48
3

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.