Как изменить nbt теги игрока

Как изменить тег игрока в майнкрафт

Обновлено: 09.02.2023

The Minecraft Wiki is no longer considered as official by Microsoft and therefore several changes are required to be made, including to the wiki’s logo. Please read this announcement for more information.

Contents

Items [ ]

These can be used in /give and /replaceitem commands as well as /clear . For commands such as /summon and /setblock , place them inside of a tag.

These tags can be used on any item.

Color is a hexadecimal color value, except in decimal. An RGB to hexadecimal converter can be found here and a hexadecimal to decimal converter can be found here. Names and lore must be passed as raw JSON text.

The following syntax can also be used, and eliminates the need for backslashes:

To hide multiple tags, you need to add the value of the tags you want to hide. For example, if you want to hide the «Enchantments» and the «Attributes modifiers» tags, the value you need to put is 3 (1+2).

VALUE ranges from 1 to 127, representing 127 combinations.

Adding 1 hides «Enchantments»

Adding 2 hides «AttributeModifiers»

Adding 4 hides «Unbreakable»

Adding 8 hides «CanDestroy»

Adding 16 hides «CanPlaceOn»

Adding 32 hides other information, including potion effects, shield pattern info, «StoredEnchantments», written book «generation» and «author», «Explosion», «Fireworks», and map tooltips

Adding 64 hides «Dyed» on leather armors

Allowed 1 amount of same NBT Tags.

Unknown amount of allowed same NBT Tags.

The following table describes more details on Enchantments sub-tag.

Tagname Description Value Type Allowed Values Example
id Refers to the id of an enchantment. See Enchanting for details on which id correlates to which enchantment. String Enchantment ID «minecraft:efficiency»
lvl Determines the level of an enchantment. A level between one and ten displays properly on an item as a roman numeral, however, any value above that displays as enchantment.level.lvl. Numerical -2147483648 to 2147483647 4

The following table describes more details on display sub-tag.

The following table describes more details on the Fireworks sub-tag.

Colors is the initial color of the explosion written in decimal format.

FadeColors is the color that the explosion will fade to written in decimal format.

Flicker is whether the whether the explosion flickers while it fades. This is the effect applied when you add glowstone to the firework star.

Trail is whether the particles leave trails as they travel. This effect is applied when you add a diamond to the firework star.

Type is the shape of the firework:

0 is small ball,

1 is large ball,

2 is star-shaped,

3 is creeper-shaped,

Blocks [ ]

These tags are put on blocks as items.

Tutorials/Command NBT tags

Please update this page to reflect recent updates or newly available information.

NBT tags can be specified for items and entities created with the /give and /summon commands. Each tag has the format <tagname>:<value>; where <tagname> describes what it does and <value> is how much it applies. Multiple tags are separated by commas. (e.g.: ],display:<>> ). The contents of List tags are enclosed in square brackets [] , while the contents of Compound tags are enclosed in curly brackets <> – note that the entire data tag is itself a Compound tag (All within a set of <> ). Tag names are case-sensitive, and white space is ignored. additionally, some tags are either true or false (Example: )

The player can quickly find data tags (NBT) without the use of external editors by using /data to figure out the data for each entity or block entity. See more about this in the article Commands/data.

See Entity format for the various NBT Tags that are saved for each entity. This page also contains basic information for each NBT Tag.

When None is used in a tag name that means that this tag can be put directly into the start of the dataTag.

Как изменить тег игрока в Xbox Live с Xbox One

Тег игрока можно изменить не только на сайте, но и в настройках на приставке Xbox One. Все правила те же, что описаны выше для сайт. Изменения проводятся в настройках в пункте «Персонализация» — «Мой профиль» — «Настроить профиль». Нужно нажать на тег игрока и ввести новый ник.

Как изменить тег игрока в Xbox Live

Тег персонализирует игрока, выделяя его среди миллионов других пользователей Xbox Live. Каждый пользователь имеет свой индивидуальный тег игрока, который он задает при создании аккаунта Xbox Live.

В связи с реорганизацией Xbox Live тег игрока снова можно поменять бесплатно

«Консоль Xbox One и мобильное приложение скоро будут обновлены, чтобы в них показывался ваш новый тег игрока, — говорится на сайте. — В играх это произойдёт в какой-то день 2020 года».

Однако стоит учитывать, что после изменения тега, ваш прошлый псевдоним станет доступным другим пользователям.

Как изменить тег игрока в Xbox Live через сайт

Чтобы изменить тег игрока в Xbox Live через сайт, зайдите по этой ссылке и авторизуйтесь:

Появится окно, в нем нужно ввести новый тег игрока. Вводите любое желаемое имя, даже если оно занято, вам об этом сообщат. Жмите «Проверить доступность».

Если желаемый тег занят, появится информация о том, что вашему тегу будет присвоен номер. После этого вы можете или выйти на обратный экран или нажать «Изменить тег игрока», чтобы принять предлагаемый номер и желаемый тег.

Обратите внимание: Изменить предлагаемый номер нельзя.

Blocks [ ]

Tagname Description Value Type Syntax
Command Used with command blocks. Places command block with command. A string

Note: This is also used for Command Block Minecarts

Generic [ ]

These tags can be used on most tile entitied blocks

Tagname Description Value Type Syntax
CustomName Displayed in the top left corner of the inventory, instead of the regular name. Works only where such a regular name exists. A JSON text component
Lock Says a name needed on a held item to open the inventory. A string

Beacon [ ]

Tagname Description Value Type Syntax
Primary This determines the first status effect that the beacon creates. It defaults to level 1 of the effect. An ID of a status effect.
Secondary This determines the second status effect. If its the same as Primary, then it increases the status effect to level 2. Otherwise it is level 1. Also an ID of a status effect.
Levels This number determines how many layers of valid blocks are below the beacon. This value updates automatically, and overrides /data inputs immediately. Integer

Spawner [ ]

These tags are used when using /setblock or /summon (spawner minecarts) to create spawners. Add only those data tags you want to avoid a potential error.

Как изменить тег игрока в майнкрафте

Тег игрока в Xbox можно легко поменять. Если тег игрока был создан во время начальной регистрации в службе Xbox (то есть не выбран вами), то его можно один раз изменить бесплатно. Все последующие изменения тега игрока в Xbox оплачиваются отдельно.

Если при регистрации вы выбрали свой тег игрока и хотите изменить его, с вас будет взята плата (размер платы зависит от валюты и региона).

Примечание. Microsoft может в любое время объявить тег игрока оскорбительным или недопустимым (даже если средство изменения тега игрока позволяет его создание) и изменить этот тег игрока без предупреждения. Подробнее о том, почему мы можем удалить тег игрока, см. в разделе Тег игрока и настоящее имя на веб-сайте безопасности Xbox.

Выполните следующие действия.

Примечание. Интерфейс консоли Xbox One переведен не на все языки.

После подтверждения нового тега игрока изменение вступит в силу в службе Xbox; если потребуется оплата, она будет произведена способом, выбранным в вашей учетной записи Microsoft. Вам не потребуется сообщать друзьям о смене тега игрока — их списки друзей будут обновлены автоматически.

Ниже описано, как это сделать.

  1. На консоли Xbox 360 перейдите на страницу Социальные сети и выберите Войти или выйти.
  2. Выберите свой профиль, чтобы войти в систему.
  3. Прокрутите вправо до пункта Настройки и выберите Профиль.
  4. Выберите Изменение профиля.
  5. Выберите Тег игрока.
  6. Выберите Ввести новый тег игрока.
  7. Введите новый тег игрока (не более 15 символов) и выберите Готово.
    Если введенный тег игрока уже существует, вам будет предложено попробовать другой тег игрока.
  8. После ввода или выбора нового тега игрока нажмите Да, использовать данный тег игрока.

После подтверждения нового тега игрока изменение вступит в силу в службе Xbox, и, если потребуется внесение дополнительных средств, оплата будет произведена способом, выбранным в учетной записи Microsoft. Вам не потребуется сообщать друзьям о смене тега игрока — их списки друзей будут обновлены автоматически.

Если тег игрока создан во время начальной регистрации (то есть не выбран вами самостоятельно), его можно один раз изменить бесплатно в приложении Компаньон консоли Xbox для Windows 10. Сделать это можно следующим образом.

После подтверждения нового тега игрока изменение вступит в силу в службах Xbox. Вам не потребуется сообщать друзьям о смене тега игрока — их списки друзей будут обновлены автоматически.

Entities [ ]

These tags are used when using the /summon command to spawn entities or when using the /data to edit the data of entities.

This tag determines only the entity’s velocity, not the direction that it’s facing.

The following table provides information on each tagname that can be added in an NBT Tag. These tagnames are specific to the /summon command.

Villager [ ]

These tags are used when summoning villagers. (Offers NBT can’t be done in 1.14+)

Item Frame [ ]

These tags are used when summoning itemframes.

Tag name Description Value type Syntax
Facing Determines the direction of the item frame Numerical, 0 — 5 (0 up; 1 down; 2 south; 3 north; 4 east; 5 west)
ItemRotation Determines the rotation of the item in the item frame Numerical, 0 — 7 (Clockwise)
Item Determines the item in the item frame A string >
Invisible Determines if the item frame is invisible 0b or 1b
Fixed Determines if the item frame is fixed 0b or 1b

Potion [ ]

These tags are used to customize potions

Armor Stand [ ]

These tags are used when summoning armor stands.

NBT Tag Description Value type Syntax
NoGravity Toggles gravity 0b or 1b (0b for false, 1b for true)
ShowArms Determines whether you can see the armor stand’s arms or not. Byte, 0b or 1b (0b for false, 1b for true)
NoBasePlate Determines whether the armor stand has a base plate or not. Byte, 0b or 1b
Small Determines whether the armor stand is small or not. Byte, 0b or 1b
Rotation Changes the rotation of the armor stand Byte, 0b or 1b
Marker Small Hit box Byte, 0b or 1b
Pose Changes the pose of the armor stand’s body parts. Any subtag can be ommited Byte, 0b or 1b >
Invisible Determines whether the armor stand is invisible or not. Byte, 0b or 1b

Note: The Equipment tag also works for armor stands.

Turtle [ ]

These tags are used when summoning turtles.

Tagname Description Value type Syntax
HomePosX Determines the X coordinate of a turtle’s home beach. Numerical
HomePosY Determines the Y coordinate of a turtle’s home beach. Numerical
HomePosZ Determines the Z coordinate of a turtle’s home beach. Numerical
TravelPosX Determines the distance a turtle can lay eggs from its home coordinates, on the X axis. Numerical
TravelPosY Determines the distance a turtle can lay eggs from its home coordinates, on the Y axis. Numerical
TravelPosZ Determines the distance a turtle can lay eggs from its home coordinates, on the Z axis. Numerical
HasEgg Determines if the turtle has an egg to lay 0 – 0b – false
1 – 1b – true

Каким должен быть тег игрока в Xbox Live

В 2019 году Microsoft перезапустила систему тегов. Теперь игроки могут брать такие же теги, как у других пользователей, но им будет присвоен индивидуальный номер. То есть, фактически теперь можно сменить тег игрока в Xbox Live на практически любой, какой игрок пожелает, за исключением нескольких ограничений.

В частности, теперь можно задавать ники не только латиницей, но и кириллицей, а также массой других языков.

Важно: Бесплатно изменить тег игрока в Xbox Live можно только один раз.

Читайте также:

      

  • Ghost recon wildlands gold edition что входит
  •   

  • Как сделать рубить деревья в майнкрафте
  •   

  • После установки fnis в скайрим стоят как вкопанные растопырив руки
  •   

  • Wow дикая лоза где взять
  •   

  • Где хранятся сохранения clash of clans

Clock JE3.gif

This article ‘s factual accuracy may be compromised due to out-of-date information.

Please update this page to reflect recent updates or newly available information.

Information icon.svg

NBT tags can be specified for items and entities created with the /give and /summon commands. Each tag has the format <tagname>:<value> where <tagname> describes what it does, and <value> is what it applies. Multiple tags are separated by commas. (e.g. {CustomName:'"Bob"', Invisible:true). The contents of List tags are enclosed in square brackets [], while the contents of Compound tags are enclosed in curly brackets {} – note that the entire data tag is itself a Compound tag (All within a set of {}). Tag names are case-sensitive, and white space is ignored. Additionally, some tags which are either true or false are stored as Byte tags (Example: {NoAI:1b})

The player can quickly find data tags (NBT) without the use of external editors by using /data to figure out the data for each entity or block entity. See more about this in the article Commands/data.

See Entity format for the various NBT Tags that are saved for each entity. This page also contains basic information for each NBT Tag.

When None is used in a tag name that means that this tag can be put directly into the start of the dataTag.

Items

These can be used in /give and /item commands as well as /clear. For commands such as /summon and /setblock, place them inside of a tag.

Example:

{id:"minecraft:stone",Count:3b, ..., tag:{Name:'{"text":"Name Here"}', ...}}

These tags can be used on any item.

NBT Tag Description Allowed amount of same NBT Tags Required tagnames Syntax
Item Used for any instance of item(s), it includes the resource location of the item(s) (id), the number of items in the stack (Count) and the NBT data of the item(s) (tag). It may also contain the Slot number which the item is in. Any item with a Count of less than 1 or more than 127 becomes Air. 1 id, Count {Item:{id:STRING,Count:BYTE,tag:{Item NBT data here}}}

A copyable example:

{Item:{id:"minecraft:diamond_sword",Count:1b,tag:{Damage:10}}}

Enchantments Used for the addition of enchantments to items, it includes the id of the enchantment and the level (lvl) of the enchantment. Can specify one enchantment or multiple enchantments. It is possible specify no enchantment, which still applies the enchantment glint over the item. Any All {Enchantments:[{id:STRING,lvl:SHORT}, ...]}

A copyable example: {Enchantments:[{id:"minecraft:sharpness",lvl:1s}]}

EntityTag Used to add nbt arguments to spawn eggs or other items that summon entities such as armor stands or item frames. 1 None {EntityTag:{Entity NBT data here}}
display Used for the addition of a custom Name, colors (leather armor), and lore to items. Lore may have multiple lines.

color is a hexadecimal color value, except in decimal. An RGB to hexadecimal converter can be found here and a hexadecimal to decimal converter can be found here.
Names and lore must be passed as raw JSON text.

Any At least one {display:{Name:STRING,Lore:[STRING,STRING, ...],color:INT}}

A copyable example:

{display:{Name:'{"text":"Tunic of Destiny","color":"blue",...}',Lore:['{"text":"A magical blue tunic"}','{"text":"worn by the gods..."}',color:3949738]}}

AttributeModifiers Can be used to add attributes to mobs or items. For more information, see Attribute. Any All {AttributeModifiers:[{AttributeName:STRING,Amount:DOUBLE,Slot:STRING,Operation:INT,UUID:UUID}, ...]}

A copyable example: {AttributeModifiers:[{AttributeName:"generic.max_health",Amount:8d,Slot:"mainhand",Operation:0,UUID:[I;13243,1439,1767,44564]}]}

Unbreakable Used to make items with durability that never degrades. 1 All {Unbreakable:BYTE} (1b for true or 0b for false)
SkullOwner Used for getting player heads. 1 All {SkullOwner:STRING} (Enter a player’s username to get their head)

or {SkullOwner:{Name:STRING,Id:UUID,Properties:[{Value:STRING,Signature:STRING}]}}

HideFlags Used to hide flags (the info in the tool tip) such as enchantments, CanDestroy, CanPlaceOn, etc.

To hide multiple tags, you need to add the value of the tags you want to hide. For example, if you want to hide the «Enchantments» and the «Attributes modifiers»
tags, the value you need to put is 3 (1+2).

Any All {HideFlags:INT}

The value ranges from 1 to 127, representing 127 combinations, or 7 binary digits.[1]

When adding to create a unique value:

Adding 1 hides «Enchantments»

Adding 2 hides «AttributeModifiers»

Adding 4 hides «Unbreakable»

Adding 8 hides «CanDestroy»

Adding 16 hides «CanPlaceOn»

Adding 32 hides other information, including potion effects, shield pattern info, «StoredEnchantments», written book «generation» and «author», «Explosion», «Fireworks», and map tooltips

Adding 64 hides «Dyed» on leather armors

In logical form:

(HideEnchantments) | (HideAttributeModifiers << 1) | (HideUnbreakable << 2) | (HideCanDestroy << 3) | (HideCanPlaceOn << 4) | (HideOthers << 5) | (HideDyed << 6)

CanDestroy This tag is used when making adventure maps to allow a specific tool/item to break a block. Apply the tag to any item/tool. If the value is not a valid block or item it displays as «missingno«. 1 At least one {CanDestroy:[STRING, ...]} (Each string specifies a block id or block tag followed by the blockstate and NBT)

A copyable example:

{CanDestroy:["minecraft:stone","#minecraft:logs","minecraft:player_head[rotation=8]{SkullOwner:{Name:'Dinnerbone'}}"]}

PickupDelay The number of ticks before an item entity can be picked up. 1 All {PickupDelay:INT}
Age The duration before an item disappears. Any number. Set to -32768 for items that don’t disappear. If Age counts up to 6000 (5 minutes if Age started at default value 0), the item disappears.

Allowed 1 amount of same NBT Tags.

All {Age:INT}
generation (Minecraft Java Edition 1.8) Defines whether a written book is labeled as an «Original», a «Copy of Original», a «Copy of a copy» or «Tattered». «Original», «Copy of Original», «Copy of a copy», «Tattered»

Unknown amount of allowed same NBT Tags.

At least one {generation:INT}

0: Original

1: Copy of original

2: Copy of a copy

3: Tattered

Fireworks Used when giving yourself firework rockets, this value defines what the rocket will do when launched: color, flight duration, shape, etc. Any At least one {Fireworks:{Explosions:[{Colors:[I;INT, ...],FadeColors:[I;INT, ...],Flicker:BYTE,Trail:BYTE,Type:BYTE}, ...],Flight:BYTE}}

A copyable example:

{Fireworks:{Explosions:[{Type:3b,Flicker:1b,Colors:[I;4312372],FadeColors:[I;11743532]}],Flight:1b}}

The following table describes more details on Enchantments sub-tag.

Tagname Description Value Type Allowed Values Example
id The resource location of an enchantment. See Enchanting for details on which id correlates to which enchantment. String Enchantment ID «minecraft:efficiency»
lvl Determines the level of an enchantment. A level between one and ten displays properly on an item as a roman numeral, however, any value above that displays as enchantment.level.lvl. Short -32768 to 32767 4

Example command: /give @p minecraft:carved_pumpkin{Enchantments:[{id:"minecraft:efficiency",lvl:5s}]} 1

The following table describes more details on display sub-tag.

Tagname Description Value Type Allowed Values Example
Name The name of an item displayed in game. For blocks such as Chests and Dispensers the name replaces the default ‘Chest’ or ‘Dispenser’ in the upper left hand corner of the GUI. When used on command blocks the name is displayed when executing commands. This can be seen by using the /say command. String Text with JSON object with key «text». It’s value can be any character that is available within the Minecraft language files (Most characters on your keyboard)
{
	"text": "Sample name"
}
Lore The text under the name of the item. List of strings Text with JSON array containing JSON objects with key «text». Their values can be any character that is available within the Minecraft language files (Most characters on your keyboard)
[
	{
		"text": "First line"
	},
	{
		"text": "Second line"
	}
]

Example command: /[[Commands/'"`uniq--nowiki-0000000f-qinu`"'|'"`uniq--nowiki-0000000f-qinu`"']]

One can further modify the text with things like italics and boldness like so: /[[Commands/'"`uniq--nowiki-00000010-qinu`"'|'"`uniq--nowiki-00000010-qinu`"']]

The following table describes more details on the Fireworks sub-tag.

Tagname Description Value Type Allowed Values Example
Flight Defines the flight duration of the firework, the flight duration is how long the firework will wait until it explodes. Byte -128 to 127 {Flight:2b}
Explosions Defines what the firework rocket will do when its flight duration runs out, this is what the firework star is used for. More than one effect can be added as more than one firework star can be added to a rocket

Colors is the initial color of the explosion written in decimal format.

FadeColors is the color that the explosion will fade to written in decimal format.

Flicker is whether the whether the explosion flickers while it fades. This is the effect applied when you add glowstone to the firework star.

Trail is whether the particles leave trails as they travel. This effect is applied when you add a diamond to the firework star.

Type is the shape of the firework:

0 is Small Ball,

1 is Large Ball,

2 is Star-shaped,

3 is Creeper-shaped,

4 is Burst

Array Colors, FadeColors, Flicker, Trail, Type {Explosions:[{Type:3b,Flicker:1b,Colors:[I;4312372],FadeColors:[I;11743532]}]}

Blocks

These tags are put on blocks as items.

Tagname Description Value Type Example
CanPlaceOn This tag is used when making adventure maps to determine which block(s) the player can place a block on. Also used on hoes to make them till dirt and on spawn eggs to place them. If the value is not a valid block or item it displays as «missingno«. An array of strings, each one of which is a command argument of type block_predicate. However, to use NBT tags, the NBT data of the block must be synchronized to the client (campfires and player heads are two of the blocks that do so). {CanDestroy:["minecraft:stone","#minecraft:logs","minecraft:player_head[rotation=8]{SkullOwner:{Name:'Dinnerbone'}}"]}
BlockEntityTag This is used for tile entities, and stores their data for when they are placed down Differs based on the block, see Tutorials/Command NBT tags § Blocks 2 for details. Example: get a white shield by using a command: /give @p shield{BlockEntityTag:{Base:0}} {BlockEntityTag:{Glowing:1b}}
BlockStateTag This tag is used for blocks, and stores the block state when they are placed down. A compound where each key is a block state key, and the value is the block state value to force place for this block. Differs based on the block, see Block states for details. {BlockStateTag:{facing:"west",half:"top",shape:"straight"}}

Entities

These tags are used when using the /summon command to spawn entities or when using the /data to edit the data of entities.

NBT Tag Description Allowed tagnames Required tagnames Syntax
TileEntityData Used to store all data kept within a block. Mainly used within blocks that can store items or contain various data values, e.g., Command blocks, Chests, Jukeboxes, Dispenser, Beacon, etc. CustomName, Items, Command, Levels, Primary, Secondary, Delay, MaxNearbyEntities, MaxSpawnDelay, MinSpawnDelay, RequiredPlayerRange, SpawnCount, SpawnRange, EntityID None {TileEntityData:{Entity NBT data here}}
Motion Determines the initial velocity of most entities (all other than Dragon Fireballs, Fireballs, Small Fireballs and Wither Skulls) upon being summoned. Must be entered as double precision floating point values (decimals). Example: {Motion:[0.0,1.0,0.0]} summons with an initial upward velocity of 1.0. The values could be only -10 to 10, because it could have been to be moved very fast. It normally could lead to a wall clip. n/a All {Motion:[DOUBLE,DOUBLE,DOUBLE]}
direction Similar to Motion, determines the initial velocity of Dragon Fireballs, Fireballs, Small Fireballs, and Wither Skulls upon being summoned. This tag is required to summon said entities, otherwise the command fails. Example: {direction:[0.0,1.0,0.0]} summons with an initial upward velocity of 1.0.

This tag determines only the entity’s velocity, not the direction that it’s facing.

n/a All {direction:[DOUBLE,DOUBLE,DOUBLE]}
power Similar to direction, but determines constant acceleration. Example: {power:[0.0,1.0,0.0]} gives the summoned entity a constant upward acceleration of 1.0. Entities are still affected by drag when power is nonzero and eventually reaches a terminal velocity. Affects only Dragon Fireballs, Fireballs, Small Fireballs, and Wither Skulls. n/a All {power:[DOUBLE,DOUBLE,DOUBLE]}
ActiveEffects Sets the effects that apply to a mob after it is summoned. Type 999999 to apply its countdown to infinity. It should hide its numbers to *. Id, Duration, Amplifier, Ambient, ShowParticles All {ActiveEffects:[{Id:INT,Duration:INT,Amplifier:BYTE,Ambient:BYTE,ShowParticles:BYTE,ShowIcon:BYTE}, ...]}
rewardExp Controls villagers giving xp for trading, set to true or false. Normally, villagers can reward you experience orbs. True/False {rewardExp:BYTE} (0b for false or 1b for true)
Passengers Sets which entities are riding on top of the base entity. Allows multiple entities to ride one base entity. Riding entities are still able to do all stuff they have coded. Like enemies shooting on each other etc. Do not use a recent mob (if it doesn’t exist in your old version Minecraft). all (not checked) id {Passengers:[{id:STRING, ...}, ...]}
ArmorItems Defines what items are being worn by the mob. Items go in slots Feet, Legs, Chest, Head, in that order. Item None {ArmorItems:[{Count:BYTE,id:STRING,tag:{...}},{Count:BYTE,id:STRING,tag:{...}},{Count:BYTE,id:STRING,tag:{...}},{Count:BYTE,id:STRING,tag:{...}}]}
HandItems Defines what item is within the mainhand and offhand. First item is the mainhand, second is offhand. Item None {HandItems:[{Count:BYTE,id:STRING,tag:{...}},{Count:BYTE,id:STRING,tag:{...}}]}
HandDropChances Determines how likely it is for an entity to drop held Items. The tag Count in the equipment tag must be 1 or greater for this to work. 2 separate float values, one for the main hand and one for the off-hand slot. 0.0-1.0 determines likelihood of dropping, but applies a random durability if it does. Anything greater than 1.0 makes it always drop with full durability. Since it is a float value, it must be phrased as «X.Y», with X and Y being values of your choice. {HandDropChances:[FLOAT,FLOAT]}
ArmorDropChances Determines how likely it is for an entity to drop worn Items. The tag Count in the equipment tag must be 1 or greater for this to work. 4 separate float values, one for each slot. 0.0-1.0 determines likelihood of dropping, but applies a random durability if it does. Anything greater than 1.0 makes it always drop with full durability. Since it is a float value, it must be phrased as «X.Y», with X and Y being values of your choice. {ArmorDropChances:[FLOAT,FLOAT,FLOAT,FLOAT]}
NoAI Makes mobs have no AI, resulting in mobs not moving on their own. However, they still react to other changes in the environment. For example, the Zombie can still burn in the sun. {NoAI:BYTE} (0b for false or 1b for true)
NoGravity Makes mobs unaffected by gravity. Mobs do not fall. Mobs cannot walk in the air. {NoGravity:BYTE} (0b for false or 1b for true)
Silent Makes mobs silent. Does not work for certain sounds, see MC-64242. {Silent:BYTE} (0b for false or 1b for true)
Fire Determines how many ticks a mob is on fire. When Fire reaches one, the fire stops, and the mob no longer takes damage. When a mob is not on fire, this value is 1. {Fire:SHORT} (ranges from 0 to 32767)
Invulnerable Makes mobs invulnerable to everything except the Void and players in Creative Mode. Mobs do not attack or run away from invulnerable mobs. {Invulnerable:BYTE} (0b for false or 1b for true)
Attributes Customizes the attributes of the entity. See Attribute for more details Name: see Attribute for a list. Base: the amount to apply. Modifiers: how much and how it should vary. Contains values Name, Amount, Operation, UUID. Name and Base {Attributes:[{Name:STRING,Base:DOUBLE,Modifiers:[{Name:STRING, Amount:DOUBLE,Operation:BYTE,UUID:[I;INT,INT,INT,INT]}]}
Health Number of hearts (for hearts above the default maximum you must change the base value of the ‘generic.max_health’ attribute). All Mobs Number in half hearts {Health:FLOAT}
AngerTime, AngryAt A neutral mob becomes aggressive toward AngryAt for AngerTime ticks. Summoning neutral mobs Number in ticks, paired with a UUID {AngerTime:INT,AngryAt:[I;INT,INT,INT,INT]}
CustomName Summons a mob with a name that appears above their head. All Mobs A JSON Text component {CustomName:'"Custom Name"'} or you can use

{CustomName:'{"text":"Name Here ","color":"blue",...}'}

CustomNameVisible Alters the visibility of a custom name. 0b Means that the name is only visible when looking at the mob (default), and 1b means the name is always visible. Must use CustomName JSON code first to perform it. All Mobs Byte, 0b or 1b {CustomNameVisible:BYTE} (0b for false or 1b for true)
PersistenceRequired Mobs are undisappearable on time. Tamed animals without commands can also evolve this action. All Mobs True/False {PersistenceRequired:BYTE} (0b for false or 1b for true)

The following table provides information on each tagname that can be added in an NBT Tag. These tagnames are specific to the /summon command.

NBT Tag Description Used In Value Type Allowed Values
Type Used to change the type of mobs, like horses. Setting a horse’s type to 4 makes it a skeleton horse. Summon Integer 1 — JavaOverflowLimit
Saddle Used to spawn horses or pigs that have saddles on. Summon Boolean Binary true / false or 1 / 0
Tame Used to spawn tamed horses. Summon Boolean Binary true / false or 1 / 0
Variant Changes the horse or axolotl variant. Setting no variant or putting an incorrect variant spawns a normal white horse or pink axolotl. See Horse Variants for the list of horse variants. Summoning Horses Integer 1 — 1030
Size Changes the size of a slime, magma cube or phantom summoned into the game. Anything higher than 255 summons size 255. Anything lower than 0 summons size 0. More than 32 tends to cause extreme lag.(The high size of slime or magma cube may gotta lead to a crash. Things on your world won’t be saved if you restart the game.) Summoning

Slimes

Integer 0 — 255
BlockState Determines which block is being summoned when using /summon Falling_block. Use Data values to find out the ID of each block. You can also use F3+H in-game to show the ID’s of items in-game. Summoning Falling_block (AKA Fallingsand) Block ID and Block States e.g.{BlockState:{Name:"minecraft:oak_log", Properties:{axis:"y"}}} All Strings
Time Whether or not the block despawns before hitting the ground. If set to 1 the block falls normally, if set to less than 1 it is set to 0. If set to 0 the block despawns immediately. Recommended to keep this value as 1. Summoning Falling_block Integer (Include Negatives) -1 — 127
DropItem Whether or not the block drops its item form if the block is unable to be placed. If set to 0 the block does not drop its respective item, if set to 1 the block drops its respective item. Summoning Falling_block Boolean Binary 0 or 1
id Determines the entity the other entity is riding on. Summon Resource location {id:»minecraft:creeper»} Any resource location corresponding to an Entity
Fuse Determines how long it takes for PrimedTnt or a Creeper to explode. Summon Short 0 — 32767
ExplosionPower Used when summoning fireballs, Withers, and Ghasts to set the power of the explosion Summon Integer 0-127; Beyond 127 no explosion;
ExplosionRadius Used when summoning Creepers to set the radius of the explosion Summon Byte 0-127
powered Determines whether a Creeper is charged or not Summon Boolean Binary 0 or 1
PersistenceRequired Mobs are undisappearable on time. Tamed animals without commands can also evolve this action. Summon True/False {PersistenceRequired:1} or {PersistenceRequired:0}
AttachFace Determines what face the bottom of the shulker lies on. Summoning Shulkers Byte 0b — 5b
Peek Determines how far the Shulkers upper half opens. Positive values make the upper half open with a spin, Negative values appear to make the upper half open without a spin. Summoning Shulkers Byte -127b — 127b
APX More information is required on this entry. Appears to be approximated X position. Summoning Shulkers Integer Any whole number
APY More information is required on this entry. Appears to be approximated Y position. Summoning Shulkers Integer Any whole number
APZ More information is required on this entry. Appears to be approximated Z position. Summoning Shulkers Integer Any whole number

Villager

These tags are used when summoning villagers. (Offers NBT can’t be done in 1.14+)

Tagname Description Value type Syntax
Profession Determines the profession of the villager Numerical, 0 — 5 {Profession:#}
Offers Determines what the villager sells A string {Offers:{Recipes:[{buy:{id:»stone»,Count:1},maxUses:9999999,

sell:{id:»stone»,Count:1}}]}}

Item Frame

These tags are used when summoning itemframes.

Tag name Description Value type Syntax
Facing Determines the direction of the item frame Numerical, 0 — 5 (0 up; 1 down; 2 south; 3 north; 4 east; 5 west) {Facing:#}
ItemRotation Determines the rotation of the item in the item frame Numerical, 0 — 7 (Clockwise) {ItemRotation:#}
Item Determines the item in the item frame A string {Item:{id:»minecraft:<item>»,Count:<count>}}
Invisible Determines if the item frame is invisible 0b or 1b {Invisible:#}
Fixed Determines if the item frame is fixed 0b or 1b {Fixed:#}

Potion

These tags are used to customize potions

Tagname Description Value type Syntax
Potion Determines which type of potion be receive in / give minecraft:(potion effect) {Potion:»minecraft:#»}
CustomPotionEffects Customize the effect of potions Numerical {CustomPotionEffects:[{Id:#,Amplifier:#,Duration:#}]}
CustomPotionColor Determines the Color of Potion Bottle (1.11+) Decimal color code {CustomPotionColor:#}

Armor Stand

These tags are used when summoning armor stands.

NBT Tag Description Value type Syntax
NoGravity Toggles gravity 0b or 1b (0b for false, 1b for true) {NoGravity:#}
ShowArms Determines whether you can see the armor stand’s arms or not. Byte, 0b or 1b (0b for false, 1b for true) {ShowArms:#}
NoBasePlate Determines whether the armor stand has a base plate or not. Byte, 0b or 1b {NoBasePlate:#}
Small Determines whether the armor stand is small or not. Byte, 0b or 1b {Small:#}
Rotation Changes the rotation of the armor stand Byte, 0b or 1b {Rotation:[#f,#f]}
Marker Small Hit box Byte, 0b or 1b {Marker:#}
Pose Changes the pose of the armor stand’s body parts. Any subtag can be ommited Byte, 0b or 1b {Pose:{Head:[#f,#f,#f],Body:[#f,#f,#f],LeftArm:[#f,#f,#f],RightArm:[#f,#f,#f],LeftLeg:[#f,#f,#f],RightLeg:[#f,#f,#f]}}
Invisible Determines whether the armor stand is invisible or not. Byte, 0b or 1b {Invisible:#}

Note: The Equipment tag also works for armor stands.

Turtle

These tags are used when summoning turtles.

Tagname Description Value type Syntax
HomePosX Determines the X coordinate of a turtle’s home beach. Numerical {HomePosX:#}
HomePosY Determines the Y coordinate of a turtle’s home beach. Numerical {HomePosY:#}
HomePosZ Determines the Z coordinate of a turtle’s home beach. Numerical {HomePosZ:#}
TravelPosX Determines the distance a turtle can lay eggs from its home coordinates, on the X axis. Numerical {TravelPosX:#}
TravelPosY Determines the distance a turtle can lay eggs from its home coordinates, on the Y axis. Numerical {TravelPosY:#}
TravelPosZ Determines the distance a turtle can lay eggs from its home coordinates, on the Z axis. Numerical {TravelPosZ:#}
HasEgg Determines if the turtle has an egg to lay 0 – 0b – false
1 – 1b – true
{HasEgg:#}

Blocks

Tags used in /setblock and /fill:

Tagname Description Value Type Syntax
Command Used with command blocks. Places command block with command. A string {Command:»desired command»}
auto Used with command blocks. Places command block with «Always Active» rather than «Needs Redstone». 0 — 0b — false
1 — 1b — true
{auto:#}

Note: This is also used for Command Block Minecarts

Generic

These tags can be used on most tile entitied blocks

Tagname Description Value Type Syntax
CustomName Displayed in the top left corner of the inventory, instead of the regular name. Works only where such a regular name exists. A JSON text component {CustomName:»»Custom Name»»}
Lock Says a name needed on a held item to open the inventory. A string {Lock:»Key’s Name»}

Beacon

Tagname Description Value Type Syntax
Primary This determines the first status effect that the beacon creates. It defaults to level 1 of the effect. An ID of a status effect. {Primary:#}
Secondary This determines the second status effect. If its the same as Primary, then it increases the status effect to level 2. Otherwise it is level 1. Also an ID of a status effect. {Secondary:#}
Levels This number determines how many layers of valid blocks are below the beacon. This value updates automatically, and overrides /data inputs immediately. Integer {Levels:#}

Spawner

These tags are used when using /setblock or /summon (spawner minecarts) to create spawners. Add only those data tags you want to avoid a potential error.

Tagname Description Value Type Syntax
EntityId Specifies what entity the spawner spawns. A ID of a Mob {SpawnData:{entity: {id: «minecraft:EntityName»}}
SpawnData Used for spawners that spawn entities with data tags. An entity NBT tag {SpawnData:{NBT tag}}
SpawnCount How many entities the spawner can spawn at one time. Integer {SpawnCount:#}
SpawnRange The range of which the entities can spawn. Integer {SpawnRange:#}
RequiredPlayerRange The range of which a player must be in for the spawner to start spawning entities. Integer {RequiredPlayerRange:#}
Delay The number of ticks before entities spawn when a player is first detected. Integer {Delay:#}
MinSpawnDelay After the first spawn, this is the minimum amount of ticks before more entities can spawn. Integer {MinSpawnDelay:#}
MaxSpawnDelay Similar to MinSpawnDelay. After the first spawn, this is the maximum amount of ticks before more entities can spawn. Integer {MaxSpawnDelay:#}
MaxNearbyEntities Checks the number of entities within the spawn range (‘SpawnRange’ tag). If the number of entities it detects is over the set MaxNearbyEntities number, it does not spawn more entities unless the amount of entities within the spawn range is decreased. Integer {MaxNearbyEntities:#}
SpawnPotentials Used when creating spawners that spawn multiple types of entities. A weighted list of entities to be spawned, including NBT tags. A List SpawnPotentials:[{data: {entity: {id: «minecraft:EntityName»} }, weight:#}]
Weight Used if spawning multiple entities using SpawnPotentials. If the same as another SpawnPotentials entity, both have an even chance of spawning. A number {Weight:#}

Sub-tags used in the SpawnPotentials data tag.

Tagname Description Value Type Syntax
Type Determines the other entity that spawns with the entity specified in the EntityId data tag. MUST be used with SpawnPotentials. A string {SpawnPotentials:[{Type:»EntityName»}]}
Weight Determines the chance of spawning the entity specified in the ‘Type’ sub-tag. If set to the same as another other entity’s weight, they have the same chance of spawning. A number {SpawnPotentials:[{Weight:#}]}
Properties Determines the entity data tag(s) that the entity (specified in the ‘Type’ sub-tag) is spawned with. An entity NBT tag {SpawnPotentials:[{Properties:{NBT tag}}]}

See also

  • Tutorials/Command blocks and functions

References

  1. There can be more or even wrong values, make sure you test them first! This tag may need major editing!
Tutorials
Introductory
  • Menu screen
  • Downgrading
  • Game terms
Newcomer survival
  • The first day/beginner’s guide
  • The second day
  • The third day
  • Hunger management
  • Things not to do
  • Simple tips and tricks
  • Your first ten minutes
Shelters
  • Best biomes for homes
  • Best building materials
  • Building and construction
  • Navigation
  • Shelters
  • Shelter types
General
  • Achievement guide
  • Advancement guide
  • Best enchantments guide
  • Breaking bedrock
  • Combat
  • Complete main adventure
  • Creating a village
  • Dual wielding
  • End survival
  • Exploring caverns
  • Gathering resources on peaceful difficulty
  • Getting food quickly
  • Headless pistons
  • Hitboxes
  • Horses
  • Indestructible end crystals
  • Light suppression
  • Mapping
  • Measuring distance
  • Minecraft in education
  • Mining
    • Diamonds
    • Fossils
    • Ancient Debris
  • Nether hub
  • Nether portals
  • Nether survival
  • Organization
  • Pillar jumping
  • PvP
    • PvP bases
  • Spawn-proofing
  • Summoning jockeys
  • The Void
  • Time-saving tips
  • Thunderstorm survival
  • Units of measure
  • Update suppression
  • Village mechanics
    • Trading
  • X-ray glitches
Challenges
  • Acquiring a conduit
  • Curing a zombie villager
  • Defeating temples
  • Defeating a village raid
  • Defeating a Nether fortress
  • Defeating a bastion remnant
  • Defeating a dungeon
  • Defeating a pillager outpost
  • Defeating a woodland mansion
  • Defeating a monument
  • Defeating an End city
  • Defeating the Ender dragon
  • Defeating the Wither
  • Exploring an ancient city
  • Obtaining every music disc
Non-standard
survival
  • Adventure survival
  • Half hearted hardcore
  • Hardcore mode
  • Surviving in a single area indefinitely
  • Infinite desert survival
  • Island survival
  • Manhunt
  • Nomadic experience
  • Skywars survival
  • Superflat survival
  • Flat survival
  • Ultra hardcore survival
Challenge maps
  • Beating a challenge map
  • Creating a challenge map
Constructions
  • Adding beauty to constructions
  • Airlock
  • Architectural terms
  • Building a cruise ship
  • Building a metropolis
  • Building a rollercoaster
  • Building safe homes
  • Building water features
  • Color palette
  • Creating shapes
  • Defense
  • Desert shelter
  • Elevators
  • Endless circling pool
  • Furniture
  • Glazed terracotta patterns
  • Making nice floors
  • Pixel art
  • Ranches
  • Roof types
    • Curved roofs
    • Roof construction guidelines
    • Roof decorations
  • Secret door
  • Settlement guide
  • Underwater home
  • Walls and buttresses
  • Water gate
  • Water-powered boat transportation
Farming
Blocks and items
  • Amethyst
  • Armor
  • Azalea
  • Bamboo
  • Basalt
  • Bedrock
  • Blaze rod
  • Bone meal
  • Cactus
  • Chorus fruit
  • Clay and mud
  • Cobblestone
  • Cocoa bean
  • Copper
  • Crops (Beetroot, Carrot, Potato, Wheat)
  • Dirt
  • Dragon’s breath
  • Dripstone
  • Egg
  • Fern
  • Fish
  • Flower
  • Froglight
  • Glow berries
  • Glow ink sac
  • Glow lichen
  • Goat horn
  • Gold
  • Hanging roots
  • Honey
  • Ice
  • Iron
  • Kelp
  • Lava
  • Meat
  • Moss block
  • Mushroom
  • Music disc
  • Nautilus shell
  • Nether growth
  • Nether vine
  • Nether wart
  • Obsidian
  • Powder snow
  • Pumpkin, Melon
  • Rooted dirt
  • Sculk growths
  • Scute
  • Seagrass
  • Sea pickle
  • Snow
  • Soul soil
  • Sugar cane
  • Sweet berries
  • Tree
  • Trident
  • Vine
  • Villager trading hall
  • Wither rose
  • Wool
  • Duplication
Mobs
  • Mob farming
  • Mob grinding
  • Monster spawner traps
  • Allay
  • Animals
  • Axolotl
  • Blaze
  • Cat
  • Cave spider
  • Creeper
  • Drowned
  • Ender dragon
  • Enderman
  • Frog
  • Goat
  • Guardian
  • Hoglin
  • Iron golem
  • Magma cube
  • Phantom
  • Piglin bartering farm
  • Raid
  • Shulker
  • Slime
  • Squid
  • Turtle
  • Villager
  • Wandering trader
  • Warden
  • Witch
  • Wither
  • Wither skeleton
  • Zombie
  • Zombie villager
  • Zombified piglin
OP farms
  • End of light mob farms
Enchanting
and smelting
  • Enchantment mechanics
  • Anvil mechanics
  • Automatic smelting
  • Manual smelting
Blockbreaking
  • Blast chamber
  • Wither cage
Mechanisms
Basic redstone
  • Automatic respawn anchor recharger
  • Basic logic gates
  • Combination locks
  • Command block
  • Flying machines
  • Hopper
  • Item sorting
  • Item transportation
  • Mechanisms
  • Observer stabilizer
  • Randomizers
  • Redstone music
  • Redstone tips
  • Rube Goldberg machine
  • Shulker box storage
  • Villager trading hall
Detectors
  • Block update detector
  • Comparator update detector
  • Daylight sensor
  • Day night detector
Minecarts
  • Train station
  • Minecarts
    • Storage
    • Storage system
Traps
  • Snow golems
  • TNT cannons
  • Trapdoor uses
  • Trap design
  • Traps
Pistons
  • Piston uses
  • Piston circuits
  • Quasi-connectivity
  • Zero-ticking
  • Instant repeaters
Advanced
redstone
  • Advanced redstone circuits
  • Arithmetic logic
  • Calculator
  • Command stats
  • Hourly clock
  • Morse code
  • Printer
  • Redstone computers
  • Redstone telegraph
Servers
  • Playing on servers
  • Multiplayer Survival
  • Spawn jail
  • Griefing prevention
  • Joining a LAN world with alternate accounts
Server setup
  • Setting up a server
  • Server startup script
  • FreeBSD startup script
  • OpenBSD startup script
  • Ubuntu startup script
  • Setting up a Hamachi server
  • Setting up a Minecraft Forge server
  • Setting up a Spigot server
  • Ramdisk enabled server
Technical
  • Improving frame rate
  • Minecraft help FAQ (IRC channel)
  • Update Java
Maps
  • Custom maps
  • Map downloads
  • Command NBT tags
  • Falling blocks
  • Updating old terrain using MCEdit
Resource packs
  • Creating a resource pack
  • Loading a resource pack
  • Sound directory
Data packs
  • Creating a data pack
  • Installing a data pack
Creating
Minecraft media
  • Creating videos
  • Livestreaming
Game installation
  • Installing snapshots
  • Joining and leaving the Bedrock Edition beta program
  • How to get a crash report
  • Installing Forge mods
  • Custom Minecraft directory
  • Playing and saving Minecraft on a thumb drive
  • Playing and saving Minecraft on a thumb drive with the old launcher
  • Recover corrupted saved world data
  • Run Minecraft through Google Drive
  • Save game data to Dropbox (world data only)
  • Saved data Dropbox guide
Outdated
  • Building micro shelters
  • Custom texture packs
  • Door-based iron golem farming
  • Far Lands
  • How to get a crash report
  • Installing mods
  • Man-made lake
  • Managing slimes in superflat mode
  • Minecart booster
  • Potion farming
  • Repeater reboot system
  • Survival with no enabled data packs
  • Update LWJGL
  • Update Minecraft
  • Village chaining
  • Water ladder
  • Water tram

NBT tags are used to specify information for items and entities created with the «/give«, «/summon«, «/tellraw» (for the JSON message), «/fill«, «/blockdata{Until 1.13}«, «/setblock«, and «/clear» commands.

Each Tag has the format <tagname>:<value>. Tag names are case-sensitive. The payloads of List Tags are enclosed in square brackets [...], with each additional unnamed Tag separated by a comma. The payloads of Compound Tags are enclosed in braces {...}, with each additional Named Tag separated by a comma — Note that the entire entity data tag is itself an unnamed Compound Tag.

You can find a lot of tag names, especially in entities and block entities by using the «/data get entity" or /data get block command.

How To Get Them?

To get the NBT tag of a specific entity (for example, creeper), you use the command /data get entity @e[type=creeper,limit=1] to get the full data of the creeper itself. For more specific selectors, see Commands

Tag Basics

Structure of a Tag

First off, each tag has three parts:

tagType (byte, 0-12)
name (TAG_String)
[its payload]

When using commands, the tagType is figured out based on the given name, and the payload is what follows the colon — basically its value. The payload ought to fit the expected syntax. So a tag expecting an integer will not accept a string.

Number types can be denoted with a letter at the end of the value (such as 0b for a byte). Without a letter, the code assumes an integer, which works fine for most numbers but behaves differently. Using a literal integer like this to exceed a type’s expected range simply wraps the number back to 0 at the limit.

Tag Types

00 TAG_End
Unnamed, no payload, unusable in commands. Used in data storage to mark the end of TAG_Compound.
01 TAG_Byte
Payload: A single signed byte (8 bits)
Ranges from -128 to 127. Used for many booleans.
In Commands: ...b or ...B
02 TAG_Short
Payload: A single signed short integer (2 bytes, big endian)
Ranges from -215 to 215-1
In Commands: ...s or ...S
03 TAG_Int
Payload: A single signed integer (4 bytes, big endian)
Ranges from -231 to 231-1
In Commands: A literal number without a decimal
04 TAG_Long
Payload: A single signed long integer (8 bytes, big endian)
Ranges from -263 to 263-1
In Commands: ...l or ...L
05 TAG_Float
Payload: A floating-point number (4 bytes, big endian, IEEE 754-2008, single precision)
Maxes around 1038.23, or 1.698x1038
In Commands: ...f or ...F, decimal or no decimal
06 TAG_Double
Payload: A floating-point number (8 bytes, big endian, IEEE 754-2008, double precision)
Maxes around 10307.95, or 8.913x10307
In Commands: ...d, ...D, or a decimal number
07 TAG_Byte_Array
Payload: Unnamed TAG_Int (length), then an array of bytes of unspecified format. The length of this array is <length> bytes.
In Commands: [B; <byte>, <byte>, ... ]
(<length> is determined by the length of the given array)
08 TAG_String
Payload: Unnamed TAG_Short (length), then an array of bytes of length <length>. defining a string in UTF-8 format.
In Commands: "<text>"
(<length> is determined by the length of the given text)
Note that as is usual with most strings, if quotes are to be included within the string, escape codes (") must be used for the inner quotes in commands.
09 TAG_List
Payload: Unnamed TAG_Byte (tagId), unnamed TAG_Int (length), then a sequential list of unnamed Tags of type <tagId>. The length of this array is <length> Tags.
In Commands: [<value>, <value>, ...]
(<length> is determined by the length of the given list)
10 TAG_Compound
Payload: A sequential list of unique Named Tags. This array is terminated by a TAG_End.
Nested Compound Tags are terminated by their own internal End Tags.
In Commands: {<tag name>: <value>, <tag name>: <value>, ... }
(The terminating TAG_End is irrelevant to command usage)
11 TAG_Int_Array
Payload: Unnamed TAG_Int (size), then an array of unnamed TAG_Ints. The length of this array is <size> Tags.
An array of integers.
In Commands: [I; <integer>, <integer>, ... ]
(<size> is determined by the size of the given array)
12 TAG_Long_Array
Payload: Unnamed TAG_Int (size), then an array of unnamed TAG_Longs. The length of this array is <size> Tags.
In Commands: Used as [L; <long>, <long>, ... ]
(<size> is determined by the size of the given array)

Tag Payloads

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 tagId (1 byte), a name (Unnamed TAG_String), and a payload.

  • The first byte of data read is the tagId. Above is 10, 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 Structure of a Tag above.) The given length is 3. Those next 3 bytes read ham. 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 8, 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 short is 6, so the «pigName» has a value that’s 6 bytes long. Those bytes read Hampus. The completed first Tag is TAG_String("name"):6 Hampus
    • The next byte is 3, so next is a TAG_Int. It has the 5-byte name of «value». Its payload follows in the next 4 bytes: 120. The next completed Tag is TAG_Int("value"): 120
    • The next byte is 0, 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}}

List of Entity Data Tags

Minecraft code spawns entities with set Tags and values. Entities are themselves saved as tags within the world’s chunk data. Every detail about an entity is stored in its data tag. All tags are referenced by the game’s code to control entity behaviour.

The following tags are common to all entities.

id: <TAG_String>
Entity ID.
pos: <TAG_List>
[<TAG_Double>, <TAG_Double>, <TAG_Double>]
Three doubles describe current X, Y, Z position of entity
Motion: <TAG_List>
[<TAG_Double>, <TAG_Double>, <TAG_Double>]
Three doubles describe the current dX, dY, dZ velocities of entity (in metres per tick)
Rotation: <TAG_List>
[<TAG_Float>, <TAG_Float>]
Two floats describe entity’s rotation in degrees

  • First float is clockwise rotation around the Y axis, with 0° facing in the positive Z direction, or due south. Ranges from 0.0 to 360.0
  • Second float is declination from the horizon. Ranges from -90.0 (upwards) to +90.0 (downwards)
FallDistance: <TAG_Float>
Distance entity has fallen. Fall damage taken scales with this number. 0 for any entity at rest
Fire: <TAG_Short>
Ticks until a burning entity’s fire ends. Negative values are how many ticks an entity can stand in fire before burning. -20 for an entity not on fire
Air
Ticks until an entity runs out of air while underwater. While this value is 0 and the entity is underwater, it takes damage. Fills to 300 for any entity above water
OnGround: <TAG_Byte>
0 for false, 1 for true. True when the entity is touching the ground
NoGravity: <TAG_Byte>
0 for false, 1 for true. If true, entity is unaffected by gravity and stops changing Y position
Dimension: <TAG_Int>
0 for the Overworld, -1 for the Nether, and 1 for the End. Only known to be used for player data
Invulnerable: <TAG_Byte>
0 for false, 1 for true. When true, mobs don’t take damage from any source and cannot be moved by force. Objects like item frames cannot be destroyed unless a supporting block is removed
PortalCooldown: <TAG_Int>
Number of ticks until the entity may teleport through a nether portal. Starts at 300 ticks
UUIDMost: <TAG_Long>
The most significant 64 bits of this entity’s Universally Unique Identifier (UUID).
UUIDLeast: <TAG_Long>
The least significant 64 bits of this entity’s Universally Unique Identifier (UUID).
CustomName: <TAG_String>
The entity’s custom name string.
In Minecraft Java Edition 1.14, <TAG_String> must itself have quotes, as well as the standard quotes that go around strings. This means that escape codes are needed for the inner ones, so syntax looks like the following, (if one is to name an entity Gerald).
CustomName: ""Gerald""
Another way that this works is by setting it to an apparent compound tag specifying a block of text, done this way:
CustomName: "{"text":"Gerald"}"
CustomNameVisible: <TAG_Byte>
0 for false, 1 for true. If true, this entity’s custom name always appears above its head, whether or not the player is looking at it.
Silent: <TAG_Byte>
0 for false, 1 for true. If true, this entity is silent.
Passengers: <TAG_String>
Data for the entity riding this entity.
Glowing: <TAG_Byte>
-0 for false, 1 for true. When true, the entity has a cartoonish, glowing outline.
Tags: <TAG_String>
List of custom data.

Mobs

The following tags are common to all mobs

Health: <TAG_Float>
Amount of health an entity has.
AbsorptionAmount: <TAG_Float>
Amount of additional, temporary health added by the Absorption status effect.
HurtTime: <TAG_Short>
Set to 10 when a mob is struck, colouring it red. Decreases by 1 per tick until 0, when the mob turns normal colour again.
HurtByTimestamp: <TAG_Long>
Timestamp in the mob’s life when it was last damaged, measured in ticks since its creation.
DeathTime: <TAG_Short>
Number of ticks since the mob’s death. 0 for any living mob.
FallFlying: <TAG_Byte>
0 for false, 1 for true. When true and the mob is wearing the elytra, they’ll glide.
Attributes: <TAG_List>
[<TAG_Compound>, <TAG_Compound>, ... ]
List of Attributes for a mob.

Attribute Tags
Name: <TAG_String>
Given name for the Attribute. Might be generic.maxHealth or horse.jumpStrength.
Base: <TAG_Double>
Modifiers: <TAG_List>
List of modifiers acting on the Attribute.

Modifier Tags
Name: <TAG_String>
Amount: <TAG_Double>
Operation: <TAG_Int>
UUIDMost: <TAG_Long>
UUIDLeast: <TAG_Long>
ActiveEffects: <TAG_List>
[<TAG_Compound>, <TAG_Compound>, ... ]
List of potion effects.

Effect Tags
Id: <TAG_Byte>
Amplifier: <TAG_Byte>
Duration: <TAG_Int>
Ambient: <TAG_Byte>
ShowParticles: <TAG_Byte>
ShowIcon: <TAG_Byte>
HandItems: <TAG_List>
[<TAG_Compound>, <TAG_Compound>]
Describes items the entity is holding. These Compound Tags have Tags Common to All Items. Slot is discluded.
<TAG_Compound 0>: The item held in the mob’s main hand.
<TAG_Compound 1>: The item held in the mob’s off-hand.
ArmorItems: <TAG_List>
[<TAG_Compound>, <TAG_Compound>, ... ]
What the entity is wearing. These Compound Tags have Tags Common to All Items. Slot is discluded.
<TAG_Compound 0>: The item worn on the feet.
<TAG_Compound 1>: The item worn on the legs.
<TAG_Compound 2>: The item worn on the chest.
<TAG_Compound 3>: The item worn on the head.
HandDropChances: <TAG_List>
ArmorDropChances: <TAG_List>
DeathLootTable: <TAG_String>
DeathLootTableSeed: <TAG_Long>
CanPickUpLoot: <TAG_Byte>
NoAI: <TAG_Byte>
PersistenceRequired: <TAG_Byte>
LeftHanded: <TAG_Byte>
Team: <TAG_String>
Leashed: <TAG_Byte>
Leash: <TAG_Compound>

Mobs That Breed

Mobs that can breed include Cows, Chickens, Pigs, Sheep, Villagers, Cats, and Dogs.
InLove: <TAG_Int>
Counts down number of ticks until this mob stops searching for a mate. Default 0 for a mob not doing so.
Age: <TAG_Int>
Age of the mob in ticks. When less than 0 and counting up, represents a baby mob. Adult mobs use this value to count down how many ticks until it can breed again.
ForcedAge: <TAG_Int>
LoveCauseLeast: <TAG_Long>
Least significant bits of the UUID for the entity that caused this animal to breed
LoveCauseMost: <TAG_Long>
Most significant bits of the UUID for the entity that caused this animal to breed

Mobs That Raid

Coming Soon

Specific Mobs

The following lists are specific to each mob

bat
id: <TAG_String>
Entity ID.
pos: <TAG_List>
[<TAG_Double>, <TAG_Double>, <TAG_Double>]
Three doubles describe current X, Y, Z position of entity
Motion: <TAG_List>
[<TAG_Double>, <TAG_Double>, <TAG_Double>]
Three doubles describe the current dX, dY, dZ velocities of entity (in metres per tick)
Rotation: <TAG_List>
[<TAG_Float>, <TAG_Float>]
Two floats describe entity’s rotation in degrees

  • First float is clockwise rotation around the Y axis, with 0° facing in the positive Z direction, or due south. Ranges from 0.0 to 360.0
  • Second float is declination from the horizon. Ranges from -90.0 (upwards) to +90.0 (downwards)
FallDistance: <TAG_Float>
Distance entity has fallen. Fall damage taken scales with this number. 0 for any entity at rest
Fire: <TAG_Short>
Ticks until a burning entity’s fire ends. Negative values are how many ticks an entity can stand in fire before burning. -20 for an entity not on fire
Air
Ticks until an entity runs out of air while underwater. While this value is 0 and the entity is underwater, it takes damage. Fills to 300 for any entity above water
OnGround: <TAG_Byte>
0 for false, 1 for true. True when the entity is touching the ground
NoGravity: <TAG_Byte>
0 for false, 1 for true. If true, entity is unaffected by gravity and stops changing Y position
Dimension: <TAG_Int>
0 for the Overworld, -1 for the Nether, and 1 for the End. Only known to be used for player data
Invulnerable: <TAG_Byte>
0 for false, 1 for true. When true, mobs don’t take damage from any source and cannot be moved by force. Objects like item frames cannot be destroyed unless a supporting block is removed
PortalCooldown: <TAG_Int>
Number of ticks until the entity may teleport through a nether portal. Starts at 300 ticks
UUIDMost: <TAG_Long>
The most significant 64 bits of this entity’s Universally Unique Identifier (UUID).
UUIDLeast: <TAG_Long>
The least significant 64 bits of this entity’s Universally Unique Identifier (UUID).
CustomName: <TAG_String>
The entity’s custom name string.
In Minecraft Java Edition 1.14, <TAG_String> must itself have quotes, as well as the standard quotes that go around strings. This means that escape codes are needed for the inner ones, so syntax looks like the following, (if one is to name an entity Gerald).
CustomName: ""Gerald""
Another way that this works is by setting it to an apparent compound tag specifying a block of text, done this way:
CustomName: "{"text":"Gerald"}"
CustomNameVisible: <TAG_Byte>
0 for false, 1 for true. If true, this entity’s custom name always appears above its head, whether or not the player is looking at it.
Silent: <TAG_Byte>
0 for false, 1 for true. If true, this entity is silent.
Passengers: <TAG_String>
Data for the entity riding this entity.
Glowing: <TAG_Byte>
-0 for false, 1 for true. When true, the entity has a cartoonish, glowing outline.
Tags: <TAG_String>
List of custom data.
Health: <TAG_Float>
Amount of health an entity has.
AbsorptionAmount: <TAG_Float>
Amount of additional, temporary health added by the Absorption status effect.
HurtTime: <TAG_Short>
Set to 10 when a mob is struck, colouring it red. Decreases by 1 per tick until 0, when the mob turns normal colour again.
HurtByTimestamp: <TAG_Long>
Timestamp in the mob’s life when it was last damaged, measured in ticks since its creation.
DeathTime: <TAG_Short>
Number of ticks since the mob’s death. 0 for any living mob.
FallFlying: <TAG_Byte>
0 for false, 1 for true. When true and the mob is wearing the elytra, they’ll glide.
Attributes: <TAG_List>
[<TAG_Compound>, <TAG_Compound>, ... ]
List of Attributes for a mob.

Attribute Tags
Name: <TAG_String>
Given name for the Attribute. Might be generic.maxHealth or horse.jumpStrength.
Base: <TAG_Double>
Modifiers: <TAG_List>
List of modifiers acting on the Attribute.

Modifier Tags
Name: <TAG_String>
Amount: <TAG_Double>
Operation: <TAG_Int>
UUIDMost: <TAG_Long>
UUIDLeast: <TAG_Long>
ActiveEffects: <TAG_List>
[<TAG_Compound>, <TAG_Compound>, ... ]
List of potion effects.

Effect Tags
Id: <TAG_Byte>
Amplifier: <TAG_Byte>
Duration: <TAG_Int>
Ambient: <TAG_Byte>
ShowParticles: <TAG_Byte>
ShowIcon: <TAG_Byte>
HandItems: <TAG_List>
[<TAG_Compound>, <TAG_Compound>]
Describes items the entity is holding. These Compound Tags have Tags Common to All Items. Slot is discluded.
<TAG_Compound 0>: The item held in the mob’s main hand.
<TAG_Compound 1>: The item held in the mob’s off-hand.
ArmorItems: <TAG_List>
[<TAG_Compound>, <TAG_Compound>, ... ]
What the entity is wearing. These Compound Tags have Tags Common to All Items. Slot is discluded.
<TAG_Compound 0>: The item worn on the feet.
<TAG_Compound 1>: The item worn on the legs.
<TAG_Compound 2>: The item worn on the chest.
<TAG_Compound 3>: The item worn on the head.
HandDropChances: <TAG_List>
ArmorDropChances: <TAG_List>
DeathLootTable: <TAG_String>
DeathLootTableSeed: <TAG_Long>
CanPickUpLoot: <TAG_Byte>
NoAI: <TAG_Byte>
PersistenceRequired: <TAG_Byte>
LeftHanded: <TAG_Byte>
Team: <TAG_String>
Leashed: <TAG_Byte>
Leash: <TAG_Compound>
BatFlags: <TAG_Byte>
0 when flying, 1 for when resting upside-down.
blaze
Template:Data Tags/blaze
cat
Template:Data Tags/cat
cave_spider
Template:Data Tags/cave spider
chicken
Template:Data Tags/chicken
cow
Template:Data Tags/cow
creeper
id: <TAG_String>
Entity ID.
pos: <TAG_List>
[<TAG_Double>, <TAG_Double>, <TAG_Double>]
Three doubles describe current X, Y, Z position of entity
Motion: <TAG_List>
[<TAG_Double>, <TAG_Double>, <TAG_Double>]
Three doubles describe the current dX, dY, dZ velocities of entity (in metres per tick)
Rotation: <TAG_List>
[<TAG_Float>, <TAG_Float>]
Two floats describe entity’s rotation in degrees

  • First float is clockwise rotation around the Y axis, with 0° facing in the positive Z direction, or due south. Ranges from 0.0 to 360.0
  • Second float is declination from the horizon. Ranges from -90.0 (upwards) to +90.0 (downwards)
FallDistance: <TAG_Float>
Distance entity has fallen. Fall damage taken scales with this number. 0 for any entity at rest
Fire: <TAG_Short>
Ticks until a burning entity’s fire ends. Negative values are how many ticks an entity can stand in fire before burning. -20 for an entity not on fire
Air
Ticks until an entity runs out of air while underwater. While this value is 0 and the entity is underwater, it takes damage. Fills to 300 for any entity above water
OnGround: <TAG_Byte>
0 for false, 1 for true. True when the entity is touching the ground
NoGravity: <TAG_Byte>
0 for false, 1 for true. If true, entity is unaffected by gravity and stops changing Y position
Dimension: <TAG_Int>
0 for the Overworld, -1 for the Nether, and 1 for the End. Only known to be used for player data
Invulnerable: <TAG_Byte>
0 for false, 1 for true. When true, mobs don’t take damage from any source and cannot be moved by force. Objects like item frames cannot be destroyed unless a supporting block is removed
PortalCooldown: <TAG_Int>
Number of ticks until the entity may teleport through a nether portal. Starts at 300 ticks
UUIDMost: <TAG_Long>
The most significant 64 bits of this entity’s Universally Unique Identifier (UUID).
UUIDLeast: <TAG_Long>
The least significant 64 bits of this entity’s Universally Unique Identifier (UUID).
CustomName: <TAG_String>
The entity’s custom name string.
In Minecraft Java Edition 1.14, <TAG_String> must itself have quotes, as well as the standard quotes that go around strings. This means that escape codes are needed for the inner ones, so syntax looks like the following, (if one is to name an entity Gerald).
CustomName: ""Gerald""
Another way that this works is by setting it to an apparent compound tag specifying a block of text, done this way:
CustomName: "{"text":"Gerald"}"
CustomNameVisible: <TAG_Byte>
0 for false, 1 for true. If true, this entity’s custom name always appears above its head, whether or not the player is looking at it.
Silent: <TAG_Byte>
0 for false, 1 for true. If true, this entity is silent.
Passengers: <TAG_String>
Data for the entity riding this entity.
Glowing: <TAG_Byte>
-0 for false, 1 for true. When true, the entity has a cartoonish, glowing outline.
Tags: <TAG_String>
List of custom data.
Health: <TAG_Float>
Amount of health an entity has.
AbsorptionAmount: <TAG_Float>
Amount of additional, temporary health added by the Absorption status effect.
HurtTime: <TAG_Short>
Set to 10 when a mob is struck, colouring it red. Decreases by 1 per tick until 0, when the mob turns normal colour again.
HurtByTimestamp: <TAG_Long>
Timestamp in the mob’s life when it was last damaged, measured in ticks since its creation.
DeathTime: <TAG_Short>
Number of ticks since the mob’s death. 0 for any living mob.
FallFlying: <TAG_Byte>
0 for false, 1 for true. When true and the mob is wearing the elytra, they’ll glide.
Attributes: <TAG_List>
[<TAG_Compound>, <TAG_Compound>, ... ]
List of Attributes for a mob.

Attribute Tags
Name: <TAG_String>
Given name for the Attribute. Might be generic.maxHealth or horse.jumpStrength.
Base: <TAG_Double>
Modifiers: <TAG_List>
List of modifiers acting on the Attribute.

Modifier Tags
Name: <TAG_String>
Amount: <TAG_Double>
Operation: <TAG_Int>
UUIDMost: <TAG_Long>
UUIDLeast: <TAG_Long>
ActiveEffects: <TAG_List>
[<TAG_Compound>, <TAG_Compound>, ... ]
List of potion effects.

Effect Tags
Id: <TAG_Byte>
Amplifier: <TAG_Byte>
Duration: <TAG_Int>
Ambient: <TAG_Byte>
ShowParticles: <TAG_Byte>
ShowIcon: <TAG_Byte>
HandItems: <TAG_List>
[<TAG_Compound>, <TAG_Compound>]
Describes items the entity is holding. These Compound Tags have Tags Common to All Items. Slot is discluded.
<TAG_Compound 0>: The item held in the mob’s main hand.
<TAG_Compound 1>: The item held in the mob’s off-hand.
ArmorItems: <TAG_List>
[<TAG_Compound>, <TAG_Compound>, ... ]
What the entity is wearing. These Compound Tags have Tags Common to All Items. Slot is discluded.
<TAG_Compound 0>: The item worn on the feet.
<TAG_Compound 1>: The item worn on the legs.
<TAG_Compound 2>: The item worn on the chest.
<TAG_Compound 3>: The item worn on the head.
HandDropChances: <TAG_List>
ArmorDropChances: <TAG_List>
DeathLootTable: <TAG_String>
DeathLootTableSeed: <TAG_Long>
CanPickUpLoot: <TAG_Byte>
NoAI: <TAG_Byte>
PersistenceRequired: <TAG_Byte>
LeftHanded: <TAG_Byte>
Team: <TAG_String>
Leashed: <TAG_Byte>
Leash: <TAG_Compound>
powered: <TAG_Byte>
0 is false, 1 is true. If set to true, this creeper is lightning-charged
ignited: <TAG_Byte>
0 is false, 1 is true. If true, this creeper has been ignited by Flint and Steel
ExplosionRadius: <TAG_Byte>
Determines the explosive radius if the creeper explodes. Default is 3
fuse: <TAG_Short>
Determines the time in ticks the creeper will hiss before exploding. Default is 30
dolphin
Template:Data Tags/dolphin
donkey
Template:Data Tags/donkey
drowned
Template:Data Tags/drowned
elder_guardian
Template:Data Tags/elder guardian
enderman
Template:Data Tags/enderman
endermite
Template:Data Tags/endermite
evoker
Template:Data Tags/evoker
ghast
Template:Data Tags/ghast
giant
Template:Data Tags/giant
guardian
Template:Data Tags/guardian
horse
Template:Data Tags/horse
husk
Template:Data Tags/husk
illager_beast
Template:Data Tags/illager beast
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
ocelot
Template:Data Tags/ocelot
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
stray
Template:Data Tags/stray
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
wolf
Template:Data Tags/wolf
zombie
IsBaby: <TAG_Byte>
0 is false, 1 is true. If value is 1, this zombie is a baby.
IsVillager: <TAG_Byte>
0 is false, 1 is true. If value is true, this zombie is an undead villager.
CanBreakDoors: <TAG_Byte>
0 is false, 1 is true. If value is true, this zombie can break wooden doors.
DrownedConversionTime: <TAG_Long>
Counts down the number of ticks until this zombie converts into the drowned. Default -1 for a zombie above water.
InWaterTime: <TAG_Long>
Number of ticks this zombie has been under water. Default -1 for a zombie above water.
Template:Data Tags/
Template:Data Tags/
zombie_villager
Template:Data Tags/zombie villager

Other

Tags Common to All Items
Template:Common Tags/Items
Tags Common to All Block Entities
Template:Common Tags/Block Entities
Tags Common to All Minecart Types
Template:Common Tags/Minecart Types
Tags Common to All Projectiles
Template:Common Tags/Projectiles

To Be Removed

The rest of this page is likely to be removed.

Blocks («/setblock» or «/fill«)

Containers

Items: []The ID and other info of an item.

|_ id: {}The ID of the item.

|_ Slot: {}The slot number. Note that this starts at 0, not 1.

|_ tag: {}Other info of the item.

Items (/give)

All Items

Enchantments: Enchantments on the item.

|_ An enchantement. (List)

       |_ id: The name of the enchantment. Cannot be a number.
       |_ lvl: The level of the enchant. Range is -32768 to 32767.

display: Display properties.

|_ Name: The Custom Name of the item. Range of characters that can be used seems to be infinite.

       |_ Name: ["{"text":"enter custom name here"}"]

|_ color: The Custom Color of Leather Armor.

|_ Lore: The description of an item. Separate lines of text with a comma after the bracket, prior to the last quotation mark

       |_ Lore: ["{"text":"a line of text"}"]

Potions

CustomPotionEffects: Custom effects that a potion will have.

|_ A potion effect.

       |_ Id: The ID of the effect.
       |_ Duration: The duration of the potion effect.
       |_ Amplifier: The potency (+1) of the effect. Kept at 0 to keep a level 1 effect.
       |_ Ambient: (0/1) 0 is false, 1 is true. True if the effect is provided
by a beacon and thus should be less intrusive on screen.

Written Book

author: The author of the book.

title: The title of the book.

pages: The pages in the book.

|_ A page. Separate pages with a comma.

Tools

Unbreakable: (0b/1b) 0b is false, 1b is true. If value is 1b, the tool will never lose durability.

CanDestroy: What blocks this tool can destroy when in adventure mode.

        |_ A block ID.

CanPlaceOn: What blocks can be placed on in adventure mode.

        |_ A block ID.

Title and Tellraw

/title: /title (PlayerName) [(sub)title] {text:»PutTextHere»,color:»PutColorHere»},(Optional){text:»MoreTextHere»,color»PutColorHere»} (Add [] to enclose if doing multiple text tags)

/tellraw: /tellraw (PlayerName) {text:»PutTextHere»,color:»PutColorHere»},(Optional){text:»PutTextHere»,color:»PutColorHere»} (Add [] to enclose if doing multiple text tags)

NBT tags are used to specify information for items and entities created with the «/give«, «/summon«, «/tellraw» (for the JSON message), «/fill«, «/blockdata{Until 1.13}«, «/setblock«, and «/clear» commands.

Each Tag has the format <tagname>:<value>. Tag names are case-sensitive. The payloads of List Tags are enclosed in square brackets [...], with each additional unnamed Tag separated by a comma. The payloads of Compound Tags are enclosed in braces {...}, with each additional Named Tag separated by a comma — Note that the entire entity data tag is itself an unnamed Compound Tag.

You can find a lot of tag names, especially in entities and block entities by using the «/data get entity" or /data get block command.

How To Get Them?

To get the NBT tag of a specific entity (for example, creeper), you use the command /data get entity @e[type=creeper,limit=1] to get the full data of the creeper itself. For more specific selectors, see Commands

Tag Basics

Structure of a Tag

First off, each tag has three parts:

tagType (byte, 0-12)
name (TAG_String)
[its payload]

When using commands, the tagType is figured out based on the given name, and the payload is what follows the colon — basically its value. The payload ought to fit the expected syntax. So a tag expecting an integer will not accept a string.

Number types can be denoted with a letter at the end of the value (such as 0b for a byte). Without a letter, the code assumes an integer, which works fine for most numbers but behaves differently. Using a literal integer like this to exceed a type’s expected range simply wraps the number back to 0 at the limit.

Tag Types

00 TAG_End
Unnamed, no payload, unusable in commands. Used in data storage to mark the end of TAG_Compound.
01 TAG_Byte
Payload: A single signed byte (8 bits)
Ranges from -128 to 127. Used for many booleans.
In Commands: ...b or ...B
02 TAG_Short
Payload: A single signed short integer (2 bytes, big endian)
Ranges from -215 to 215-1
In Commands: ...s or ...S
03 TAG_Int
Payload: A single signed integer (4 bytes, big endian)
Ranges from -231 to 231-1
In Commands: A literal number without a decimal
04 TAG_Long
Payload: A single signed long integer (8 bytes, big endian)
Ranges from -263 to 263-1
In Commands: ...l or ...L
05 TAG_Float
Payload: A floating-point number (4 bytes, big endian, IEEE 754-2008, single precision)
Maxes around 1038.23, or 1.698x1038
In Commands: ...f or ...F, decimal or no decimal
06 TAG_Double
Payload: A floating-point number (8 bytes, big endian, IEEE 754-2008, double precision)
Maxes around 10307.95, or 8.913x10307
In Commands: ...d, ...D, or a decimal number
07 TAG_Byte_Array
Payload: Unnamed TAG_Int (length), then an array of bytes of unspecified format. The length of this array is <length> bytes.
In Commands: [B; <byte>, <byte>, ... ]
(<length> is determined by the length of the given array)
08 TAG_String
Payload: Unnamed TAG_Short (length), then an array of bytes of length <length>. defining a string in UTF-8 format.
In Commands: "<text>"
(<length> is determined by the length of the given text)
Note that as is usual with most strings, if quotes are to be included within the string, escape codes (") must be used for the inner quotes in commands.
09 TAG_List
Payload: Unnamed TAG_Byte (tagId), unnamed TAG_Int (length), then a sequential list of unnamed Tags of type <tagId>. The length of this array is <length> Tags.
In Commands: [<value>, <value>, ...]
(<length> is determined by the length of the given list)
10 TAG_Compound
Payload: A sequential list of unique Named Tags. This array is terminated by a TAG_End.
Nested Compound Tags are terminated by their own internal End Tags.
In Commands: {<tag name>: <value>, <tag name>: <value>, ... }
(The terminating TAG_End is irrelevant to command usage)
11 TAG_Int_Array
Payload: Unnamed TAG_Int (size), then an array of unnamed TAG_Ints. The length of this array is <size> Tags.
An array of integers.
In Commands: [I; <integer>, <integer>, ... ]
(<size> is determined by the size of the given array)
12 TAG_Long_Array
Payload: Unnamed TAG_Int (size), then an array of unnamed TAG_Longs. The length of this array is <size> Tags.
In Commands: Used as [L; <long>, <long>, ... ]
(<size> is determined by the size of the given array)

Tag Payloads

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 tagId (1 byte), a name (Unnamed TAG_String), and a payload.

  • The first byte of data read is the tagId. Above is 10, 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 Structure of a Tag above.) The given length is 3. Those next 3 bytes read ham. 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 8, 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 short is 6, so the «pigName» has a value that’s 6 bytes long. Those bytes read Hampus. The completed first Tag is TAG_String("name"):6 Hampus
    • The next byte is 3, so next is a TAG_Int. It has the 5-byte name of «value». Its payload follows in the next 4 bytes: 120. The next completed Tag is TAG_Int("value"): 120
    • The next byte is 0, 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}}

List of Entity Data Tags

Minecraft code spawns entities with set Tags and values. Entities are themselves saved as tags within the world’s chunk data. Every detail about an entity is stored in its data tag. All tags are referenced by the game’s code to control entity behaviour.

The following tags are common to all entities.

id: <TAG_String>
Entity ID.
pos: <TAG_List>
[<TAG_Double>, <TAG_Double>, <TAG_Double>]
Three doubles describe current X, Y, Z position of entity
Motion: <TAG_List>
[<TAG_Double>, <TAG_Double>, <TAG_Double>]
Three doubles describe the current dX, dY, dZ velocities of entity (in metres per tick)
Rotation: <TAG_List>
[<TAG_Float>, <TAG_Float>]
Two floats describe entity’s rotation in degrees

  • First float is clockwise rotation around the Y axis, with 0° facing in the positive Z direction, or due south. Ranges from 0.0 to 360.0
  • Second float is declination from the horizon. Ranges from -90.0 (upwards) to +90.0 (downwards)
FallDistance: <TAG_Float>
Distance entity has fallen. Fall damage taken scales with this number. 0 for any entity at rest
Fire: <TAG_Short>
Ticks until a burning entity’s fire ends. Negative values are how many ticks an entity can stand in fire before burning. -20 for an entity not on fire
Air
Ticks until an entity runs out of air while underwater. While this value is 0 and the entity is underwater, it takes damage. Fills to 300 for any entity above water
OnGround: <TAG_Byte>
0 for false, 1 for true. True when the entity is touching the ground
NoGravity: <TAG_Byte>
0 for false, 1 for true. If true, entity is unaffected by gravity and stops changing Y position
Dimension: <TAG_Int>
0 for the Overworld, -1 for the Nether, and 1 for the End. Only known to be used for player data
Invulnerable: <TAG_Byte>
0 for false, 1 for true. When true, mobs don’t take damage from any source and cannot be moved by force. Objects like item frames cannot be destroyed unless a supporting block is removed
PortalCooldown: <TAG_Int>
Number of ticks until the entity may teleport through a nether portal. Starts at 300 ticks
UUIDMost: <TAG_Long>
The most significant 64 bits of this entity’s Universally Unique Identifier (UUID).
UUIDLeast: <TAG_Long>
The least significant 64 bits of this entity’s Universally Unique Identifier (UUID).
CustomName: <TAG_String>
The entity’s custom name string.
In Minecraft Java Edition 1.14, <TAG_String> must itself have quotes, as well as the standard quotes that go around strings. This means that escape codes are needed for the inner ones, so syntax looks like the following, (if one is to name an entity Gerald).
CustomName: ""Gerald""
Another way that this works is by setting it to an apparent compound tag specifying a block of text, done this way:
CustomName: "{"text":"Gerald"}"
CustomNameVisible: <TAG_Byte>
0 for false, 1 for true. If true, this entity’s custom name always appears above its head, whether or not the player is looking at it.
Silent: <TAG_Byte>
0 for false, 1 for true. If true, this entity is silent.
Passengers: <TAG_String>
Data for the entity riding this entity.
Glowing: <TAG_Byte>
-0 for false, 1 for true. When true, the entity has a cartoonish, glowing outline.
Tags: <TAG_String>
List of custom data.

Mobs

The following tags are common to all mobs

Health: <TAG_Float>
Amount of health an entity has.
AbsorptionAmount: <TAG_Float>
Amount of additional, temporary health added by the Absorption status effect.
HurtTime: <TAG_Short>
Set to 10 when a mob is struck, colouring it red. Decreases by 1 per tick until 0, when the mob turns normal colour again.
HurtByTimestamp: <TAG_Long>
Timestamp in the mob’s life when it was last damaged, measured in ticks since its creation.
DeathTime: <TAG_Short>
Number of ticks since the mob’s death. 0 for any living mob.
FallFlying: <TAG_Byte>
0 for false, 1 for true. When true and the mob is wearing the elytra, they’ll glide.
Attributes: <TAG_List>
[<TAG_Compound>, <TAG_Compound>, ... ]
List of Attributes for a mob.

Attribute Tags
Name: <TAG_String>
Given name for the Attribute. Might be generic.maxHealth or horse.jumpStrength.
Base: <TAG_Double>
Modifiers: <TAG_List>
List of modifiers acting on the Attribute.

Modifier Tags
Name: <TAG_String>
Amount: <TAG_Double>
Operation: <TAG_Int>
UUIDMost: <TAG_Long>
UUIDLeast: <TAG_Long>
ActiveEffects: <TAG_List>
[<TAG_Compound>, <TAG_Compound>, ... ]
List of potion effects.

Effect Tags
Id: <TAG_Byte>
Amplifier: <TAG_Byte>
Duration: <TAG_Int>
Ambient: <TAG_Byte>
ShowParticles: <TAG_Byte>
ShowIcon: <TAG_Byte>
HandItems: <TAG_List>
[<TAG_Compound>, <TAG_Compound>]
Describes items the entity is holding. These Compound Tags have Tags Common to All Items. Slot is discluded.
<TAG_Compound 0>: The item held in the mob’s main hand.
<TAG_Compound 1>: The item held in the mob’s off-hand.
ArmorItems: <TAG_List>
[<TAG_Compound>, <TAG_Compound>, ... ]
What the entity is wearing. These Compound Tags have Tags Common to All Items. Slot is discluded.
<TAG_Compound 0>: The item worn on the feet.
<TAG_Compound 1>: The item worn on the legs.
<TAG_Compound 2>: The item worn on the chest.
<TAG_Compound 3>: The item worn on the head.
HandDropChances: <TAG_List>
ArmorDropChances: <TAG_List>
DeathLootTable: <TAG_String>
DeathLootTableSeed: <TAG_Long>
CanPickUpLoot: <TAG_Byte>
NoAI: <TAG_Byte>
PersistenceRequired: <TAG_Byte>
LeftHanded: <TAG_Byte>
Team: <TAG_String>
Leashed: <TAG_Byte>
Leash: <TAG_Compound>

Mobs That Breed

Mobs that can breed include Cows, Chickens, Pigs, Sheep, Villagers, Cats, and Dogs.
InLove: <TAG_Int>
Counts down number of ticks until this mob stops searching for a mate. Default 0 for a mob not doing so.
Age: <TAG_Int>
Age of the mob in ticks. When less than 0 and counting up, represents a baby mob. Adult mobs use this value to count down how many ticks until it can breed again.
ForcedAge: <TAG_Int>
LoveCauseLeast: <TAG_Long>
Least significant bits of the UUID for the entity that caused this animal to breed
LoveCauseMost: <TAG_Long>
Most significant bits of the UUID for the entity that caused this animal to breed

Mobs That Raid

Coming Soon

Specific Mobs

The following lists are specific to each mob

bat
id: <TAG_String>
Entity ID.
pos: <TAG_List>
[<TAG_Double>, <TAG_Double>, <TAG_Double>]
Three doubles describe current X, Y, Z position of entity
Motion: <TAG_List>
[<TAG_Double>, <TAG_Double>, <TAG_Double>]
Three doubles describe the current dX, dY, dZ velocities of entity (in metres per tick)
Rotation: <TAG_List>
[<TAG_Float>, <TAG_Float>]
Two floats describe entity’s rotation in degrees

  • First float is clockwise rotation around the Y axis, with 0° facing in the positive Z direction, or due south. Ranges from 0.0 to 360.0
  • Second float is declination from the horizon. Ranges from -90.0 (upwards) to +90.0 (downwards)
FallDistance: <TAG_Float>
Distance entity has fallen. Fall damage taken scales with this number. 0 for any entity at rest
Fire: <TAG_Short>
Ticks until a burning entity’s fire ends. Negative values are how many ticks an entity can stand in fire before burning. -20 for an entity not on fire
Air
Ticks until an entity runs out of air while underwater. While this value is 0 and the entity is underwater, it takes damage. Fills to 300 for any entity above water
OnGround: <TAG_Byte>
0 for false, 1 for true. True when the entity is touching the ground
NoGravity: <TAG_Byte>
0 for false, 1 for true. If true, entity is unaffected by gravity and stops changing Y position
Dimension: <TAG_Int>
0 for the Overworld, -1 for the Nether, and 1 for the End. Only known to be used for player data
Invulnerable: <TAG_Byte>
0 for false, 1 for true. When true, mobs don’t take damage from any source and cannot be moved by force. Objects like item frames cannot be destroyed unless a supporting block is removed
PortalCooldown: <TAG_Int>
Number of ticks until the entity may teleport through a nether portal. Starts at 300 ticks
UUIDMost: <TAG_Long>
The most significant 64 bits of this entity’s Universally Unique Identifier (UUID).
UUIDLeast: <TAG_Long>
The least significant 64 bits of this entity’s Universally Unique Identifier (UUID).
CustomName: <TAG_String>
The entity’s custom name string.
In Minecraft Java Edition 1.14, <TAG_String> must itself have quotes, as well as the standard quotes that go around strings. This means that escape codes are needed for the inner ones, so syntax looks like the following, (if one is to name an entity Gerald).
CustomName: ""Gerald""
Another way that this works is by setting it to an apparent compound tag specifying a block of text, done this way:
CustomName: "{"text":"Gerald"}"
CustomNameVisible: <TAG_Byte>
0 for false, 1 for true. If true, this entity’s custom name always appears above its head, whether or not the player is looking at it.
Silent: <TAG_Byte>
0 for false, 1 for true. If true, this entity is silent.
Passengers: <TAG_String>
Data for the entity riding this entity.
Glowing: <TAG_Byte>
-0 for false, 1 for true. When true, the entity has a cartoonish, glowing outline.
Tags: <TAG_String>
List of custom data.
Health: <TAG_Float>
Amount of health an entity has.
AbsorptionAmount: <TAG_Float>
Amount of additional, temporary health added by the Absorption status effect.
HurtTime: <TAG_Short>
Set to 10 when a mob is struck, colouring it red. Decreases by 1 per tick until 0, when the mob turns normal colour again.
HurtByTimestamp: <TAG_Long>
Timestamp in the mob’s life when it was last damaged, measured in ticks since its creation.
DeathTime: <TAG_Short>
Number of ticks since the mob’s death. 0 for any living mob.
FallFlying: <TAG_Byte>
0 for false, 1 for true. When true and the mob is wearing the elytra, they’ll glide.
Attributes: <TAG_List>
[<TAG_Compound>, <TAG_Compound>, ... ]
List of Attributes for a mob.

Attribute Tags
Name: <TAG_String>
Given name for the Attribute. Might be generic.maxHealth or horse.jumpStrength.
Base: <TAG_Double>
Modifiers: <TAG_List>
List of modifiers acting on the Attribute.

Modifier Tags
Name: <TAG_String>
Amount: <TAG_Double>
Operation: <TAG_Int>
UUIDMost: <TAG_Long>
UUIDLeast: <TAG_Long>
ActiveEffects: <TAG_List>
[<TAG_Compound>, <TAG_Compound>, ... ]
List of potion effects.

Effect Tags
Id: <TAG_Byte>
Amplifier: <TAG_Byte>
Duration: <TAG_Int>
Ambient: <TAG_Byte>
ShowParticles: <TAG_Byte>
ShowIcon: <TAG_Byte>
HandItems: <TAG_List>
[<TAG_Compound>, <TAG_Compound>]
Describes items the entity is holding. These Compound Tags have Tags Common to All Items. Slot is discluded.
<TAG_Compound 0>: The item held in the mob’s main hand.
<TAG_Compound 1>: The item held in the mob’s off-hand.
ArmorItems: <TAG_List>
[<TAG_Compound>, <TAG_Compound>, ... ]
What the entity is wearing. These Compound Tags have Tags Common to All Items. Slot is discluded.
<TAG_Compound 0>: The item worn on the feet.
<TAG_Compound 1>: The item worn on the legs.
<TAG_Compound 2>: The item worn on the chest.
<TAG_Compound 3>: The item worn on the head.
HandDropChances: <TAG_List>
ArmorDropChances: <TAG_List>
DeathLootTable: <TAG_String>
DeathLootTableSeed: <TAG_Long>
CanPickUpLoot: <TAG_Byte>
NoAI: <TAG_Byte>
PersistenceRequired: <TAG_Byte>
LeftHanded: <TAG_Byte>
Team: <TAG_String>
Leashed: <TAG_Byte>
Leash: <TAG_Compound>
BatFlags: <TAG_Byte>
0 when flying, 1 for when resting upside-down.
blaze
Template:Data Tags/blaze
cat
Template:Data Tags/cat
cave_spider
Template:Data Tags/cave spider
chicken
Template:Data Tags/chicken
cow
Template:Data Tags/cow
creeper
id: <TAG_String>
Entity ID.
pos: <TAG_List>
[<TAG_Double>, <TAG_Double>, <TAG_Double>]
Three doubles describe current X, Y, Z position of entity
Motion: <TAG_List>
[<TAG_Double>, <TAG_Double>, <TAG_Double>]
Three doubles describe the current dX, dY, dZ velocities of entity (in metres per tick)
Rotation: <TAG_List>
[<TAG_Float>, <TAG_Float>]
Two floats describe entity’s rotation in degrees

  • First float is clockwise rotation around the Y axis, with 0° facing in the positive Z direction, or due south. Ranges from 0.0 to 360.0
  • Second float is declination from the horizon. Ranges from -90.0 (upwards) to +90.0 (downwards)
FallDistance: <TAG_Float>
Distance entity has fallen. Fall damage taken scales with this number. 0 for any entity at rest
Fire: <TAG_Short>
Ticks until a burning entity’s fire ends. Negative values are how many ticks an entity can stand in fire before burning. -20 for an entity not on fire
Air
Ticks until an entity runs out of air while underwater. While this value is 0 and the entity is underwater, it takes damage. Fills to 300 for any entity above water
OnGround: <TAG_Byte>
0 for false, 1 for true. True when the entity is touching the ground
NoGravity: <TAG_Byte>
0 for false, 1 for true. If true, entity is unaffected by gravity and stops changing Y position
Dimension: <TAG_Int>
0 for the Overworld, -1 for the Nether, and 1 for the End. Only known to be used for player data
Invulnerable: <TAG_Byte>
0 for false, 1 for true. When true, mobs don’t take damage from any source and cannot be moved by force. Objects like item frames cannot be destroyed unless a supporting block is removed
PortalCooldown: <TAG_Int>
Number of ticks until the entity may teleport through a nether portal. Starts at 300 ticks
UUIDMost: <TAG_Long>
The most significant 64 bits of this entity’s Universally Unique Identifier (UUID).
UUIDLeast: <TAG_Long>
The least significant 64 bits of this entity’s Universally Unique Identifier (UUID).
CustomName: <TAG_String>
The entity’s custom name string.
In Minecraft Java Edition 1.14, <TAG_String> must itself have quotes, as well as the standard quotes that go around strings. This means that escape codes are needed for the inner ones, so syntax looks like the following, (if one is to name an entity Gerald).
CustomName: ""Gerald""
Another way that this works is by setting it to an apparent compound tag specifying a block of text, done this way:
CustomName: "{"text":"Gerald"}"
CustomNameVisible: <TAG_Byte>
0 for false, 1 for true. If true, this entity’s custom name always appears above its head, whether or not the player is looking at it.
Silent: <TAG_Byte>
0 for false, 1 for true. If true, this entity is silent.
Passengers: <TAG_String>
Data for the entity riding this entity.
Glowing: <TAG_Byte>
-0 for false, 1 for true. When true, the entity has a cartoonish, glowing outline.
Tags: <TAG_String>
List of custom data.
Health: <TAG_Float>
Amount of health an entity has.
AbsorptionAmount: <TAG_Float>
Amount of additional, temporary health added by the Absorption status effect.
HurtTime: <TAG_Short>
Set to 10 when a mob is struck, colouring it red. Decreases by 1 per tick until 0, when the mob turns normal colour again.
HurtByTimestamp: <TAG_Long>
Timestamp in the mob’s life when it was last damaged, measured in ticks since its creation.
DeathTime: <TAG_Short>
Number of ticks since the mob’s death. 0 for any living mob.
FallFlying: <TAG_Byte>
0 for false, 1 for true. When true and the mob is wearing the elytra, they’ll glide.
Attributes: <TAG_List>
[<TAG_Compound>, <TAG_Compound>, ... ]
List of Attributes for a mob.

Attribute Tags
Name: <TAG_String>
Given name for the Attribute. Might be generic.maxHealth or horse.jumpStrength.
Base: <TAG_Double>
Modifiers: <TAG_List>
List of modifiers acting on the Attribute.

Modifier Tags
Name: <TAG_String>
Amount: <TAG_Double>
Operation: <TAG_Int>
UUIDMost: <TAG_Long>
UUIDLeast: <TAG_Long>
ActiveEffects: <TAG_List>
[<TAG_Compound>, <TAG_Compound>, ... ]
List of potion effects.

Effect Tags
Id: <TAG_Byte>
Amplifier: <TAG_Byte>
Duration: <TAG_Int>
Ambient: <TAG_Byte>
ShowParticles: <TAG_Byte>
ShowIcon: <TAG_Byte>
HandItems: <TAG_List>
[<TAG_Compound>, <TAG_Compound>]
Describes items the entity is holding. These Compound Tags have Tags Common to All Items. Slot is discluded.
<TAG_Compound 0>: The item held in the mob’s main hand.
<TAG_Compound 1>: The item held in the mob’s off-hand.
ArmorItems: <TAG_List>
[<TAG_Compound>, <TAG_Compound>, ... ]
What the entity is wearing. These Compound Tags have Tags Common to All Items. Slot is discluded.
<TAG_Compound 0>: The item worn on the feet.
<TAG_Compound 1>: The item worn on the legs.
<TAG_Compound 2>: The item worn on the chest.
<TAG_Compound 3>: The item worn on the head.
HandDropChances: <TAG_List>
ArmorDropChances: <TAG_List>
DeathLootTable: <TAG_String>
DeathLootTableSeed: <TAG_Long>
CanPickUpLoot: <TAG_Byte>
NoAI: <TAG_Byte>
PersistenceRequired: <TAG_Byte>
LeftHanded: <TAG_Byte>
Team: <TAG_String>
Leashed: <TAG_Byte>
Leash: <TAG_Compound>
powered: <TAG_Byte>
0 is false, 1 is true. If set to true, this creeper is lightning-charged
ignited: <TAG_Byte>
0 is false, 1 is true. If true, this creeper has been ignited by Flint and Steel
ExplosionRadius: <TAG_Byte>
Determines the explosive radius if the creeper explodes. Default is 3
fuse: <TAG_Short>
Determines the time in ticks the creeper will hiss before exploding. Default is 30
dolphin
Template:Data Tags/dolphin
donkey
Template:Data Tags/donkey
drowned
Template:Data Tags/drowned
elder_guardian
Template:Data Tags/elder guardian
enderman
Template:Data Tags/enderman
endermite
Template:Data Tags/endermite
evoker
Template:Data Tags/evoker
ghast
Template:Data Tags/ghast
giant
Template:Data Tags/giant
guardian
Template:Data Tags/guardian
horse
Template:Data Tags/horse
husk
Template:Data Tags/husk
illager_beast
Template:Data Tags/illager beast
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
ocelot
Template:Data Tags/ocelot
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
stray
Template:Data Tags/stray
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
Template:Data Tags/
wolf
Template:Data Tags/wolf
zombie
IsBaby: <TAG_Byte>
0 is false, 1 is true. If value is 1, this zombie is a baby.
IsVillager: <TAG_Byte>
0 is false, 1 is true. If value is true, this zombie is an undead villager.
CanBreakDoors: <TAG_Byte>
0 is false, 1 is true. If value is true, this zombie can break wooden doors.
DrownedConversionTime: <TAG_Long>
Counts down the number of ticks until this zombie converts into the drowned. Default -1 for a zombie above water.
InWaterTime: <TAG_Long>
Number of ticks this zombie has been under water. Default -1 for a zombie above water.
Template:Data Tags/
Template:Data Tags/
zombie_villager
Template:Data Tags/zombie villager

Other

Tags Common to All Items
Template:Common Tags/Items
Tags Common to All Block Entities
Template:Common Tags/Block Entities
Tags Common to All Minecart Types
Template:Common Tags/Minecart Types
Tags Common to All Projectiles
Template:Common Tags/Projectiles

To Be Removed

The rest of this page is likely to be removed.

Blocks («/setblock» or «/fill«)

Containers

Items: []The ID and other info of an item.

|_ id: {}The ID of the item.

|_ Slot: {}The slot number. Note that this starts at 0, not 1.

|_ tag: {}Other info of the item.

Items (/give)

All Items

Enchantments: Enchantments on the item.

|_ An enchantement. (List)

       |_ id: The name of the enchantment. Cannot be a number.
       |_ lvl: The level of the enchant. Range is -32768 to 32767.

display: Display properties.

|_ Name: The Custom Name of the item. Range of characters that can be used seems to be infinite.

       |_ Name: ["{"text":"enter custom name here"}"]

|_ color: The Custom Color of Leather Armor.

|_ Lore: The description of an item. Separate lines of text with a comma after the bracket, prior to the last quotation mark

       |_ Lore: ["{"text":"a line of text"}"]

Potions

CustomPotionEffects: Custom effects that a potion will have.

|_ A potion effect.

       |_ Id: The ID of the effect.
       |_ Duration: The duration of the potion effect.
       |_ Amplifier: The potency (+1) of the effect. Kept at 0 to keep a level 1 effect.
       |_ Ambient: (0/1) 0 is false, 1 is true. True if the effect is provided
by a beacon and thus should be less intrusive on screen.

Written Book

author: The author of the book.

title: The title of the book.

pages: The pages in the book.

|_ A page. Separate pages with a comma.

Tools

Unbreakable: (0b/1b) 0b is false, 1b is true. If value is 1b, the tool will never lose durability.

CanDestroy: What blocks this tool can destroy when in adventure mode.

        |_ A block ID.

CanPlaceOn: What blocks can be placed on in adventure mode.

        |_ A block ID.

Title and Tellraw

/title: /title (PlayerName) [(sub)title] {text:»PutTextHere»,color:»PutColorHere»},(Optional){text:»MoreTextHere»,color»PutColorHere»} (Add [] to enclose if doing multiple text tags)

/tellraw: /tellraw (PlayerName) {text:»PutTextHere»,color:»PutColorHere»},(Optional){text:»PutTextHere»,color:»PutColorHere»} (Add [] to enclose if doing multiple text tags)

This Minecraft tutorial explains the NBT tags (formerly called data tags) that you can use for a player in Minecraft Java Edition (PC/Mac) 1.16, 1.17, 1.18 and 1.19.

Background

Players have a unique set of NBT tags that can be used in Minecraft commands such as: /data and /scoreboard.

player

What are NBT tags (formerly called Data Tags)?

NBT tags allow you to set certain properties of a player. The NBT tag is always surrounded in {} such as {Dimension:»minecraft:the_nether»}. If there is more than one NBT tag used in a game command, the NBT tags are separated by a comma such as {Dimension:»minecraft:the_nether», foodLevel:20}.

List of NBT Tags

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

NBT Tag Value (Description)
abilities

data (The abilities that the the player has.)

  • invulnerable — determines whether the player take damage like normal (0 or 1)
  • mayfly — determines whether the player can fly (0 or 1)
  • instabuild — demeterines whether the player can instantly place or destroy blocks (0 or 1)
  • walkSpeed — the speed that the player can walk (default is 0.1f)
  • mayBuild — determines whether the player is allowed to build by placing or destroying block (0 or 1)
  • flying — the player is currently flying (0 or 1)
  • flySpeed — the speed that the player can fly (default is 0.05f)

Example
{abilities:{invulnerable:1,mayfly:1,instabuild:1,walkSpeed:0.1f,mayBuild:1,flying:0,flySpeed:0.05f}}

AbsorptionAmount

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

Example
{AbsorptionAmount:2.0f}

Air

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

Example
{Air:300s}

DataVersion

version (The version of the player’s NBT structure. Each version/snapshot of Minecraft has its own unique version number. Minecraft 1.16 rc-1 has a DataVersion value of 2565)

Example
{DataVersion:2565}

DeathTime

number (The number of game ticks that the player has been dead. When alive, DeathTime has a value of 0)

Example
{DeathTime:0}

Dimension

minecraft:the_nether (The player is the Nether)
minecraft:overworld (The player is in the Overworld)
minecraft:the_end (The player is in the End)

Example
{Dimension:»minecraft:the_nether»}

EnderItems

data (An item in the player’s ender chest)

Example
{EnderItems:[{id:»minecraft:diamond_sword»}]}

enteredNetherPosition

coordinate (The xyz coordinate value where the player entered the Nether dimension)

Example
{enteredNetherPosition:{x:-259.888617739718d,y:65.16610926093821d,z:185.8149890186918d}}

FallDistance

number (The distance that the player has fallen)

Example
{FallDistance:0.0f}

FallFlying

0 (The player is not allowed to use elytra when falling)
1 (The player is allowed to use elytra when falling)

Example
{FallFlying:1}

Fire

ticks (The number of game ticks until the player is no longer on fire — there are 20 ticks in a second. When the player is not on fire, the default is -20)

Example
{Fire:-20s}

foodLevel

number (The level in the Hunger bar. A full Hunger bar has a value of 20)

Example
{foodLevel:20}

foodExhaustionLevel

number (The level of exhaustion)

Example
{foodExhaustionLevel:0}

foodSaturationLevel

number (The current level of saturation)

Example
{foodSaturationLevel:5}

foodTickTimer

ticks (The value of the Food timer in game ticks)

Example
{foodTickTimer:0}

Health

number (The number of health points the player has)

Example
{Health:20.0f}

HurtTime

ticks (The number of game ticks that the player turns red after being hurt)

Example
{HurtTime:0}

Inventory

data (An item in the player’s inventory)

Example
{Inventory:[{id:»minecraft:diamond_sword»}]}

Invulnerable

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

Example
{Invulnerable:0}

OnGround

0 (The player is not on the ground)
1 (The player is on the ground)

Example
{OnGround:1}

playerGameType

0 (The player is in Survival mode)
1 (The player is in Creative mode)
2 (The player is in Adventure mode)
3 (The player is in Spectator mode)

Example
{playerGameType:1}

PortalCooldown

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

Example
{PortalCooldown:120}

Pos

coordinate (The xyz coordinate value where the player is currently positioned)

Example
{Pos:{x:-255.888617739718d,y:66.16610926093821d,z:186.8149890186918d}}

previousPlayerGameType

0 (The player was previously in Survival mode)
1 (The player was previously in Creative mode)
2 (The player was previously in Adventure mode)
3 (The player was previously in Spectator mode)

Example
{previousPlayerGameType:3}

recipeBook

data (A list of the recipes the player knows how to craft)

Example
{recipeBook: {recipes:[«minecraft:diamond_sword»]}}

SelectedItem

data (The item that is currently selected in the hotbar)

Example
{SelectedItem:{id:»minecraft:diamond_sword»,Count:1b}}

Score

number (The value that will be displayed as the Score when the player dies)

Example
{Score:126}

seenCredits

0 (The player has not yet gone into the final portal that ends the game and seen the credits)
1 (The player has gone into the final portal that ends the game and has seen the credits)

Example
{seenCredits:0}

selectedItemSlot

0 (The player has the slot #1 selected in the hot bar)
1 (The player has the slot #2 selected in the hot bar)
2 (The player has the slot #3 selected in the hot bar)
3 (The player has the slot #4 selected in the hot bar)
4 (The player has the slot #5 selected in the hot bar)
5 (The player has the slot #6 selected in the hot bar)
6 (The player has the slot #7 selected in the hot bar)
7 (The player has the slot #8 selected in the hot bar)
8 (The player has the slot #9 selected in the hot bar)

Example
{selectedItemSlot:0}

ShoulderEntityLeft

data (The entity sitting on the player’s left shoulder. Currently, this can only be a parrot)

Example
{ShoulderEntityLeft:{id:»minecraft:parrot»}}

ShoulderEntityRight

data (The entity sitting on the player’s right shoulder. Currently, this can only be a parrot)

Example
{ShoulderEntityRight:{id:»minecraft:parrot»}}

SleepingX

number (The X coordinate of where the player is sleeping)

Example
{SleepingX:-851}

SleepingY

number (The Y coordinate of where the player is sleeping)

Example
{SleepingY:66}

SleepingZ

number (The Z coordinate of where the player is sleeping)

Example
{SleepingZ:193}

SleepTimer

ticks (The number of game ticks that the player has been sleeping in a bed)

Example
{SleepTimer:2400}

SpawnDimension

minecraft:the_nether (The player will spawn in the Nether)
minecraft:overworld (The player will spawn in the Overworld)
minecraft:the_end (The player will spawn in the End)

Example
{SpawnDimension:»minecraft:overworld»}

SpawnForced

0 (The player will not spawn if no bed is found)
1 (The player will spawn if no bed is found)

Example
{SpawnForced:0}

SpawnX

number (The X coordinate of the player’s bed or spawn point)

Example
{SpawnX:520}

SpawnY

number (The Y coordinate of the player’s bed or spawn point)

Example
{SpawnY:97}

SpawnZ

number (The Z coordinate of the player’s bed or spawn point)

Example
{SpawnZ:101}

XpLevel

number (The level on the experience bar)

Example
{XpLevel:20}

XpP

number (The percentage on the experience bar until the next level)

Example
{XpP:50}

XpSeed

number (The seed that will be used for the next enchantment when using an enchanting table)

Example
{XpSeed:238209655}

XpTotal

number (The total XP earned during the current life. This value is displayed as the Score when player dies)

Example
{XpTotal:126}

NBT Tag Examples

To get the NBT tags (or data tags) for the nearest player:

/data get entity @p

Next, learn how to use the game commands in Minecraft.

Other NBT Tags

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

Рекомендуемые сообщения

В теме 10 сообщений

WorderToz

Обозреватель

    • Поделиться

Вобщем есть книга, на ней CustomModelData:1 надо что бы этот тег изменился на CustomModelData:2 не изменяя других тегов, в инвентаре игрока, не ставля по 200 командных блоков на 1 ячейку игрока._. Заранее спасибо

Ссылка на комментарий
Поделиться на другие сайты

Shomen

Великий магистр

    • Поделиться

2 часа назад, WorderToz сказал:

Вобщем есть книга, на ней CustomModelData:1 надо что бы этот тег изменился на CustomModelData:2 не изменяя других тегов, в инвентаре игрока, не ставля по 200 командных блоков на 1 ячейку игрока._. Заранее спасибо

/item

Ссылка на комментарий
Поделиться на другие сайты

WorderToz

Обозреватель

  • Автор
    • Поделиться

3 часа назад, IlyaDyachkov сказал:

/item

А как именно?

Ссылка на комментарий
Поделиться на другие сайты

Ilysha

Опытный

    • Поделиться

если нету /item то нужно /replaceitem

item modify *блок / энтити* *цель* *ячейка* {CustomModelData:2}

5 минут назад, Ilysha сказал:

если нету /item то нужно /replaceitem

item modify *блок / энтити* *цель* *ячейка* {CustomModelData:2}

это если ты на 1.17

до 1.17 вроде так же, просто нужно не /item, а replaceitem

Ссылка на комментарий
Поделиться на другие сайты

WorderToz

Обозреватель

  • Автор
    • Поделиться

18 минут назад, Ilysha сказал:

если нету /item то нужно /replaceitem

item modify *блок / энтити* *цель* *ячейка* {CustomModelData:2}

это если ты на 1.17

до 1.17 вроде так же, просто нужно не /item, а replaceitem

Даа, я в курсе, но проблема в том что это будет работать только если предмет именно в каком то слоте… А это не очень удобно так сказать…

Ссылка на комментарий
Поделиться на другие сайты

WorderToz

Обозреватель

  • Автор
    • Поделиться

26 минут назад, Ilysha сказал:

если нету /item то нужно /replaceitem

item modify *блок / энтити* *цель* *ячейка* {CustomModelData:2}

это если ты на 1.17

до 1.17 вроде так же, просто нужно не /item, а replaceitem

И разве modify не работает на датапаках?

Ссылка на комментарий
Поделиться на другие сайты

Shomen

Великий магистр

    • Поделиться

1 минуту назад, WorderToz сказал:

И разве modify не работает на датапаках?

/data не изменяет данные игрока

Ссылка на комментарий
Поделиться на другие сайты

WorderToz

Обозреватель

  • Автор
    • Поделиться

3 минуты назад, IlyaDyachkov сказал:

/data не изменяет данные игрока

На датапаках а не на дате

Ссылка на комментарий
Поделиться на другие сайты

Shomen

Великий магистр

    • Поделиться

1 минуту назад, WorderToz сказал:

На датапаках а не на дате

а как?

Ссылка на комментарий
Поделиться на другие сайты

WorderToz

Обозреватель

  • Автор
    • Поделиться

2 минуты назад, IlyaDyachkov сказал:

а как?

?..

Ссылка на комментарий
Поделиться на другие сайты

Для публикации сообщений создайте учётную запись или авторизуйтесь

Вы должны быть пользователем, чтобы оставить комментарий

Войти

Уже есть аккаунт? Войти в систему.

Войти

Named Binary Tag : Создание собственных переменных

В этом гайде речь пойдет о NBT — формате хранения данных Minecraft. Подробное описание можно найти в Minecraft-Wiki, нас же в основном интересует как эту вещь использовать для написания модов. NBT есть в вещах, блоках, мобах, самом игроке и мире, в котором он находится. Можно сказать, практически везде.

Предположим, нам необходим предмет, который должен хранить в себе полезную информацию, чтобы эта информация могла меняться и не терялась при перезапуске сервера. Например, мне необходим меч, который «хранит души убитых им существ«. Причем эти души не просто хранятся, а могут использоваться для «алхимического преобразования блока свинца в золото«. Звучит немного странно, но приступим…

Для начала — основной класс NBTTutorialMod:

@Mod(modid = NBTTutorialMod.MODID, name = NBTTutorialMod.NAME, version = NBTTutorialMod.VERSION)
public class NBTTutorialMod
{
    public static final String MODID = "nbttutorial";
    public static final String NAME = "NBT Tutorial Mod";
    public static final String VERSION = "1.0";
    
    @Instance(MODID)
    public static NBTTutorialMod instance;
    
    @SidedProxy(clientSide="ru.mcmodding.nbttutorial.client.ClientProxy", serverSide="ru.fallout.nbttutorial.common.CommonProxy")
    public static CommonProxy proxy;

    @EventHandler
    public void init(FMLInitializationEvent event)
    {
        // Здесь мы лишь вызываем CommonProxy и ClientProxy
        proxy.init();
    }
    
    public static void info(String format, Object... data)
    {
        FMLLog.log(NBTTutorialMod.NAME, Level.INFO, format, data);
    }
}

Теперь создадим CommonProxy и ClientProxy, в которых зарегистрируем 1 блок (свинец), 1 предмет (алхимический меч), 1 тайл (для блока свинца) и 2 вкладки для креатива. Тайл — это некий хранитель данных, он будет привязан к блоку и будет хранить то количество «энергии душ«, которую мы передали блоку через наш алхимический меч:

CommonProxy:

public class CommonProxy
{
    // Вкладка для предметов. В нашем случае - для алхимического меча
    public static final CreativeTabs tabNBTItem = new CreativeTabs("nbtItems")
    {
        @Override
        @SideOnly(Side.CLIENT)
        public Item getTabIconItem() { return Items.iron_sword; }
    };
    
    // Вкладка для блоков. В нашем случае - для блока свинца
    public static final CreativeTabs tabNBTBlock = new CreativeTabs("nbtBlocks")
    {
        @Override
        @SideOnly(Side.CLIENT)
        public Item getTabIconItem() { return Item.getItemFromBlock(Blocks.gold_block); }
    };

    public static Item item_magic_sword = new ItemMagicSword("magic_sword", tabNBTItem);
    public static Block block_plumbum = new BlockPlumbum("plumbum", tabNBTBlock);
    
    /**
     * Конструктор CommonProxy. В нем мы регистрируем класс,
     * который будет обрабатывать наши будущие события (Event'ы)
     */
    public CommonProxy()
    {
        MinecraftForge.EVENT_BUS.register(new CommonEventHandler());
    }

    public void init()
    {
        this.registerItems();
        this.registerBlocks();
        this.registerTiles();
        this.registerEntities();
    }

    public void registerItems()
    {
        GameRegistry.registerItem(item_magic_sword, "magic_sword");
    }
    
    public void registerBlocks()
    {
        GameRegistry.registerBlock(block_plumbum, "plumbum");
    }
    
    public void registerEntities() {}
    
    public void registerTiles()
    {
        GameRegistry.registerTileEntity(TileEntityAlchemyCube.class, "alchemycube");
    }
}

ClientProxy:

public class ClientProxy extends CommonProxy
{
    @Override
    public void init()
    {
        super.init();
        this.registerItemModel();
    }

    public void registerItemModel()
    {
        Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item_magic_sword, 0, new ModelResourceLocation(NBTTutorialMod.MODID + ":" + "magic_sword", "inventory"));
        Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block_plumbum), 0, new ModelResourceLocation(NBTTutorialMod.MODID + ":" + "plumbum", "inventory"));
    }
}

Теперь нам необходимо Создать классы меча и блока. Но для начала отвлечемся на теорию, а именно определимся с форматом хранения данных в NBT.

Меч (предмет) изначально не имеет NBT совсем. Поэтому мы создадим пустой NBT, а затем добавим в него свою собственную ветвь, имя которой дадим согласно MODID . Выглядеть это будет вот так:

Для предмета :

image.png

Для тайла :

image.png

Теперь напишем класс нашего алхимического меча. В классе мы определим, что при нажатии ЛКМ на блоке свинца происходит передача всей накопленной энергии из NBT меча в NBT тайла, привязанного в блоку.

ItemMagicSword:

public class ItemMagicSword extends Item
{
    /**
     * Конструктор класса. Тут стоит обратить особое внимание
     * на размер стака (он равен 1). Это необходимо, чтобы NBT
     * корректно работал.
     */
    public ItemMagicSword(String par1ItemName, CreativeTabs par2CreativeTab)
    {
        super();
        this.setUnlocalizedName(NBTTutorialMod.MODID + "." + par1ItemName);
        this.setCreativeTab(par2CreativeTab);
        this.setMaxStackSize(1);
    }
    
    @Override
    public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
    {
        if (!worldIn.isRemote && worldIn.getBlockState(pos).getBlock() instanceof BlockPlumbum)
        {
            TileEntityAlchemyCube tile = (TileEntityAlchemyCube) worldIn.getTileEntity(pos);
            if (getGold(stack) > 0)
            {
                tile.gold += getGold(stack);
                playerIn.addChatMessage(new ChatComponentText("Блоку передано " + this.getGold(stack) + " очков алхимической энергии"));
                resetGold(stack);
            }
            if (tile.gold >= 100)
            {
                worldIn.destroyBlock(pos, false);
                worldIn.setBlockState(pos, Blocks.gold_block.getDefaultState());
                playerIn.addChatMessage(new ChatComponentText("Блок накопил достаточно энергии и превратился в золото"));
            }
            else
            {
                playerIn.addChatMessage(new ChatComponentText("Этот блок накопил " + tile.gold + " очков алхимической энергии"));
                ((BlockPlumbum) worldIn.getBlockState(pos).getBlock()).updateAlchemyLevel(worldIn, pos, playerIn);
            }
        }
        return false;
    }
    
    /**
     * Вот здесь как раз и происходит все волшебство создания NBT
     */
    @Override
    public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected)
    {
        /*
         * Проверяем, есть ли у предмета NBT. Если нет - то создаем его,
         * а в нем создаем тег nbttutorial, в котором хранятся 2 параметра:
         * owner - тот, кто владел этим мечом
         * gold - количество энергии для преобразования свинца в золото
         */
        if (!stack.hasTagCompound())
        {
            stack.setTagCompound(stack.getSubCompound("tag", true));
            NBTTagCompound itemCompound = new NBTTagCompound();
            itemCompound.setString("owner", ((EntityPlayer)entityIn).getDisplayNameString());
            itemCompound.setInteger("gold", 0);
            stack.getTagCompound().setTag(NBTTutorialMod.MODID, itemCompound);
        }
        else
        {
            /*
             * Если меч подобрал кто-то другой, то он получает нового хозяина,
             * а счетчик энергии сбросится на ноль.
             */
            String nameOwner = stack.getTagCompound().getCompoundTag(NBTTutorialMod.MODID).getString("owner");
            String namePlayer = ((EntityPlayer)entityIn).getDisplayNameString();
            if (!nameOwner.equals(namePlayer))
            {
                stack.getTagCompound().getCompoundTag(NBTTutorialMod.MODID).setString("owner", namePlayer);
                this.resetGold(stack);
            }
        }
    }
    
    @SideOnly(Side.CLIENT)
    public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced)
    {
        if (stack.getSubCompound(NBTTutorialMod.MODID, false) != null)
        {
            tooltip.add("Золота накоплено : " + stack.getTagCompound().getCompoundTag(NBTTutorialMod.MODID).getInteger("gold"));
        }
    }
    
    // Метод, вынимающий их NBT значение золота
    public int getGold(ItemStack stack)
    {
        return stack.getTagCompound().getCompoundTag(NBTTutorialMod.MODID).getInteger("gold");
    }
    
    // Метод, добавляющий в NBT определенное количество золота
    public void addGold(EntityPlayer playerIn, ItemStack stack, int count)
    {
        int gold = stack.getTagCompound().getCompoundTag(NBTTutorialMod.MODID).getInteger("gold");
        stack.getTagCompound().getCompoundTag(NBTTutorialMod.MODID).setInteger("gold", gold + count);
        playerIn.addChatMessage(new ChatComponentText("Получено " + count + " очков алхимической энергии"));
    }
    
    // Метод, сбрасывающий счетчик золота
    public void resetGold(ItemStack stack)
    {
        stack.getTagCompound().getCompoundTag(NBTTutorialMod.MODID).setInteger("gold", 0);
    }
}

Теперь код блока BlockPlumbum. Следует заметить, что он расширяет не класс Block, а класс BlockContainer, который умеет создавать тайл.

public class BlockPlumbum extends BlockContainer
{
    public static final PropertyInteger MAGIC = PropertyInteger.create("magic", 0, 4);
    
    public BlockPlumbum(String par1BlockName, CreativeTabs par2CreativeTab)
    {
        super(Material.iron);
        this.setUnlocalizedName(NBTTutorialMod.MODID + "." + par1BlockName);
        this.setCreativeTab(par2CreativeTab);
        this.setDefaultState(this.blockState.getBaseState().withProperty(MAGIC, Integer.valueOf(0)));
    }
    
    /*
     * Проверяем уровень накопленной алхимической энергии
     * и меняем состояние блока в зависимости от того,
     * сколько энергии хранит тайл.
     */
    public void updateAlchemyLevel(World worldIn, BlockPos pos, EntityPlayer player)
    {
        TileEntityAlchemyCube tile = (TileEntityAlchemyCube) worldIn.getTileEntity(pos);
        worldIn.setBlockState(pos, this.getBlockState().getBaseState().withProperty(MAGIC, Integer.valueOf(tile.gold / 20)));
    }
    
    /*
     * Указываем какой тайл создавать при установке блока
     */
    @Override
    public TileEntity createNewTileEntity(World worldIn, int meta)
    {
        return new TileEntityAlchemyCube();
    }
    
    @Override
    protected BlockState createBlockState()
    {
        return new BlockState(this, new IProperty[] {MAGIC});
    }
    
    @Override
    public IBlockState getStateFromMeta(int meta)
    {
        return this.getDefaultState().withProperty(MAGIC, Integer.valueOf(meta));
    }
    
    @Override
    public int getMetaFromState(IBlockState state)
    {
        return (int) state.getValue(MAGIC);
    }
    
    /*
     * Этот метод необходим потому, что BlockContainer по умолчанию
     * возвращает -1 , а нам нужна 3.
     */
    @Override
    public int getRenderType()
    {
        return 3;
    }
}

И, наконец, код тайла (TileEntityAlchemyCube) для блока свинца. Он будет содержать NBT и хранить в нем накопленную алхимическую энергию.

public class TileEntityAlchemyCube extends TileEntity
{
    public int gold;
    
    public TileEntityAlchemyCube()
    {
        this.gold = 0;
    }
    
    @Override
    public void readFromNBT(NBTTagCompound compound)
    {
        super.readFromNBT(compound);
        NBTTagCompound tagCompound = (NBTTagCompound) compound.getTag(NBTTutorialMod.MODID);
        gold = tagCompound.getInteger("gold");
    }
    
    @Override
    public void writeToNBT(NBTTagCompound compound)
    {
        super.writeToNBT(compound);
        NBTTagCompound tagCompound = new NBTTagCompound();
        tagCompound.setInteger("gold", gold);
        compound.setTag(NBTTutorialMod.MODID, tagCompound);
    }
    
    @Override
    public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate)
    {
        return false;
    }
}

Осталось определиться с кодом, который будет заряжать наш алхимический меч. Умирая от меча, мобы должны передавать мечу игрока некоторое количество энергии. В Forge есть замечательный Event — LivingDeathEvent, который мы используем в нашел классе-обработчике событий CommonEventHandler:

public class CommonEventHandler
{
    @SubscribeEvent
    public void onLivingDeathEvent(LivingDeathEvent event)
    {
        // Если кто-то умер от руки (меча) игрока
        if (!event.entity.worldObj.isRemote && event.source.getSourceOfDamage() instanceof EntityPlayerMP)
        {
            // И этот игрок был вооружен мечом ItemMagicSword
            EntityPlayerMP player = (EntityPlayerMP) event.source.getSourceOfDamage();
            if (player.getCurrentEquippedItem().getItem() instanceof ItemMagicSword)
            {
                // То добавим этому мечу 5 единиц энергии
                ((ItemMagicSword) player.getCurrentEquippedItem().getItem()).addGold(player, player.getCurrentEquippedItem(), 5);
            }
        }
    }
}

Что в итоге?

owgYQKV.png


DM6DKH3.png

В итоге у нас есть меч, убивая которым мы получаем очки энергии. Нажимая ЛКМ на блок свинца мы потихоньку увеличиваем содержание золота в нем. Когда энергия блока достигает 100 — он превращается в полноценный блок золота.

Понравилась статья? Поделить с друзьями:
  • Как изменить nat type
  • Как изменить nat gta 5
  • Как изменить my ini mysql
  • Как изменить mui windows 7
  • Как изменить mtu через командную строку