Mobs with more than 1 data tag
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}]
}
Pictures about "Mobs with more than 1 data tag"
How do I get multiple NBT tags?
The NBT tag is always surrounded in {} such as {NoAI:1}. If there is more than one NBT tag used in a command, the NBT tags are separated by a comma such as {NoAI:1, IsBaby:1}. Each entity (or mob) has its own unique set of NBT tags. Select an entity to see the NBT tags that you can change.What does NBT stand for in Minecraft?
The Named Binary Tag (NBT) format is used by Minecraft for the various files in which it saves data. The format is described by Notch in a brief specification. The format is designed to store data in a tree structure made up of various tags. All tags have an ID and a name.The Complete Guide to /data and NBT Tags Tutorial in Minecraft Java Edition [1.18]
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Angela Roma, Sabrina Gelbart, Karolina Grabowska, Malte Luk