Minecraft – Mobs with more than 1 data tag

minecraft-commandsminecraft-java-edition

I am making a custom map and this is my command for a mob:

/summon Zombie ~ ~ ~ {Equipment:[{id:minecraft:stone_sword},
  {id:minecraft:leather_boots},
  {id:minecraft:leather_leggings},
  {id:minecraft:leather_chestplate},
  {id:minecraft:leather_helmet}],
  CustomNameVisible:1,
  CustomName:"Knight"}

…but I need this on it too:

{Attributes:[{Name:generic.movementSpeed,Base:0.001}]}

How do I do this?

Best Answer

Each entity has only one data tag. It does not mean you cannot use different data in it.

Data tag in Minecraft is described in NBT format, textual representation of which is somewhat similar to JSON. Basically, it consists of compounds and arrays.

  • Compound is described as curly braces containing a list of property names and corresponding values:

    {CustomNameVisible:1, CustomName:"Knight"}

  • Array is a list of values without names:

    [{}, {}, {}, {}]

So, a data tag is a NBT compound. When it is empty, it looks like {}. To that compound, you add properties: Equipment, CustomNameVisible, etc. Attributes is just another property, so you can add it with a comma to outermost braces, like that:

/summon Zombie ~ ~ ~ {
 Equipment:[...],
 CustomNameVisible:1,
 CustomName:"Knight",
 Attributes:[{Name:generic.movementSpeed,Base:0.001}]
}
Related Topic