Not summon but add so I tried
/entitydata @e[type=ArmorStand] {Passengers:[{id:Cow}]}
But it doesn't work
You cannot do this directly for pre-existing entities. Passengers
(and Riding
before it) is only parsed when the mob is loaded/spawned. The /entitydata
command does not have access to this functionality.
Passengers
is not actually a valid tag for entity NBT merging/creation via commands. Instead, the /summon
command manually checks if you specified a list tag named "Passengers" in your input to handle instantiating new entities, while the remainder of your input is handled automatically by the target entity's NBT-reading functions. The /entitydata
command itself makes no use of the tag, so it is essentially ignored as the NBT-reading functions from the entity classes will not read that tag.
/summon Zombie ~ ~1 ~ {Passengers:[{id:"Cow"}],IsBaby:1b}
The CommandSummon
class looks for the "Passengers" tag, finds it, and instantiates the new entity. All the input data is then sent to the EntityZombie
class, which finds that IsBaby
is a valid tag but does not find that Passengers
is a valid tag (hence it being ignored).
/entitydata @e[type=Zombie] {Passengers:[{id:"Cow"}],IsBaby:0b}
The CommandEntityData
class does not look for the "Passengers" tag. The input data (after merging with the zombie's pre-existing data) is sent to the same NBT-reading function in the EntityZombie
class that /summon
was sending its data to. Same as before, it finds IsBaby
is valid while Passengers
is invalid.
The reason you see Passengers
in the command's last output data is because it shows you what it was provided before verification. If the entity already had passengers and you did not try to change them, it's because the output shown is taken from the NBT-writing function (used for storing entities to chunk files), which does write the host's passengers into a Passengers
list. But since the NBT-reading functions do not look for this tag, it will be ignored even in that case.
You will instead need to create a new entity and delete the old one.
/kill @e[type=ArmorStand]
/summon ArmorStand ~ ~1 ~ {Passengers:[{id:"Cow"}]}
/summon
command's class. The functionality for "Riding" (now "Passengers") was moved out of the command's class (along with entity class instantiation itself) to the chunk loader class, so is now more accessible/consolidated, but the concept of how the tag worked related to commands remained the same.
Commented
Jan 10, 2016 at 10:19