Nbt tags

Алан-э-Дейл       09.09.2023 г.

History[]

The NBT file format was described by Notch in a brief specification.

The original known version was 19132 as introduced in Beta 1.3, and since then has been updated to 19133 with the Anvil file format, which adds the tag. The NBT format dates all the way back to Indev with tags 0 to 10 in use.

Java Edition
1.0.0 Notch works on «saving arbitrary data with item instances.»
1.8 14w03a NBT data now supports using string IDs rather than numerical IDs.
1.12 ? Added long array tags.
1.13 18w01a Added a data generator to both the Minecraft client and the default multiplayer software.
1.14 19w08a String tags in SNBT can now be within single quotes in addition to double quotes .

TAG definition[]

A tag is an individual part of the data tree. The first byte in a tag is the tag type (ID), followed by a two byte big-endian unsigned integer for the length of the name, then the name as a string in UTF-8 format (Note TAG_End is not named and does not contain the extra 2 bytes; the name is assumed to be empty). The name of tags may contain spaces, although Minecraft itself never saves tags with spaces in the names. Finally, depending on the type of the tag, the bytes that follow are part of that tag’s payload. This table describes each of the 13 known tags in version 19133 of the NBT format:

ID Icon Tag Type Payload SNBT Format[Java edition only] Description Storage Capacity
TAG_End None. Used to mark the end of compound tags. This tag does not have a name, so it is only ever a single byte 0. It may also be the type of empty List tags. N/A
1 TAG_Byte 1 byte / 8 bits, signed or A signed integral type. Sometimes used for booleans. Full range of -(27) to (27 — 1)(-128 to 127)
2 TAG_Short 2 bytes / 16 bits, signed, big endian or A signed integral type. Full range of -(215) to (215 — 1)(-32,768 to 32,767)
3 TAG_Int 4 bytes / 32 bits, signed, big endian A signed integral type. Full range of -(231) to (231 — 1)(-2,147,483,648 to 2,147,483,647)
4 TAG_Long 8 bytes / 64 bits, signed, big endian or A signed integral type. Full range of -(263) to (263 — 1)(-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807)
5 TAG_Float 4 bytes / 32 bits, signed, big endian, IEEE 754-2008, binary32 or A signed floating point type. Precision varies throughout number line;See Single-precision floating-point format. Maximum value about 3.4*1038
6 TAG_Double 8 bytes / 64 bits, signed, big endian, IEEE 754-2008, binary64 , or A signed floating point type. Precision varies throughout number line;See Double-precision floating-point format. Maximum value about 1.8*10308
7 TAG_Byte_Array TAG_Int’s payload size, then size TAG_Byte’s payloads. An array of bytes. Maximum number of elements ranges between (231 — 9) and (231 — 1) (2,147,483,639 and 2,147,483,647), depending on the specific JVM.
8 TAG_String A TAG_Short-like, but instead unsigned payload length, then a UTF-8 string resembled by length bytes. , (Πρότυπο:Cd within needs to be escaped to Πρότυπο:Cd), or (Πρότυπο:Cd within needs to be escaped to Πρότυπο:Cd) A UTF-8 string. It has a size, rather than being null terminated. 65,535 bytes interpretable as UTF-8 (see ; most commonly-used characters are a single byte).
9 TAG_List TAG_Byte’s payload tagId, then TAG_Int’s payload size, then size tags’ payloads, all of type tagId. A list of tag payloads, without repeated tag IDs or any tag names. Due to JVM limitations and the implementation of ArrayList, the maximum number of list elements is (231 — 9), or 2,147,483,639. Also note that List and Compound tags may not be nested beyond a depth of 512.
10 TAG_Compound Fully formed tags, followed by a TAG_End. A list of fully formed tags, including their IDs, names, and payloads. No two tags may have the same name. Unlike lists, there is no hard limit to the number of tags within a Compound (of course, there is always the implicit limit of virtual memory). Note, however, that Compound and List tags may not be nested beyond a depth of 512.
11 TAG_Int_Array TAG_Int’s payload size, then size TAG_Int’s payloads. An array of TAG_Int’s payloads. Maximum number of elements ranges between (231 — 9) and (231 — 1) (2,147,483,639 and 2,147,483,647), depending on the specific JVM.
12 TAG_Long_Array TAG_Int’s payload size, then size TAG_Long’s payloads. An array of TAG_Long’s payloads. Maximum number of elements ranges between (231 — 9) and (231 — 1) (2,147,483,639 and 2,147,483,647), depending on the specific JVM.

The List and Compound tags can be and often are recursively nested. It should also be noted that, in a list of lists, each of the sub-lists can list a different kind of tag.

Dateiformat[]

Eine NBT-Datei ist eine per GZip komprimierte Compound-Eigenschaft inklusive Name und Datentyp-ID. Manche der von Minecraft benutzten Dateien sind unkomprimiert. In den meisten Fällen folgen die Dateien jedoch der Original-Spezifikation von Notch und sind mit GZip komprimiert. Bei Verwendung von zlib muss die Kompressionsstufe verwendet werden. Es gibt keinen Header der die Version angibt, nur in den Weltdaten steht eine Versionsangabe.

Die Benutzung des NBT-Formats von Minecraft ist manchmal merkwürdig. In manchen Fällen werden leere Listen als leere Liste von Bytes anstellen einer leeren Liste des korrekten Datentyps dargestellt. Zusätzlich hat fast jede Haupt-Eigenschaft einen leeren Namen und beinhaltet nur eine Compound-Eigenschaft mit dem tatsächlichen Namen und den Daten. Zum Beispiel:

  • Name: Die einzige Eigenschaft innerhalb der Haupt-Eigenschaft. Diese hat einen Namen und hält alle Daten.

    Die namenlose Haupt-Eigenschaft in den meisten Minecraft NBT-Strukturen

Eine andere Merkwürdigkeit ist, dass obwohl die originale Spezifikation Leerzeichen in Eigenschaftsnamen erlaubt, in Minecraft keine Datei bekannt ist, die Leerzeichen in den Eigenschaftsnamen enthält. Auch ist die Groß-/Kleinschreibung inkonsistent. Meistens werden einzelne Worte in den Eigenschaftsnamen durch einen Großbuchstaben markiert, wobei der Eigenschaftsname manchmal mit einem Kleinbuchstaben beginnt, manchmal mit einem Großbuchstaben. Manchmal wird der Eigenschaftsname aber auch komplett in Kleinbuchstaben geschrieben. Beispiele: «BlockLight», «carriedData», «mayfly».

Bei der Eingabe von Zahlen in Befehlen mit SNBT ist es meist nicht notwendig, den Datentyp mit einem Buchstaben zu markieren. Manchmal funktioniert der Befehl aber ohne Buchstabe nicht, sondern nur, wenn der korrekte Buchstabe hinzugefügt wird.

Dateien

  • EndCity.dat enthält die Daten aller Endsiedlungen einer Welt.
  • Fortress.dat enthält die Daten aller Netherfestungen einer Welt.
  • enthält die gespeicherten Schnellzugriffsleisten.
  • idcounts.dat enthält die ID des zuletzt hergestellten Karten-Gegenstands.
  • Konstruktionsvorlage.nbt enthält Blockbereiche, die mit dem Konstruktionsblock gespeichert wurden.
  • level.dat enthält die Daten einer Welt.
  • map_ID.dat enthält die Daten eines Karten-Gegenstände.
  • Mineshaft.dat enthält die Daten aller Minen einer Welt.
  • Monument.dat enthält die Daten aller Ozeanmonumente einer Welt.
  • r.RegionX.RegionZ.mca enthält die Chunks einer Region der Welt.
  • scoreboard.dat enthält die Daten der Anzeigetafel einer Welt.
  • enthält die IP-Adressen der Server, die im Mehrspielermodus zur Auswahl stehen.
  • Spieler.dat enthält die Daten eines Spielers.
  • Stronghold.dat enthält die Daten aller Festungen einer Welt.
  • Temple.dat enthält die Daten aller Dschungeltempel, Wüstentempel und Sumpfhütten einer Welt.
  • Village.dat enthält die Bauwerke aller Dörfer einer Welt.
  • villages.dat, villages_nether.dat, villages_end.dat enthält die Informationen über alle Dörfer einer Welt.

Other NBT Tags

Here are some of the other NBT tags (formerly called data tags) in Minecraft:

NBT Tags

NBT Tags for Player

NBT Tags for Armor Stand

NBT Tags for Bat

NBT Tags for Bee

NBT Tags for Blaze

NBT Tags for Boat

NBT Tags for Cat

NBT Tags for Cave Spider

NBT Tags for Chicken

NBT Tags for Cod

NBT Tags for Cow

NBT Tags for Creeper

NBT Tags for Dolphin

NBT Tags for Donkey

NBT Tags for Drowned

NBT Tags for Elder Guardian

NBT Tags for Ender Crystal

NBT Tags for Ender Dragon

NBT Tags for Enderman

NBT Tags for Endermite

NBT Tags for Evoker

NBT Tags for Fireball

NBT Tags for Firework Rocket

NBT Tags for Fox

NBT Tags for Ghast

NBT Tags for Giant

NBT Tags for Guardian

NBT Tags for Hoglin

NBT Tags for Horse

NBT Tags for Husk

NBT Tags for Illusioner

NBT Tags for Iron Golem

NBT Tags for Llama

NBT Tags for Magma Cube

NBT Tags for Mooshroom

NBT Tags for Mule

NBT Tags for Ocelot

NBT Tags for Panda

NBT Tags for Parrot

NBT Tags for Phantom

NBT Tags for Pig

NBT Tags for Piglin

NBT Tags for Pillager

NBT Tags for Polar Bear

NBT Tags for Pufferfish

NBT Tags for Rabbit

NBT Tags for Ravager

NBT Tags for Salmon

NBT Tags for Sheep

NBT Tags for Shulker

NBT Tags for Shulker Bullet

NBT Tags for Silverfish

NBT Tags for Skeleton

NBT Tags for Skeleton Horse

NBT Tags for Slime

NBT Tags for Snow Man

NBT Tags for Spider

NBT Tags for Squid

NBT Tags for Stray

NBT Tags for Trader Llama

NBT Tags for Tropical Fish

NBT Tags for Turtle

NBT Tags for Vex

NBT Tags for Villager

NBT Tags for Vindicator

NBT Tags for Wandering Trader

NBT Tags for Witch

NBT Tags for Wither Boss

NBT Tags for Wither Skeleton

NBT Tags for Wolf

NBT Tags for Zoglin

NBT Tags for Zombie

NBT Tags for Zombie Horse

NBT Tags for Zombie Villager

NBT Tags for Zombified Piglin

Поведение

Гаст бесцельно летает по Нижнему миру с закрытыми глазами и ртом и периодически издаёт звуки, похожие на стон, или плач, открывает глаза и рот, заметив игрока. Он издаёт громкий визг при атаке игрока, и громко кричит, когда получает урон. Звуки, издаваемые гастом, имеют минимальную интенсивность независимо от расстояния, это означает, что гаст может быть ближе, чем кажется. Он имеет размер 4×4×4 блока, а также 9 щупалец размером чуть длиннее, но тоньше игрока. Щупальца не являются частью хитбокса гаста.

Гасты обладают диапазоном видения в 100 блоков, обладает взрывающей атакой и высокой мобильностью. В отличие от большинства других агрессивных мобов, у гаста нет режима преследования — он не пытается приблизиться к игроку на большом расстоянии. Гасты могут заставить других мобов атаковать его, однако сам он никогда не атакует их; он нацелен только на игрока.‌[только для Java Edition] Когда игрок подходит к гасту на расстояние 16 блоков, он начинает атаковать, периодически обстреливая свою цель, и пытается набрать высоту. Гаст улетает, если его атаковать в режиме Творчества.

Гасту нужно прямо видеть игрока для начала атаки. Любые твёрдые блоки, включая прозрачные блоки, могут помешать гасту увидеть его.

Если игрок может летать внутри атакующего гаста, он может умереть, так как тот начнёт стрелять огненными шарами в самого себя. Также гаст небрежно относится к собственной безопасности: он может ранить самого себя от собственных взрывов.

Official software[]

See also: Tutorials/Running the Data Generator

Mojang has provided sample Java NBT classes for developers to use and reference as part of the source code for the MCRegion to Anvil file format converter. Since Java Edition 1.13, Minecraft includes a built-in converter between the SNBT format and compressed NBT format, which comes with both the client and official server.

The data generator from Minecraft is able to convert uncompressed Stringified NBT files with .snbt extension in an input folder to GZip compressed NBT format files with .nbt extension in an output folder, and vice versa.

The vanilla data generator can convert any GZip compressed NBT format to SNBT format. The file extension of a file can simply be changed, such as level.dat to level.nbt and put in the input folder, and the generator then decodes the GZip compressed NBT data.

SNBT format[]

This feature is exclusive to Java Edition. 

SNBT, also known as data tag, is often used in command in Java Edition. It can be described starting with attribute-value pairs enclosed in curly braces. One common usage of data tags in Java Edition is in commands, used to specify complex data for any entity.

A data tag consists of zero or more attribute-value pairs delimited by commas and enclosed in curly braces. Each attribute-value pair consists of an tag name and the tag’s value, separated by a colon. Some values, however, may be a compound tag and themselves contain attribute-value pairs, allowing a data tag to describe a hierarchical data structure.

Example:

Tag’s name can be enclosed with double quotes if necessary.

It is different from the JSON format; hence, any JSON used in NBT, such as , must be enclosed within a string tag.

Format of each type

The defined data structures also expect the values to be of the correct type.

Data Tags Value Types
Type Description Format Example
 Byte A signed 8-bit integer, ranging from -128 to 127 (inclusive). or ,
 Short A signed 16-bit integer, ranging from -32,768 to 32,767 (inclusive). or ,
 Int A signed 32-bit integer, ranging from -2,147,483,648 and 2,147,483,647 (inclusive).
 Long A signed 64-bit integer, ranging from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 (inclusive). or
 Float A 32-bit, single-precision floating-point number, ranging from -3.4E+38 to +3.4E+38.

See IEEE floating point for details.

or
 Double A 64-bit, double-precision floating-point, ranging from -1.7E+308 to +1.7E+308.

See IEEE floating point for details.

, or
 String A sequence of characters, enclosed in quotes. For strings without commas, brackets, braces or spaces, quote enclosure is optional. Quotes can be either single quote or double . Nested quotes can be included within a string by escaping the character with a escape. , ( within needs to be escaped to ), or ( within needs to be escaped to )
 List An ordered list of tags, enclosed in square brackets and delimited by commas. The tags must be of the same type, determined by the first tag in the list.
 Compound An ordered list of attribute-value pairs, enclosed in curly braces and delimited by commas.

Each tag can be of any type.

 Byte Array followed by an ordered list of 8-bit integers, delimited by commas. Tag is enclosed in square brackets.
 Int Array followed by an ordered list of 32-bit integers, delimited by commas. Tag is enclosed in square brackets.
 Long Array followed by an ordered list of 64-bit integers, delimited by commas. Tag is enclosed in square brackets.
 Boolean A value, expressed as , . It is resolved by the game into a  Byte tag as 0b (for false) and 1b (for true). , or ,

Other NBT Tags

Here are some of the other NBT tags (formerly called data tags) in Minecraft:

NBT Tags

NBT Tags for Player

NBT Tags for Armor Stand

NBT Tags for Bat

NBT Tags for Bee

NBT Tags for Blaze

NBT Tags for Boat

NBT Tags for Cat

NBT Tags for Cave Spider

NBT Tags for Chicken

NBT Tags for Cod

NBT Tags for Cow

NBT Tags for Creeper

NBT Tags for Dolphin

NBT Tags for Donkey

NBT Tags for Drowned

NBT Tags for Elder Guardian

NBT Tags for Ender Crystal

NBT Tags for Ender Dragon

NBT Tags for Enderman

NBT Tags for Endermite

NBT Tags for Evoker

NBT Tags for Fireball

NBT Tags for Firework Rocket

NBT Tags for Fox

NBT Tags for Ghast

NBT Tags for Giant

NBT Tags for Guardian

NBT Tags for Hoglin

NBT Tags for Horse

NBT Tags for Husk

NBT Tags for Illusioner

NBT Tags for Iron Golem

NBT Tags for Llama

NBT Tags for Magma Cube

NBT Tags for Mooshroom

NBT Tags for Mule

NBT Tags for Ocelot

NBT Tags for Panda

NBT Tags for Parrot

NBT Tags for Phantom

NBT Tags for Pig

NBT Tags for Piglin

NBT Tags for Pillager

NBT Tags for Polar Bear

NBT Tags for Pufferfish

NBT Tags for Rabbit

NBT Tags for Ravager

NBT Tags for Salmon

NBT Tags for Sheep

NBT Tags for Shulker

NBT Tags for Shulker Bullet

NBT Tags for Silverfish

NBT Tags for Skeleton

NBT Tags for Skeleton Horse

NBT Tags for Slime

NBT Tags for Snow Man

NBT Tags for Spider

NBT Tags for Squid

NBT Tags for Stray

NBT Tags for Strider

NBT Tags for Trader Llama

NBT Tags for Tropical Fish

NBT Tags for Turtle

NBT Tags for Vex

NBT Tags for Villager

NBT Tags for Vindicator

NBT Tags for Wandering Trader

NBT Tags for Witch

NBT Tags for Wither Boss

NBT Tags for Wither Skeleton

NBT Tags for Zoglin

NBT Tags for Zombie

NBT Tags for Zombie Horse

NBT Tags for Zombie Villager

NBT Tags for Zombified Piglin

Использование в Minecraft[]

Использование формата NBT в Minecraft местами является странным. В некоторых случаях пустые списки могут быть представлены списками байтов (или тегов End в более новых версиях Minecraft), а не списками правильного типа. К тому же, каждый корневой тег имеет пустое название и включает только один составной тег с самими данными и названием. Например:

  • Корневой тег для большинства структур NBT в Minecraft

     Название: Единственный тег, содержащийся в корневом теге. Он имеет название и содержит сами данные.

    .

Ещё одна заметная странность — это то, что, хотя оригинальная спецификация Нотча допускает пробелы в названиях тегов и приведённый в ней пример использует это, в Minecraft нет файлов с пробелами в тегах. Также использование прописных букв в названиях тегов непостоянно: где-то с прописной буквы пишется каждое слово, где-то — каждое, кроме первого, а где-то используются только строчные буквы.

Область применения

  • level.dat хранится в сжатом формате NBT.
  • Файлы <player>.dat хранятся в сжатом формате NBT.
  • idcounts.dat хранится в несжатом формате NBT.
  • villages.dat хранится в сжатом формате NBT.
  • Файлы map_<#>.dat хранятся в сжатом формате NBT.
  • servers.dat, используется для хранения списка сохранённых серверов как несжатый формат NBT.
  • Чанки хранятся в сжатом формате NBT в файлах областей.
  • хранится в сжатом формате NBT.
  • Натуральные структуры хранятся в сжатом формате NBT.

Other NBT Tags

Here are some of the other NBT tags (formerly called data tags) in Minecraft:

NBT Tags

NBT Tags for Player

NBT Tags for Armor Stand

NBT Tags for Bat

NBT Tags for Bee

NBT Tags for Blaze

NBT Tags for Boat

NBT Tags for Cat

NBT Tags for Cave Spider

NBT Tags for Chicken

NBT Tags for Cod

NBT Tags for Cow

NBT Tags for Creeper

NBT Tags for Dolphin

NBT Tags for Donkey

NBT Tags for Drowned

NBT Tags for Elder Guardian

NBT Tags for Ender Crystal

NBT Tags for Ender Dragon

NBT Tags for Enderman

NBT Tags for Endermite

NBT Tags for Evoker

NBT Tags for Fireball

NBT Tags for Firework Rocket

NBT Tags for Fox

NBT Tags for Ghast

NBT Tags for Giant

NBT Tags for Guardian

NBT Tags for Hoglin

NBT Tags for Horse

NBT Tags for Husk

NBT Tags for Illusioner

NBT Tags for Iron Golem

NBT Tags for Llama

NBT Tags for Magma Cube

NBT Tags for Mooshroom

NBT Tags for Mule

NBT Tags for Ocelot

NBT Tags for Panda

NBT Tags for Parrot

NBT Tags for Phantom

NBT Tags for Pig

NBT Tags for Piglin

NBT Tags for Pillager

NBT Tags for Polar Bear

NBT Tags for Pufferfish

NBT Tags for Rabbit

NBT Tags for Ravager

NBT Tags for Salmon

NBT Tags for Sheep

NBT Tags for Shulker

NBT Tags for Shulker Bullet

NBT Tags for Silverfish

NBT Tags for Skeleton

NBT Tags for Skeleton Horse

NBT Tags for Slime

NBT Tags for Snow Man

NBT Tags for Spider

NBT Tags for Squid

NBT Tags for Stray

NBT Tags for Strider

NBT Tags for Trader Llama

NBT Tags for Tropical Fish

NBT Tags for Turtle

NBT Tags for Vex

NBT Tags for Villager

NBT Tags for Wandering Trader

NBT Tags for Witch

NBT Tags for Wither Boss

NBT Tags for Wither Skeleton

NBT Tags for Wolf

NBT Tags for Zoglin

NBT Tags for Zombie

NBT Tags for Zombie Horse

NBT Tags for Zombie Villager

NBT Tags for Zombified Piglin

List of NBT Tags

Here is a list of the NBT tags that you can use for in Minecraft Java Edition (PC/Mac) 1.16:

NBT Tag Value (Description) Works With
AX

number (The x-coordinate of the point in the air above the player where the phantom will circle when not attacking.)

Example
{AX:-846}

/summon/data
AY

number (The y-coordinate of the point in the air above the player where the phantom will circle when not attacking.)

Example
{AY:91}

/summon/data
AZ

number (The z-coordinate of the point in the air above the player where the phantom will circle when not attacking.)

Example
{AZ:216}

/summon/data
CustomName

name (The name to assign to the phantom)

Example
{CustomName:»\»Spooky\»»}

/summon/data
Health

number (The number of health points the phantom has)

Example
{Health:35.0f}

/summon/data
AbsorptionAmount

number (The number of absorption health points the phantom has)

Example
{AbsorptionAmount:2.0f}

/summon/data
Invulnerable

0 (The phantom will take damage like normal)
1 (The phantom will not take any damage from attacks or physical surroundings)

Example
{Invulnerable:1}

/summon/data
PersistenceRequired

0 (The phantom will despawn naturally)
1 (The phantom won’t despawn)

Example
{PersistenceRequired:1}

/summon/data
NoAI

0 (The phantom will have artificial intelligence and will move/behave like normal)
1 (The phantom will have no artificial intelligence and will appear motionless)

Example
{NoAI:1}

/summon/data
Silent

0 (The phantom will make its usual noises in the game)
1 (The phantom will not make any noise in the game)

Example
{Silent:1}

/summon/data
Fire

ticks (The number of game ticks until the phantom is no longer on fire — there are 20 ticks in a second)

Example
{Fire:60}

/summon/data
PortalCooldown

ticks (The number of game ticks until the phantom can go through a portal again — there are 20 ticks in a second)

Example
{PortalCooldown:120}

/summon/data
Air

ticks (The number of game ticks the phantom has air left for)

Example
{Air:120}

/summon/data
id

phantom (The entity value used to represent a phantom in the Passengers tag)

Example
{id:phantom}

/summon
Passengers

The mob that is riding on the phantom. Use the entity value for the passenger mob

Example of skeleton as passenger
Passengers:

/summon/data

NBT Tag Examples

To summon a phantom that is named Spooky:

/summon phantom ~ ~ ~ {CustomName:"\"Spooky\""}

To summon a phantom whose circling point in the air is set to the coordinate (-846,91,216):

/summon phantom ~ ~ ~ {AX:-846, AY:91, AZ:216}

Multiline names

Now you see the subtag called ? This is why we put a name for our item earlier, we could make this ourselves but this is a lot easier. Open it, and inside that, open the subtag.

Double click the value (right side where it says ), and then change it to what you want the name to be. Press SHIFT + ENTER to insert a linebreak:

You can also use the section sign with formatting codes to further format your item name, like so:

Click ENTER to submit, and be sure to save your changes! (CTRL + S) Go in game and you have a multi-line name on the item!

Lore

Click on the subtag to select it. (it turns blue)

On the top bar you should see an icon labelled «List Tag». Click that. See my image above for help.
It will default to , name it , then press ENTER to submit. With that selected, click «String Tag» on the top bar and name it whatever you want your lore to say. You can either use SHIFT + ENTER for new lines or add more string tags into the list.
Don’t forget, always save!

Unobtainable Items

In addition to the tag you see in the display properties, there is another tag outside the display properties. This tag contains the item ID, so that Minecraft knows which item it is. It should look something like this: (or whatever the ID of your item is).

There are many unobtainable or removed items, which are accessible here by typing their IDs. Here are a few you can use:

Custom Enchantments

I have now navigated to the second item in the chest’s list, which is my enchanted sword. You can see it has an list in its . The first package inside this list contains a numerical ID for the enchant, and the level of the enchant. Select the list and copy it. (CTRL + C). Then paste it in the first item’s  compound. (Click the first item’s and press CTRL + V.) You should see this:
Now you can change the level or the enchantment number to whatever you want.
Never forget to save!

Tag Payloads[edit | edit source]

The payload is the data a Tag carries. It might be a number or, in the case of Compound Tags and List Tags, other Tags. In using commands, one simply needs to avoid mismatching expected data types, keep values within expected ranges, and close all brackets and braces that are opened.

For a deeper understanding of payloads, it might help to look at what an example Compound Tag would look like in data.

ON DISK: 00001010 00000000 00000011 01101000 01100001 01101101 00001000 00000000 00000111 01110000 01101001 01100111 01001110 01100001 01101101 01100101 00000000 00000110 01001000 01100001 01101101 01110000 01110101 01110011 00000011 00000000 00000101 01110110 01100001 01101100 01110101 01100101 00000000 00000000 00000000 01111000 00000000
    DEC: 10       0        3        h        a        m        8        0        7        p        i        g        N        a        m        e        0        6        H        a        m        p        u        s        3        0        5        v        a        l        u        e        0        0        0        120      0

       __ ___ _____ _ ___ _____________ ___ ___________ _ ___ _________ _________ _
BYTES: 10 0 3 h a m 8 0 7 p i g N a m e 0 6 H a m p u s 3 0 5 v a l u e 0 0 0 120 0
                   |8: TAG_String      |  payload      |3: TAG_Int     | payload | TAG_End |
    10:TAG_Compound|                                payload                                |

This is understood in the following way. Recall that all named tags have a (1 byte), a (Unnamed TAG_String), and a payload.

  • The first byte of data read is the . Above is , so this represents a TAG_Compound. The next two bytes read are the length of its name. (Two bytes because it expects a short — see above.) The given length is . Those next 3 bytes read . So far it’s been revealed that the first Tag is a Compound Tag named «ham». Its payload is everything that follows, until TAG_End.
    • The next byte is , so this is a TAG_String. The upcoming unnamed TAG_String tells us it has the 7-byte name of «pigName». Its payload follows.
    • The next byte is , so next is a TAG_Int. It has the 5-byte name of «value». Its payload follows in the next 4 bytes: . The next completed Tag is
    • The next byte is , so next is a TAG_End.

The completed Compound Tag is as follows:

TAG_Compound("ham"):
   TAG_String("pigname"): 6 Hampus,
   TAG_Int("value"): 120,
   TAG_End

Using a command to summon a pig with this example tag would look like this:

/summon minecraft:pig ~ ~ ~ {ham:{pigname:"Hampus",value:120}}

Beispiel[]

Hier wird kurz anhand eines Beispiels gezeigt, wie man die NBT-Daten aus den Wiki-Artikeln, die alle Informationen zu den Daten besitzen, ausliest und überträgt:

Das Ziel ist es, einen gezähmten und gesattelten Esel, der eine Truhe trägt, mit dem Befehl zu erschaffen. In der Truhe soll sich ein Stein befinden. Zuerst muss unter Kreaturdaten der Esel gefunden werden, dann sucht man sich alle NBT-Daten, die man für die Ziel-Vorgaben benötigt:

  • Esel hat die Objekt-ID «donkey»
    • ChestedHorse: true oder false — true wenn die Kreatur Truhen trägt.
    • Items: Nur für Esel, Maultiere und Lamas und nur wenn ChestedHorse true ist: Liste der Gegenstandsdaten, die die Kreatur trägt mit Slot

      Ein Gegenstand in der Satteltasche der Kreatur.

      . Die Slots haben die Nummern 2 bis 16.

    • SaddleItem: Optional und nur für Pferde, Esel und Maultiere. Die Gegenstandsdaten des Sattels, den die Kreatur trägt, ohne Slot.
    • Tame: true oder false — true wenn die Kreatur gezähmt ist.

Die Objekt-ID des Esels lautet «donkey», diese wird für den Befehl verwendet. Jetzt werden die NBT-Daten in Form von SNBT eingetragen: Alle Daten, die auf gleicher Ebene liegen, können jetzt direkt als Angaben eingebunden werden. Stehen Angaben in zweiter Ebene, wie bei «Items:», muss herausgefunden werden, welche Klammer hier verwendet wird. Bei «compound» sind das geschwungene Klammern , bei «list» eckige . Dort trägt man dann alle Werte ein.

/summon minecraft:donkey ~ ~ ~
 { ChestedHorse:true,
   Items:
   ,
   SaddleItem:{ id:"minecraft:saddle", Count:1b },
   Tame:true
 }
Eine ausführliche Anleitung zur Verwendung von NBT-Daten in Befehlen steht im Artikel .Weitere Beispiele mit NBT-Daten siehe: Anleitungen/Befehle mit NBT

Result[]

Command Trigger Java Edition
any the arguments are not specified correctly Unparseable
is unloaded or out of the world Failed
the block at is not a block entity
(in mode) fails to resolve to an entity (named player must be online)
more than one tag is got
does not exist
the obtained tag is not a numeric tag
nothing is changed
try to edit player’s data
is the root compound tag
is unloaded or out of the world
the block at is not a block entity
fails to resolve to an entity (named player must be online)
does not exist
the target tag isn’t a list or array
source data isn’t of an item type appropriate for the list
the index is invalid
the target path does not specify a compound tag
the source data is not a compound tag
any On success Get, merge, modify, and remove NBT data.

List of NBT Tags

Here is a list of the NBT tags that you can use for in Minecraft Java Edition (PC/Mac) 1.16:

NBT Tag Value (Description) Works With
LeftHanded

0 (The vindicator is right-handed)
1 (The vindicator is left-handed)

Example
{LeftHanded:1}

/summon/data
CustomName

name (The name to assign to the vindicator)

Example
{CustomName:»\»Alfred\»»}

/summon/data
Health

number (The number of health points the vindicator has)

Example
{Health:25.0f}

/summon/data
AbsorptionAmount

number (The number of absorption health points the vindicator has)

Example
{AbsorptionAmount:2.0f}

/summon/data
Invulnerable

0 (The vindicator will take damage like normal)
1 (The vindicator will not take any damage from attacks or physical surroundings)

Example
{Invulnerable:1}

/summon/data
PersistenceRequired

0 (The vindicator will despawn naturally)
1 (The vindicator won’t despawn)

Example
{PersistenceRequired:1}

/summon/data
NoAI

0 (The vindicator will have artificial intelligence and will move/behave like normal)
1 (The vindicator will have no artificial intelligence so it will appear motionless)

Example
{NoAI:1}

/summon/data
Silent

0 (The vindicator will make its usual noises in the game)
1 (The vindicator will not make any noise in the game)

Example
{Silent:1}

/summon/data
Fire

ticks (The number of game ticks until the vindicator is no longer on fire — there are 20 ticks in a second)

Example
{Fire:60}

/summon/data
PortalCooldown

ticks (The number of game ticks until the vindicator can go through a portal again — there are 20 ticks in a second)

Example
{PortalCooldown:120}

/summon/data
Air

ticks (The number of game ticks the vindicator has air left for)

Example
{Air:120}

/summon/data
HandItems

Items that the vindicator is holding in its hands, listed in this order: right hand, left hand

Syntax
HandItems:

Example
{HandItems:}

/summon/data
HandDropChances

The drop chances for each of the 2 items listed in HandItems. A value of 1.0f means 100% chance of the item being dropped when the vindicator is killed, 0.5f means 50%, 0.2f means 20%, and so on.

Example
{HandDropChances:}

/summon/data
id

vindicator (The entity value used to represent a vindicator in the EntityTag or Passengers tag)

Example
{id:vindicator}

/summon/give
Passengers

The mob that is riding on the vindicator. Use the entity value for the passenger mob

Example of skeleton as passenger
Passengers:

/summon/data

NBT Tag Examples

To summon a vindicator with a custom name of Alfred:

/summon vindicator ~ ~ ~ {CustomName:"\"Alfred\""}

To summon a vindicator with a custom name of Alfred and has no artificial intelligence:

/summon vindicator ~ ~ ~ {CustomName:"\"Alfred\"", NoAI:1}

Other NBT Tags

Here are some of the other NBT tags (formerly called data tags) in Minecraft:

NBT Tags

NBT Tags for Player

NBT Tags for Armor Stand

NBT Tags for Bat

NBT Tags for Bee

NBT Tags for Blaze

NBT Tags for Boat

NBT Tags for Cat

NBT Tags for Cave Spider

NBT Tags for Chicken

NBT Tags for Cod

NBT Tags for Cow

NBT Tags for Creeper

NBT Tags for Dolphin

NBT Tags for Donkey

NBT Tags for Drowned

NBT Tags for Elder Guardian

NBT Tags for Ender Crystal

NBT Tags for Ender Dragon

NBT Tags for Enderman

NBT Tags for Endermite

NBT Tags for Evoker

NBT Tags for Fireball

NBT Tags for Firework Rocket

NBT Tags for Fox

NBT Tags for Ghast

NBT Tags for Giant

NBT Tags for Guardian

NBT Tags for Hoglin

NBT Tags for Horse

NBT Tags for Husk

NBT Tags for Illusioner

NBT Tags for Iron Golem

NBT Tags for Llama

NBT Tags for Magma Cube

NBT Tags for Mooshroom

NBT Tags for Mule

NBT Tags for Ocelot

NBT Tags for Panda

NBT Tags for Parrot

NBT Tags for Pig

NBT Tags for Piglin

NBT Tags for Pillager

NBT Tags for Polar Bear

NBT Tags for Pufferfish

NBT Tags for Rabbit

NBT Tags for Ravager

NBT Tags for Salmon

NBT Tags for Sheep

NBT Tags for Shulker

NBT Tags for Shulker Bullet

NBT Tags for Silverfish

NBT Tags for Skeleton

NBT Tags for Skeleton Horse

NBT Tags for Slime

NBT Tags for Snow Man

NBT Tags for Spider

NBT Tags for Squid

NBT Tags for Stray

NBT Tags for Strider

NBT Tags for Trader Llama

NBT Tags for Tropical Fish

NBT Tags for Turtle

NBT Tags for Vex

NBT Tags for Villager

NBT Tags for Vindicator

NBT Tags for Wandering Trader

NBT Tags for Witch

NBT Tags for Wither Boss

NBT Tags for Wither Skeleton

NBT Tags for Wolf

NBT Tags for Zoglin

NBT Tags for Zombie

NBT Tags for Zombie Horse

NBT Tags for Zombie Villager

NBT Tags for Zombified Piglin

Official software[]

See also: Tutorials/Running the Data Generator

Mojang has provided sample Java NBT classes for developers to use and reference as part of the source code for the MCRegion to Anvil file format converter. Since Java Edition 1.13, Minecraft includes a built-in converter between the SNBT format and compressed NBT format, which comes with both the client and official server.

The data generator from Minecraft is able to convert uncompressed Stringified NBT files with .snbt extension in an input folder to GZip compressed NBT format files with .nbt extension in an output folder, and vice versa.

The vanilla data generator can convert any GZip compressed NBT format to SNBT format. The file extension of a file can simply be changed, such as level.dat to level.nbt and put in the input folder, and the generator then decodes the GZip compressed NBT data.

Array-Sortierung[]

Oft enthält ein Array die Werte einer Fläche oder eines Raumes der Minecraft-Welt. Die Angabe zur Sortierung der Array-Daten ist entscheidend, um die korrekte Position eines Blockes im Array zu finden. Bei Flächen ist die Sortierung meistens XZ. Das bedeutet, dass erst alle X-Werte für Z=0 aufgeführt sind, gefolgt von allen X-Werten für Z=1 etc. Beispiel: die Position X=4 / Z=7 befindet sich in einem 16×16-XZ-Array an Position 7×16+4 = 116.

Die seltenere ZX-Sortierung bedeutet, dass erst alle Z-Werte für X=0 aufgeführt sind, gefolgt von allen Z-Werten für X=1 etc. Beispiel: die Position X=4 / Z=7 befindet sich in einem 16×16-ZX-Array an Position 4×16+7 = 71.

Chunk-Sektionen werden in einem Array in XZY-Sortierung abgelegt. Das bedeutet, dass erst alle XZ-Flächen für Y=0 aufgeführt sind, gefolgt von allen XZ-Flächen für Y=1 etc. Beispiel: die Position X=4 / Y=5 / Z=7 befindet sich in einem 16×16×16-XZY-Array an Position 5×256+7×16+4 = 1396.

Гость форума
От: admin

Эта тема закрыта для публикации ответов.