How do I teleport armor stands to entities?

For one of my maps, I need to teleport an armor stand to a diamond. How do I do this?
Best Answer
You can use the @e selector to find the Armor Stand, for example/tp @e[type=ArmorStand] x y z
This will work if you know exactly where the diamond will be, but if the position may vary, things get a bit more complicated. I don't think there's an easy way to get the NBT data from the diamond to differentiate it from other dropped items, so you would have to use the scoreboard tags to find the item (this requires using the 1.9 snapshots, there's a way for 1.8 too, but it's even more complicated):
/scoreboard players tag @e[type=Item] add (tagname) {Item:{id:minecraft:diamond}}
This will Mark all dropped diamonds with whatever name you put for tagname. From here, to teleport the diamond to the marked item you can use the command /tp @e[type=ArmorStand] @e[tag=(tagname)]
If you need to teleport a specific armor stand without affecting any others on the map, you can use the tag command again, except swapping the selector and tagname, as well as removing the NBT data from the end.
Pictures about "How do I teleport armor stands to entities?"



How do you teleport an armor stand with a name?
/tp \\@e[type=armor_stand,name=custom_name] destination.How do you teleport to entities?
Once Minecraft players have ensured their cheats are enabled, simply opening the chat window and typing a few words can move entities at will. The syntax, "/tp @e[type=mobtype] (x-coordinate) (y-coordinate) (z-coordinate)" is used to move mobs of a certain type to a particular set of coordinates.How do you teleport to an entity in Minecraft?
You can use the /teleport command to teleport a player or entity to a set of coordinates in the game (see also /tp command).Can you move armor stands?
Armor stands are entities, allowing them to be pushed by pistons, moved by flowing water, pulled with fishing rods, and bounced by slime blocks.(Command Block Tutorials) How to teleport armor stands in MCPE and Java
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Gioele Fazzeri, Art Guzman, Brett Jordan, Brett Jordan