I need help specifying a testfor command!
As of right now the command is /testfor @e[type=Item,r=4] {Item:{id:minecraft:anvil}}
How can I test this anvil for a damage, enchant, or name tag?
Arqade is a question and answer site for passionate videogamers on all platforms. It only takes a minute to sign up.
Sign up to join this communityI need help specifying a testfor command!
As of right now the command is /testfor @e[type=Item,r=4] {Item:{id:minecraft:anvil}}
How can I test this anvil for a damage, enchant, or name tag?
To testfor the Item's damage, use the "Damage" tag.
/testfor @e[type=Item,r=4] {Item:{id:"minecraft:anvil",Damage:0s}}
To test for a custom name, you can use the "tag" tag. With this tag you can define NBT tags for non-entity items. (Items in a player's inventory) In this case, you need the "display" tag
/testfor @e[type=Item,r=4] {Item:{id:"minecraft:anvil",Damage:0s,tag:{display:{Name:"Custom Name Here"}}}}