1

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?

2

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}]
}
  • 1
    dataTags are not JSON, they are a custom format called NBT (Named Binary Tag). They are extremely different even if they appear the same. NBT does not allow quotes around names whatsoever, does not require quotes around strings, has extra declarations to determine datatype (byte, short, int, long, float, double, IntArray, etc.), and cannot have more than one datatype in an array (the first in the list determines the type that the remainder must have). Internally the "object" is referred to as a "compound". See here for more info. – Skylinerw Mar 31 '16 at 16:13
  • 1
    @Skylinerw Thank you very much! I forgot the name NBT, and hence overlooked this wiki article. – Orc JMR Apr 1 '16 at 8:01

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.