- May 11, 2021 NBTExplorer is a low-level graphical NBT (Named Binary Tag) data editor for Minecraft. With a directory-tree interface for easily exploring multiple worlds, and support for the latest NBT standard, NBTExplorer is built on top of Substrate.
- The Named Binary Tag (NBT) file format is an extremely simple, albeit annoying (did we really need yet another format?) See Discussion structured binary format used by the Minecraft game for a variety of things.
- Feb 27, 2021 NBTEdit is a plugin which allows the ability to view and modify Item NBT tags in a live-environment with a single easy-to-use command.
- Nbt Editor Minecraft Windows 10
- (Help) Minecraft Detect Item Anywhere In Inventory With NBT
- Nbt Editor Online
- More Videos For Nbtedit »
The Named Binary Tag (NBT) file format is an extremely simple, albeit annoying (did we really need yet another format?)[See Discussion] structured binary format used by the Minecraft game for a variety of things. Due to this, several third-party utilities now also utilize the format. You may find example files at the bottom of this article.
Mojang has also released a reference implementation along with their Anvil conversion tool, available from https://web.archive.org/web/20190710093131/https://mojang.com/2012/02/new-minecraft-map-format-anvil/
A mod that allows you to modify the NBT-data of entities and TileEntities while you are playing. Type '/nbtedit' to edit the NBT-data of the object you are looking at or '/nbtedit d' to edit the NBT-data of the TileEntity at the position x,y,z in dimension d or your current dimension.
- 1Current Uses
- 2Specification
- 2.1Bedrock edition
- 2.2Examples
Current Uses
Nbt Editor Minecraft Windows 10
The NBT format is currently used in several places, chiefly:
- In the Protocol as part of Slot Data
- Multiplayer saved server list (
servers.dat
). - Player data (both single player and multiplayer, one file per player). This includes such things as inventory and location.
- Saved worlds (both single player and multiplayer).
- World index file (
level.dat
) that contains general information (spawn point, time of day, etc...) - Chunk data (see Region Files)
- World index file (
Unfortunately, the NBT files you can encounter as a developer will be stored in three different ways, just to make things interesting.
- Uncompressed,
- gzip'd,
- zlib'd (aka DEFLATE with a few bytes extra)
Libraries
There are many, many libraries for manipulating NBT, written in several languages, and often several per language. For example,
- C,
- C++20,
- C#,
- D,
- Go (New),
- Go (Old, without TagLongArray),
- Java (Old, without TagLongArray),
- Javascript,
- PHP,
- Python,
- Ruby,
- Rust,
- Scala,
- Kotlin (Streams, ByteBuffer, NIO, Endianness, Zlib, Gzip, Any Input/Output, Examples in Comments),
- Kotlin (with a builder DSL and type-safety),
- Kotlin Multiplatform,
- You get the idea…
Unless you have specific goals or licence requirements, it is extremely recommended to go with one of the existing libraries.
Utilities
Almost every 3rd-party Minecraft application uses NBT on some level. There also exist several dedicated NBT editors, which will likely be useful to you if you are developing an NBT library of your own. These include:
- NBTExplorer (C#) NBT Directory-tree interface that fully supports the Minecraft .mcr/.mca region files.
- NEINedit (Obj-C), an OS X specific editor.
- nbt2yaml (Python), provides command-line editing of NBT via the YAML format, as well as a fast and minimalist NBT parsing/rendering API.
- nbted (Rust; CC0), provides command-line editing of NBT files via your $EDITOR
- nbt2json (Golang; MIT) Command-line utility for NBT to JSON/YAML conversion and back. MCPE-NBT support. Can be used as library.
Specification
The NBT file format is extremely simple, and writing a library capable of reading/writing it is a simple affair. There are 13 datatypes supported by this format, one of which is used to close compound tags. It is strongly advised to read this entire section or you may run into issues.
Type ID | Type Name | Payload Size (Bytes) | Description |
---|---|---|---|
0 | TAG_End | 0 | Signifies the end of a TAG_Compound. It is only ever used inside a TAG_Compound, and is not named despite being in a TAG_Compound |
1 | TAG_Byte | 1 | A single signed byte |
2 | TAG_Short | 2 | A single signed, big endian 16 bit integer |
3 | TAG_Int | 4 | A single signed, big endian 32 bit integer |
4 | TAG_Long | 8 | A single signed, big endian 64 bit integer |
5 | TAG_Float | 4 | A single, big endian IEEE-754 single-precision floating point number (NaN possible) |
6 | TAG_Double | 8 | A single, big endian IEEE-754 double-precision floating point number (NaN possible) |
7 | TAG_Byte_Array | ... | A length-prefixed array of signed bytes. The prefix is a signed integer (thus 4 bytes) |
8 | TAG_String | ... | A length-prefixed modified UTF-8 string. The prefix is an unsigned short (thus 2 bytes) signifying the length of the string in bytes |
9 | TAG_List | ... | A list of nameless tags, all of the same type. The list is prefixed with the Type ID of the items it contains (thus 1 byte), and the length of the list as a signed integer (a further 4 bytes). If the length of the list is 0 or negative, the type may be 0 (TAG_End) but otherwise it must be any other type. (The notchian implementation uses TAG_End in that situation, but another reference implementation by Mojang uses 1 instead; parsers should accept any type if the length is <= 0). |
10 | TAG_Compound | ... | Effectively a list of a named tags. Order is not guaranteed. |
11 | TAG_Int_Array | ... | A length-prefixed array of signed integers. The prefix is a signed integer (thus 4 bytes) and indicates the number of 4 byte integers. |
12 | TAG_Long_Array | ... | A length-prefixed array of signed longs. The prefix is a signed integer (thus 4 bytes) and indicates the number of 8 byte longs. |
There are a couple of simple things to remember:
- The datatypes representing numbers are in big-endian in Java edition, but Bedrock edition changes things up a bit. See the below section on Bedrock edition
- Every NBT file will always implicitly be inside a tag compound, and also begin with a TAG_Compound (except in Bedrock edition, see below)
- The structure of a NBT file is defined by the TAG_List and TAG_Compound types, as such a tag itself will only contain the payload, but depending on what the tag is contained within may contain additional headers. I.e. if it's inside a Compound, then each tag will begin with the TAG_id, and then a string (the tag's name), and finally the payload. While in a list it will be only the payload, as there is no name and the tag type is given in the beginning of the list.
For example, here's the example layout of a TAG_Short
on disk:
Type ID | Length of Name | Name | Payload | |
---|---|---|---|---|
Decoded | 2 | 9 | shortTest | 32767 |
On Disk (in hex) | 02 | 00 09 | 73 68 6F 72 74 54 65 73 74 | 7F FF |
If this TAG_Short
had been in a TAG_List
, it would have been nothing more than the payload, since the type is implied and tags within the first level of a list are nameless.
Bedrock edition
Bedrock edition makes a couple of significant changes to the NBT format. First of all, first tag in an NBT file can sometimes be a TAG_List instead of a TAG_Compound. Additionally, NBT data is encoded in one of two different formats, a little-endian version intended for writing to disk, and a VarInt version intended for transport over the network.
(Help) Minecraft Detect Item Anywhere In Inventory With NBT
Little-endian
Identical to the big-endian format used by Java edition, but all numbers are encoded in little-endian. This includes the 16-bit length prefix before tag names and TAG_String values, as well as TAG_Float and TAG_Double values.
VarInt
Nbt Editor Online
This format is a bit more complex than the others. The differences from Java edition's big-endian format are as follows:
- TAG_Short, TAG_Float and TAG_Double values are encoded as their little-endian counterparts
- TAG_Int values and the length prefixes for TAG_List, TAG_Byte_Array, TAG_Int_Array and TAG_Long_Array are encoded as VarInts with ZigZag encoding
- TAG_Long values are encoded as VarLongs with ZigZag encoding
- All strings (Tag names and TAG_String values) are length-prefixed with a normal VarInt
Examples
There are two defacto example files used for testing your implementation (test.nbt
& bigtest.nbt
), originally provided by Markus. The example output provided below was generated using PyNBT's debug-nbt tool.
test.nbt
This first example is an uncompressed 'Hello World' NBT example. Should you parse it correctly, you will get a structure similar to the following:
Here is the example explained:
(The entire thing is implicitly inside a compound) | Type ID (first element in the implicit compound) | Length of name of the root compound | Name of the root compound | Type ID of first element in root compound | Length of name of first element in root | Name of first element | Length of string | String | Tag end (of root compound) |
---|---|---|---|---|---|---|---|---|---|
Decoded | Compound | 11 | hello world | String | 4 | name | 9 | Bananrama | |
On Disk (in hex) | 0a | 00 0b | 68 65 6c 6c 6f 20 77 6f 72 6c 64 | 08 | 00 04 | 6e 61 6d 65 | 00 09 | 42 61 6e 61 6e 72 61 6d 61 | 00 |
bigtest.nbt
This second example is a gzip compressed test of every available tag. If your program can successfully parse this file, then you've done well. Note that the tags under TAG_List do not have a name, as mentioned above.
servers.dat
More Videos For Nbtedit »
The servers.dat file contains a list of multiplayer servers you've added to the game. To mix things up a bit, this file will always be uncompressed. Below is an example of the structure seen in servers.dat.
level.dat
This final example is of a single player level.dat, which is compressed using gzip. Notice the player's inventory and general world details such as spawn position, world name, and the game seed.
Download
- test.nbt/hello_world.nbt (uncompressed),
- bigtest.nbt (gzip compressed)
- NaN-value-double.dat (compressed, origin version unknown)
- NBT.txt (original NBT specification)
Name | NBTExplorer |
---|---|
Author | Justin Aquadro |
Type | Graphical NBT Editor |
Platforms | Windows, Mac, Linux (With use of Mono) |
Forum Post |
NBTExplorer is a low-level graphical NBT (Named Binary Tag) data editor for Minecraft. With a directory-tree interface for easily exploring multiple worlds, and support for the latest NBT standard, NBTExplorer is built on top of Substrate. Almost all things in a map in any Minecraft version is built with NBT, so you can usually change the datas for the newest version without updating NBTExplorer.
Usage[edit]
NBT tags control every world parameter, such as ender chest items, player's inventory, gamemode, whether the world is Hardcore or not and many other things. NBTExplorer can be used to view and change data, with uses including:
- Changing level.dat, including but not only
- Locate in-game structures;
- Add or change items, and adding enchantments;
- Access to the world seed;
- Changing gamerules without usage of the
/gamerule
command or new gamerule changer built in when creating a world; - Applying custom formatting to world or server names;
- Change the world's name;
- Change the players game mode, health, position and so on. For example, if the player is in an 'illegal area' and can't teleport back with
/tp
, this function can change the player's position. - Change the settings for terrain generation, while it doesn't affect the generated chunks;
- Changing regions and chunks, including but not only
- Change the biomes for chunks;
- Change the mob datas or delete mobs. For example, if there are too many entities resulting in crashes, this can delete the mobs;
- Change the block entity data. Including command blocks, chests, signs and so on.
- Cheats ON
Compatible Formats[edit]
- Standard NBT files (e.g. level.dat)
- Schematic files
- Uncompressed NBT files (e.g. idcounts.dat)
- Minecraft region files (*.mcr)
- Minecraft anvil files (*.mca)
- Cubic Chunks region files