ScriptArts

好きな時に好きなことをやるサークル

NBT Format

TAG_End

Header
TagType
Typebyte
Value0
Hex00

TAG_Byte

hoge: 1b

HeaderBody
TagTypeTagNameLengthTagNameValue
Typebyteshortstringbyte
Value14hoge1
Hex01 00 04 68 6f 67 65 01

TAG_Short

hoge: 1s

HeaderBody
TagTypeTagNameLengthTagNameValue
Typebyteshortstringshort
Value24hoge1
Hex02 00 04 68 6f 67 65 00 01

TAG_Int

hoge: 1

HeaderBody
TagTypeTagNameLengthTagNameValue
Typebyteshortstringint
Value34hoge1
Hex03 00 04 68 6f 67 65 00 00 00 01

TAG_Long

hoge: 1L

HeaderBody
TagTypeTagNameLengthTagNameValue
Typebyteshortstringlong
Value44hoge1
Hex04 00 04 68 6f 67 65 00 00 00 00 00 00 00 01

TAG_Float

hoge: 1.0f

HeaderBody
TagTypeTagNameLengthTagNameValue
Typebyteshortstringfloat
Value54hoge1.0
Hex05 00 04 68 6f 67 65 3f 80 00 00

TAG_Double

hoge: 1.0d

HeaderBody
TagTypeTagNameLengthTagNameValue
Typebyteshortstringdouble
Value64hoge1.0
Hex06 00 04 68 6f 67 65 3f f0 00 00 00 00 00 00

TAG_Byte_Array

hoge: [B; 1B, 2B]

HeaderBody
TagTypeTagNameLengthTagNameArrayLengthArray
Typebyteshortstringintbytebyte
Value74hoge212
Hex07 00 04 68 6f 67 65 00 00 00 02 01 02

TAG_String

hoge: "huga"

HeaderBody
TagTypeTagNameLengthTagNameValueLengthValue
Typebyteshortstringshortstring
Value84hoge4huga
Hex08 00 04 68 6f 67 65 00 04 68 75 67 61

TAG_List

hoge: [1s, 2s]

HeaderBody
TagTypeTagNameLengthTagNameListTagTypeListLengthList
Typebyteshortstringbyteintshortshort
Value94hoge2212
Hex09 00 04 68 6f 67 65 02 00 00 00 02 00 01 00 02

TAG_Compound

hoge: {}

HeaderBodyTAG_End
TagTypeTagNameLengthTagNameChildTags
Typebyteshortstring
Value104hoge
Hex0a 00 04 68 6f 67 65

TAG_Int_Array

hoge: [I; 1, 2]

HeaderBody
TagTypeTagNameLengthTagNameArrayLengthArray
Typebyteshortstringintintint
Value114hoge212
Hex0b 00 04 68 6f 67 65 00 00 00 02 00 00 00 01 00 00 00 02

TAG_Long_Array

hoge: [L; 1L, 2L]

HeaderBody
TagTypeTagNameLengthTagNameArrayLengthArray
Typebyteshortstringintlonglong
Value124hoge212
Hex0c 00 04 68 6f 67 65 00 00 00 02 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 02

Example

{hoge: {foo: "bar", piyo: 10s}, huga: [I; 1, 2, 3]}
= 0a 00 00 0a 00 04 68 6f 67 65 08 00 03 66 6f 6f 00 03 62 61 72 02 00 04 70 69 79 6f 00 0a 00 0b 00 04 68 75 67 61 00 00 00 03 00 00 00 01 00 00 00 02 00 00 00 03 00

Source