3

Not summon but add so I tried

/entitydata @e[type=ArmorStand] {Passengers:[{id:Cow}]}

But it doesn't work

5

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

/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

/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"}]}
  • I'm amazed at your knowledge of the inner workings of Minecraft. Are you reading the code yourself? – MrLemon Jan 10 '16 at 9:18
  • 2
    @MrLemon Aye, I use MCP for a deobfuscated look into 1.8 and then decompile the snapshot jars myself and compare them. It can get tricky since the snapshots are obfuscated, but in this case there's not too much changed between 1.8 and 1.9 for the /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. – Skylinerw Jan 10 '16 at 10:19

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.