Minecraft Wiki
Registre-se
Advertisement
Lang-pt
A tradução da página está em andamento 
Sinta-se livre para ajudar a Minecraft Wiki em Português!
cerca de 60% da tradução está concluída
Esse artigo fala sobre the NBT file format. Para usando NBT em comandos, veja Tutorials/Command NBT Tags.

O formato binário chamado Tag é usado por Minecraft para os vários arquivos em que ele salva os dados. O formato é descrito por Notch de uma forma muito breve specification.O formato é projetado para armazenar dados em uma estrutura de árvore composta de várias tags. Todas as etiquetas têm um ID e um nome. A versão original era conhecido como 19.132 introduzido em Minecraft Beta 1.3, e desde então tem sido atualizado para 19.133 com Bigorna, com a adição da tag matriz Int. O formato NBT datas todo o caminho de volta para Minecraft Indev com etiquetas de 0 a 10 em uso.

TAG definition

Uma tag é uma parte individual da árvore de dados. O primeiro byte em um tag é o tipo de tag (ID), seguido por dois bytes para o comprimento do nome, então o nome como uma string no formato UTF-8 (Nota TAG_End não é chamado e não contém o extra 2 bytes ; o nome é assumida para estar vazia). O nome de marcas podem conter espaços, embora em si Minecraft não poupa as tags com espaços nos nomes. Finalmente, dependendo do tipo de etiqueta, os bytes que se seguem fazem parte da carga que tag. Esta tabela descreve cada um dos 12 marcas conhecidas na versão 19133 do formato binário Tag Denominada:

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

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

File Format

Um arquivo de NBT é um GZip'd tag Composto, nome e ID tag incluído. Alguns dos arquivos utilizados por Minecraft pode ser descompactado, mas na maioria dos casos, os arquivos siga especificação original de Notch e são compactados com GZip. no Xbox 360 Edition, chunks são comprimidos com XMemCompress, uma variação de um algoritmo de compressão LZX. Não há cabeçalho para especificar a versão ou qualquer outra informação - apenas o level.dat arquivo especifica a versão.

Tal como utilizado em Minecraft

Uso de Minecraft do formato NBT é estranho às vezes. Em alguns casos, as listas vazias pode ser representado como uma lista de etiquetas Byte ao invés de uma lista do tipo correto, ou como uma lista de etiquetas End em versões mais recentes do Minecraft, que pode quebrar algumas ferramentas mais antigas NBT. Além disso, quase todos os tag raiz tem uma cadeia de nome vazio e encapsula apenas um tag Composto com os dados reais e um nome. Por exemplo:

  • A marca raiz para a maioria das estruturas Minecraft NBT.
    •  SomeName:A única tag contida dentro da tag raiz - ele tem um nome e contém todos os dados reais.

Outra esquisitice notável é que, embora a especificação original por Notch permite espaços em nomes de tags, e até mesmo o exemplo usa espaços nos nomes de tags, Minecraft não tem arquivos conhecidos, onde todas as marcas têm espaços em seus nomes. Há também o uso inconsistente de letra minúscula, a maioria quer lowerCamelCase ou UpperCamelCase, mas às vezes mesmo em todas as minúsculas.

usos

  • level.dat são armazenados em formato comprimido NBT.
  • <player>.dat arquivos são armazenados em formato comprimido NBT.
  • idcounts.dat é armazenado em formato não comprimido NBT.
  • villages.dat são armazenados em formato comprimido NBT.
  • map_<#>.dat arquivos são armazenados em formato comprimido NBT.
  • servers.dat, which is used to store the list of saved multiplayer servers as uncompressed NBT.
  • Chunkssão armazenados em formato comprimido dentro a NBT Region arquivo
  • scoreboard.dat são armazenados em formato comprimido NBT.
  • Generated structures são armazenados em formato comprimido NBT.

Programas

Mojang forneceu amostra classes de Java NBT para os desenvolvedores a usar e de referência como parte do código fonte para o McRegion -> Anvil converter. Fora isso, a comunidade tem desenvolvido programas para visualizar e modificar arquivos NBT comprimidos e não comprimidos:

Name NBT Version Description Screenshot
MineBack Ultimate 19133 MineBack Ultimate provides a full NBT editor supporting all available types of NBT format file (Map, Level, World etc.). It comes with a modern GUI and many helper functions. MineBackNBTEditor
NBTEdit 19132 Allows for viewing and modifying NBT files via a Windows tree control. It is outdated not only from being an NBT version behind, but because it does not support multiple tags with the same name and it forces incorrect ranges on some types, and it lacks support for uncompressed NBT files. NBTEdit Level.Dat
NBTExplorer - Forum Post 19133 Inspired by and based on NBTEdit, this program allows viewing and editing of NBT files via a Windows tree control. It supports compressed and uncompressed NBT files, and allows for direct editing of the NBT structures in MCRegion and Anvil files, level.dat, etc. NBTExplorer
NBT grammar for Synalyze It! 19132 Using this grammar Synalyze It! displays a color-coded hex dump along with the parsed tag tree. Currently only uncompressed files are supported. Synalyze-It-NBT-decoded
NEINedit 19132 NBT editor for mac with a text-based tree structure. NEINedit
NBT2YAML 19133 nbt2yaml presents a command line interface for reading and editing Minecraft NBT files using a custom YAML format. It also includes a Python API for parsing and writing NBT files to/from a simple Python data structure.
webNBT 19133 webNBT is an NBT-editor that runs in modern browsers without requiring the user to download an application or use third-party browser plugins (like Flash or Java).
Advertisement