Minecraft Wiki
編集の要約なし
(最新の英語版に更新。{{要翻訳}}を追加)
1行目: 1行目:
{{about|NBTフォーマット|NBTコマンド|チュートリアル/Command NBT Tags}}
+
{{about|NBT ファイルフォーマット|コマンドでのNBTの使用|チュートリアル/コマンドNBTタグ}}
  +
{{要翻訳}}
 
The '''Named Binary Tag''' format is used by Minecraft for the various files in which it saves data. The format is described by Notch in a very brief [http://web.archive.org/web/20110723210920/http://www.minecraft.net/docs/NBT.txt specification]. The format is designed to store data in a tree structure made up of various ''tags''. All tags have an ID and a name. The original known version was 19132 as introduced in [[Minecraft Beta]] 1.3, and since then has been updated to 19133 with [[Anvil file format|Anvil]], with the addition of the Int Array tag. The NBT format dates all the way back to [[Minecraft Indev]] with tags 0 to 10 in use.
 
The '''Named Binary Tag''' format is used by Minecraft for the various files in which it saves data. The format is described by Notch in a very brief [http://web.archive.org/web/20110723210920/http://www.minecraft.net/docs/NBT.txt specification]. The format is designed to store data in a tree structure made up of various ''tags''. All tags have an ID and a name. The original known version was 19132 as introduced in [[Minecraft Beta]] 1.3, and since then has been updated to 19133 with [[Anvil file format|Anvil]], with the addition of the Int Array tag. The NBT format dates all the way back to [[Minecraft Indev]] with tags 0 to 10 in use.
   
53行目: 54行目:
 
| 4 bytes / 32 bits, signed, big endian, IEEE 754-2008, binary32
 
| 4 bytes / 32 bits, signed, big endian, IEEE 754-2008, binary32
 
| A signed floating point type.
 
| A signed floating point type.
| Precision varies throughout number line;<br>See [[wikipedia:Single precision floating-point format|Single-precision floating-point format]].
+
| Precision varies throughout number line;<br>See [[wikipedia:Single precision floating-point format|Single-precision floating-point format]]. Maximum value about 3.4*10<sup>38</sup>
 
|-
 
|-
 
| style="text-align:center" | '''6'''
 
| style="text-align:center" | '''6'''
60行目: 61行目:
 
| 8 bytes / 64 bits, signed, big endian, IEEE 754-2008, binary64
 
| 8 bytes / 64 bits, signed, big endian, IEEE 754-2008, binary64
 
| A signed floating point type.
 
| A signed floating point type.
| Precision varies throughout number line;<br>See [[wikipedia:Double precision floating-point format|Double-precision floating-point format]].
+
| Precision varies throughout number line;<br>See [[wikipedia:Double precision floating-point format|Double-precision floating-point format]]. Maximum value about 1.8*10<sup>308</sup>
 
|-
 
|-
 
| style="text-align:center" | '''7'''
 
| style="text-align:center" | '''7'''
74行目: 75行目:
 
| TAG_Short's payload ''length'', then a UTF-8 string with size ''length''.
 
| 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.
 
| A UTF-8 string. It has a size, rather than being null terminated.
| 32,767 UTF-8 Code Points (see [[wikipedia:UTF-8|UTF-8 format]]; most commonly-used characters are a single code point).
+
| 32,767 bytes interpretable as UTF-8 (see [[wikipedia:UTF-8|UTF-8 format]]; most commonly-used characters are a single byte).
 
|-
 
|-
 
| style="text-align:center" | '''9'''
 
| style="text-align:center" | '''9'''
100行目: 101行目:
   
 
== File Format ==
 
== File Format ==
An NBT file is a GZip'd Compound tag, name and tag ID included. Some of the files utilized by Minecraft may be uncompressed, but in most cases the files follow Notch's original specification and are compressed with GZip. In the [[Xbox 360 Edition]], [[Chunks|chunks]] are compressed with XMemCompress, a variation of an LZX compression algorithm. There is no header to specify the version or any other information - only the [[level.dat]] file specifies the version.
+
An NBT file is a GZip'd Compound tag, name and tag ID included. Some of the files utilized by Minecraft may be uncompressed, but in most cases the files follow Notch's original specification and are compressed with GZip. In the [[Xbox 360 Edition]], [[chunks]] are compressed with XMemCompress, a variation of an LZX compression algorithm. There is no header to specify the version or any other information - only the [[level.dat]] file specifies the version.
   
 
== As used in Minecraft ==
 
== As used in Minecraft ==
108行目: 109行目:
 
** {{nbt|compound|SomeName}}: The only tag contained within the root tag - it has a name and contains all the actual data.
 
** {{nbt|compound|SomeName}}: The only tag contained within the root tag - it has a name and contains all the actual data.
 
</div>
 
</div>
Another noticeable oddity is that, although the original specification by Notch allows for spaces in tag names, and even the example uses spaces in the tag names, Minecraft has no known files where any tags have spaces in their names. There is also inconsistent use of letter case, mostly either lowerCamelCase or UpperCamelCase, but sometimes even in alllowercase.
+
Another noticeable oddity is that, although the original specification by Notch allows for spaces in tag names, and even the example uses spaces in the tag names, Minecraft has no known files where any tags have spaces in their names. There is also inconsistent use of letter case, mostly either lowerCamelCase or UpperCamelCase, but sometimes even in all lowercase.
   
 
=== Uses ===
 
=== Uses ===
115行目: 116行目:
 
* [[idcounts.dat]] is stored in uncompressed NBT format.
 
* [[idcounts.dat]] is stored in uncompressed NBT format.
 
* [[villages.dat]] is stored in compressed NBT format.
 
* [[villages.dat]] is stored in compressed NBT format.
* [[Map Item Format|map_<#>.dat]] files are stored in compressed NBT format.
+
* [[Map item format|map_<#>.dat]] files are stored in compressed NBT format.
 
* [[Servers.dat Format|servers.dat]], which is used to store the list of saved multiplayer servers as uncompressed NBT.
 
* [[Servers.dat Format|servers.dat]], which is used to store the list of saved multiplayer servers as uncompressed NBT.
 
* [[Chunk format|Chunk]]s are stored in compressed NBT format within [[Region file format|Region]] files.
 
* [[Chunk format|Chunk]]s are stored in compressed NBT format within [[Region file format|Region]] files.
* [[Scoreboard#NBT_format|scoreboard.dat]] is stored in compressed NBT format.
+
* [[Scoreboard#NBT format|scoreboard.dat]] is stored in compressed NBT format.
  +
* [[Generated structures data file format|Generated structures]] are stored in compressed NBT format.
   
 
== Software ==
 
== Software ==
131行目: 133行目:
 
| [http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-tools/1261629-mineback-minecraft-automated-backup-single-player/ MineBack Ultimate]
 
| [http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-tools/1261629-mineback-minecraft-automated-backup-single-player/ MineBack Ultimate]
 
| {{tc|yes|19133|style=text-align:center}}
 
| {{tc|yes|19133|style=text-align:center}}
| 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.
+
| 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.
 
|[[File:MineBackNBTEditor.png|128px]]
 
|[[File:MineBackNBTEditor.png|128px]]
 
|-
 
|-
139行目: 141行目:
 
| [[File:NBTEdit Level.Dat.png|128px]]
 
| [[File:NBTEdit Level.Dat.png|128px]]
 
|-
 
|-
| [http://www.minecraftforum.net/topic/840677-nbtexplorer/ NBTExplorer]
+
| [[Programs and editors/NBTExplorer|NBTExplorer]] - [http://www.minecraftforum.net/topic/840677-nbtexplorer/ Forum Post]
 
| {{tc|yes|19133|style=text-align:center}}
 
| {{tc|yes|19133|style=text-align:center}}
 
| 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 file format|Anvil]] files, [[level.dat]], etc.
 
| 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 file format|Anvil]] files, [[level.dat]], etc.
157行目: 159行目:
 
| {{tc|yes|19133|style=text-align:center}}
 
| {{tc|yes|19133|style=text-align:center}}
 
| 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.
 
| 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.
  +
|-
  +
| [https://irath96.github.io/webNBT/ webNBT]
  +
| {{tc|yes|19133|style=text-align:center}}
  +
| 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).
 
|
 
|
 
|}
 
|}
162行目: 168行目:
 
{{minecraft}}
 
{{minecraft}}
   
[[en:NBT_format]]
 
 
[[de:NBT-Format]]
 
[[de:NBT-Format]]
 
[[en:NBT format]]
 
[[nl:NBT formaat]]
 
[[nl:NBT formaat]]
  +
[[ru:Формат NBT]]
 
[[zh:NBT格式]]
 
[[zh:NBT格式]]

2015年7月20日 (月) 10:28時点における版

この記事では、NBT ファイルフォーマットについて説明しています。コマンドでのNBTの使用については「チュートリアル/コマンドNBTタグ」をご覧ください。
Book and Quill
このページの内容は翻訳されていません。 
あなたが内容を翻訳してみませんか?

The Named Binary Tag format is used by Minecraft for the various files in which it saves data. The format is described by Notch in a very brief specification. The format is designed to store data in a tree structure made up of various tags. All tags have an ID and a name. The original known version was 19132 as introduced in Minecraft Beta 1.3, and since then has been updated to 19133 with Anvil, with the addition of the Int Array tag. The NBT format dates all the way back to Minecraft Indev with tags 0 to 10 in use.

TAG definition

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

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

An NBT file is a GZip'd Compound tag, name and tag ID included. Some of the files utilized by Minecraft may be uncompressed, but in most cases the files follow Notch's original specification and are compressed with GZip. In the Xbox 360 Edition, chunks are compressed with XMemCompress, a variation of an LZX compression algorithm. There is no header to specify the version or any other information - only the level.dat file specifies the version.

As used in Minecraft

Minecraft's use of the NBT format is odd at times. In some instances, empty lists may be represented as a list of Byte tags rather than a list of the correct type, or as a list of End tags in newer versions of Minecraft, which can break some older NBT tools. Additionally, almost every root tag has an empty name string and encapsulates only one Compound tag with the actual data and a name. For instance:

  • The root tag for most Minecraft NBT structures.
    •  SomeName: The only tag contained within the root tag - it has a name and contains all the actual data.

Another noticeable oddity is that, although the original specification by Notch allows for spaces in tag names, and even the example uses spaces in the tag names, Minecraft has no known files where any tags have spaces in their names. There is also inconsistent use of letter case, mostly either lowerCamelCase or UpperCamelCase, but sometimes even in all lowercase.

Uses

  • level.dat is stored in compressed NBT format.
  • <player>.dat files are stored in compressed NBT format.
  • idcounts.dat is stored in uncompressed NBT format.
  • villages.dat is stored in compressed NBT format.
  • map_<#>.dat files are stored in compressed NBT format.
  • servers.dat, which is used to store the list of saved multiplayer servers as uncompressed NBT.
  • Chunks are stored in compressed NBT format within Region files.
  • scoreboard.dat is stored in compressed NBT format.
  • Generated structures are stored in compressed NBT format.

Software

Mojang has provided sample Java NBT classes for developers to use and reference as part of the source code for the McRegion -> Anvil converter. Other than this, the community has developed programs to view and modify compressed and uncompressed NBT files:

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).