<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wikivg.fentanylsolutions.org/index.php?action=history&amp;feed=atom&amp;title=NBT.txt</id>
	<title>NBT.txt - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wikivg.fentanylsolutions.org/index.php?action=history&amp;feed=atom&amp;title=NBT.txt"/>
	<link rel="alternate" type="text/html" href="https://wikivg.fentanylsolutions.org/index.php?title=NBT.txt&amp;action=history"/>
	<updated>2026-05-06T13:11:26Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.5</generator>
	<entry>
		<id>https://wikivg.fentanylsolutions.org/index.php?title=NBT.txt&amp;diff=1578&amp;oldid=prev</id>
		<title>imported&gt;Md 5: Created page with &quot;This page is a copy of the official NBT specification, to view more about this format see NBT  Named Binary Tag specification  NBT (Named Binary Tag) is a tag based binary...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wikivg.fentanylsolutions.org/index.php?title=NBT.txt&amp;diff=1578&amp;oldid=prev"/>
		<updated>2012-10-19T23:45:04Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;This page is a copy of the official NBT specification, to view more about this format see &lt;a href=&quot;/index.php/NBT&quot; title=&quot;NBT&quot;&gt;NBT&lt;/a&gt;  Named Binary Tag specification  NBT (Named Binary Tag) is a tag based binary...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This page is a copy of the official NBT specification, to view more about this format see [[NBT]]&lt;br /&gt;
&lt;br /&gt;
Named Binary Tag specification&lt;br /&gt;
&lt;br /&gt;
NBT (Named Binary Tag) is a tag based binary format designed to carry large amounts of binary data with smaller amounts of additional data.&lt;br /&gt;
An NBT file consists of a single GZIPped Named Tag of type TAG_Compound.&lt;br /&gt;
&lt;br /&gt;
A Named Tag has the following format:&lt;br /&gt;
&lt;br /&gt;
    byte tagType&lt;br /&gt;
    TAG_String name&lt;br /&gt;
    [payload]&lt;br /&gt;
    &lt;br /&gt;
The tagType is a single byte defining the contents of the payload of the tag.&lt;br /&gt;
&lt;br /&gt;
The name is a descriptive name, and can be anything (eg &amp;quot;cat&amp;quot;, &amp;quot;banana&amp;quot;, &amp;quot;Hello World!&amp;quot;). It has nothing to do with the tagType.&lt;br /&gt;
The purpose for this name is to name tags so parsing is easier and can be made to only look for certain recognized tag names.&lt;br /&gt;
Exception: If tagType is TAG_End, the name is skipped and assumed to be &amp;quot;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The [payload] varies by tagType.&lt;br /&gt;
&lt;br /&gt;
Note that ONLY Named Tags carry the name and tagType data. Explicitly identified Tags (such as TAG_String above) only contains the payload.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The tag types and respective payloads are:&lt;br /&gt;
&lt;br /&gt;
    TYPE: 0 NAME: TAG_End&lt;br /&gt;
    Payload: None.&lt;br /&gt;
    Note: This tag is used to mark the end of a list.&lt;br /&gt;
             Cannot be named! If type 0 appears where a Named Tag is expected, the name is assumed to be &amp;quot;&amp;quot;.&lt;br /&gt;
             (In other words, this Tag is always just a single 0 byte when named, and nothing in all other cases)&lt;br /&gt;
    &lt;br /&gt;
    TYPE: 1 NAME: TAG_Byte&lt;br /&gt;
    Payload: A single signed byte (8 bits)&lt;br /&gt;
&lt;br /&gt;
    TYPE: 2 NAME: TAG_Short&lt;br /&gt;
    Payload: A signed short (16 bits, big endian)&lt;br /&gt;
&lt;br /&gt;
    TYPE: 3 NAME: TAG_Int&lt;br /&gt;
    Payload: A signed short (32 bits, big endian)&lt;br /&gt;
&lt;br /&gt;
    TYPE: 4 NAME: TAG_Long&lt;br /&gt;
    Payload: A signed long (64 bits, big endian)&lt;br /&gt;
&lt;br /&gt;
    TYPE: 5 NAME: TAG_Float&lt;br /&gt;
    Payload: A floating point value (32 bits, big endian, IEEE 754-2008, binary32)&lt;br /&gt;
&lt;br /&gt;
    TYPE: 6 NAME: TAG_Double&lt;br /&gt;
    Payload: A floating point value (64 bits, big endian, IEEE 754-2008, binary64)&lt;br /&gt;
    &lt;br /&gt;
    TYPE: 7 NAME: TAG_Byte_Array&lt;br /&gt;
    Payload: TAG_Int length&lt;br /&gt;
             An array of bytes of unspecified format. The length of this array is &amp;lt;length&amp;gt; bytes&lt;br /&gt;
&lt;br /&gt;
    TYPE: 8 NAME: TAG_String&lt;br /&gt;
    Payload: TAG_Short length&lt;br /&gt;
             An array of bytes defining a string in UTF-8 format. The length of this array is &amp;lt;length&amp;gt; bytes&lt;br /&gt;
&lt;br /&gt;
    TYPE: 9 NAME: TAG_List&lt;br /&gt;
    Payload: TAG_Byte tagId&lt;br /&gt;
             TAG_Int length&lt;br /&gt;
             A sequential list of Tags (not Named Tags), of type &amp;lt;typeId&amp;gt;. The length of this array is &amp;lt;length&amp;gt; Tags&lt;br /&gt;
    Notes: All tags share the same type.&lt;br /&gt;
             &lt;br /&gt;
    TYPE: 10 NAME: TAG_Compound&lt;br /&gt;
    Payload: A sequential list of Named Tags. This array keeps going until a TAG_End is found.&lt;br /&gt;
             TAG_End end&lt;br /&gt;
    Notes: If there&amp;#039;s a nested TAG_Compound within this tag, that one will also have a TAG_End, so simply reading until the next TAG_End will not work.&lt;br /&gt;
             The names of the named tags have to be unique within each TAG_Compound&lt;br /&gt;
             The order of the tags is not guaranteed.&lt;br /&gt;
             &lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Decoding example:&lt;br /&gt;
(Use http://www.minecraft.net/docs/test.nbt to test your implementation)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First we start by reading a Named Tag.&lt;br /&gt;
After unzipping the stream, the first byte is a 10. That means the tag is a TAG_Compound (as expected by the specification).&lt;br /&gt;
&lt;br /&gt;
The next two bytes are 0 and 11, meaning the name string consists of 11 UTF-8 characters. In this case, they happen to be &amp;quot;hello world&amp;quot;.&lt;br /&gt;
That means our root tag is named &amp;quot;hello world&amp;quot;. We can now move on to the payload.&lt;br /&gt;
&lt;br /&gt;
From the specification, we see that TAG_Compound consists of a series of Named Tags, so we read another byte to find the tagType.&lt;br /&gt;
It happens to be an 8. The name is 4 letters long, and happens to be &amp;quot;name&amp;quot;. Type 8 is TAG_String, meaning we read another two bytes to get the length,&lt;br /&gt;
then read that many bytes to get the contents. In this case, it&amp;#039;s &amp;quot;Bananrama&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
So now we know the TAG_Compound contains a TAG_String named &amp;quot;name&amp;quot; with the content &amp;quot;Bananrama&amp;quot;&lt;br /&gt;
&lt;br /&gt;
We move on to reading the next Named Tag, and get a 0. This is TAG_End, which always has an implied name of &amp;quot;&amp;quot;. That means that the list of entries&lt;br /&gt;
in the TAG_Compound is over, and indeed all of the NBT file.&lt;br /&gt;
&lt;br /&gt;
So we ended up with this:&lt;br /&gt;
&lt;br /&gt;
TAG_Compound(&amp;quot;hello world&amp;quot;): 1 entries&lt;br /&gt;
{&lt;br /&gt;
TAG_String(&amp;quot;name&amp;quot;): Bananrama&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For a slightly longer test, download http://www.minecraft.net/docs/bigtest.nbt&lt;br /&gt;
You should end up with this:&lt;br /&gt;
&lt;br /&gt;
TAG_Compound(&amp;quot;Level&amp;quot;): 11 entries&lt;br /&gt;
{&lt;br /&gt;
TAG_Short(&amp;quot;shortTest&amp;quot;): 32767&lt;br /&gt;
TAG_Long(&amp;quot;longTest&amp;quot;): 9223372036854775807&lt;br /&gt;
TAG_Float(&amp;quot;floatTest&amp;quot;): 0.49823147&lt;br /&gt;
TAG_String(&amp;quot;stringTest&amp;quot;): HELLO WORLD THIS IS A TEST STRING ÅÄÖ!&lt;br /&gt;
TAG_Int(&amp;quot;intTest&amp;quot;): 2147483647&lt;br /&gt;
TAG_Compound(&amp;quot;nested compound test&amp;quot;): 2 entries&lt;br /&gt;
{&lt;br /&gt;
TAG_Compound(&amp;quot;ham&amp;quot;): 2 entries&lt;br /&gt;
{&lt;br /&gt;
TAG_String(&amp;quot;name&amp;quot;): Hampus&lt;br /&gt;
TAG_Float(&amp;quot;value&amp;quot;): 0.75&lt;br /&gt;
}&lt;br /&gt;
TAG_Compound(&amp;quot;egg&amp;quot;): 2 entries&lt;br /&gt;
{&lt;br /&gt;
TAG_String(&amp;quot;name&amp;quot;): Eggbert&lt;br /&gt;
TAG_Float(&amp;quot;value&amp;quot;): 0.5&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
TAG_List(&amp;quot;listTest (long)&amp;quot;): 5 entries of type TAG_Long&lt;br /&gt;
{&lt;br /&gt;
TAG_Long: 11&lt;br /&gt;
TAG_Long: 12&lt;br /&gt;
TAG_Long: 13&lt;br /&gt;
TAG_Long: 14&lt;br /&gt;
TAG_Long: 15&lt;br /&gt;
}&lt;br /&gt;
TAG_Byte(&amp;quot;byteTest&amp;quot;): 127&lt;br /&gt;
TAG_List(&amp;quot;listTest (compound)&amp;quot;): 2 entries of type TAG_Compound&lt;br /&gt;
{&lt;br /&gt;
TAG_Compound: 2 entries&lt;br /&gt;
{&lt;br /&gt;
TAG_String(&amp;quot;name&amp;quot;): Compound tag #0&lt;br /&gt;
TAG_Long(&amp;quot;created-on&amp;quot;): 1264099775885&lt;br /&gt;
}&lt;br /&gt;
TAG_Compound: 2 entries&lt;br /&gt;
{&lt;br /&gt;
TAG_String(&amp;quot;name&amp;quot;): Compound tag #1&lt;br /&gt;
TAG_Long(&amp;quot;created-on&amp;quot;): 1264099775885&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
TAG_Byte_Array(&amp;quot;byteArrayTest (the first 1000 values of (n*n*255+n*7)%100, starting with n=0 (0, 62, 34, 16, 8, ...))&amp;quot;): [1000 bytes]&lt;br /&gt;
TAG_Double(&amp;quot;doubleTest&amp;quot;): 0.4931287132182315&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>imported&gt;Md 5</name></author>
	</entry>
</feed>