Adjusted the model and finished figuring out / writing down the spec
parent
43d8a2cbf7
commit
cad04d8e12
|
@ -1,20 +1,20 @@
|
|||
// information taken from https://wiki.vg/NBT
|
||||
// This is an attempt at creating a uniform model for all NBT tags to allow for a uniform interface based on subclassing a single NBT tag super class.
|
||||
|
||||
// NBT tags have a type (signed or unsigned?), optionally a name, optionally content type, optionally a size (signed), and content
|
||||
// Whether the type id byte is signed or not is unknown at this point. All other numbers are signed unless specified otherwise.
|
||||
// NBT tags have a type, optionally a name which consists of the name size and the name string, optionally content type, and optionally a payload which can consist of optionally content type, optionally a content size,
|
||||
// and the stored content. The format in which they are stored is as follows: <type><name size><name><payload>. All numbers are stored in big endian representation.
|
||||
// All tag types:
|
||||
// generic representation: Tag(Byte:tag_type, String:name, byte[]:content, Byte:content_type, int32:size)
|
||||
// end: Tag( 0, "", None, 0, 0) => used to determine the end of a compound tag, only the type gets stored
|
||||
// byte: Tag( 1, String:name, byte:content, 1, 1) => a single signed byte, size and content type not stored
|
||||
// int16: Tag( 2, String:name, int16:content, 2, 2) => big endian signed 16 bit integer, size and content type not stored
|
||||
// int32: Tag( 3, String:name, int32:content, 3, 4) => big endian signed 32 bit integer, size and content type not stored
|
||||
// int64: Tag( 4, String:name, int64:content, 4, 8) => big endian signed 64 bit integer, size and content type not stored
|
||||
// float32: Tag( 5, String:name, float32:content,5, 4) => big endian 32 bit floating point number, size and content type not stored
|
||||
// float64: Tag( 6, String:name, float64:content,6, 8) => big endian 64 bit floating point number, size and content type not stored
|
||||
// byte[]: Tag( 7, String:name, byte[]:content, 1, int32:size) => content stored prefixed with size, content type not stored
|
||||
// String: Tag( 8, String:name, byte[]:content, 8, uint16:size) => Java style modified UTF-8 string, size is unique bc it's 16 bit and unsigned, content stored prefixed with size, content type not stored
|
||||
// Tag[] (list): Tag( 9, String:name, Tag[]:content, byte:content_type, int32:size) => list of nameless tags of the same type prefixed by (in order) content type and size, no closer specification as to what namelessness entails
|
||||
// Tag[] (compound): Tag(10, String:name, Tag[]:content, None, int32:size) => list of tags, last tag is always an end tag, size and content type not stored
|
||||
// int32[]: Tag(11, String:name, int32[]:content,3, int32:size) => list of 32 bit signed integers prefixed with its size, content type not stored, endianness unknown at this point
|
||||
// int64[]: Tag(12, String:name, int64[]:content,4, int32:size) => list of 64 bit signed integers prefixed with its size, content type not stored, endianness unknown at this point
|
||||
// generic representation: Tag(Byte:tag_type, String:name, uint16:name_size, byte[]:content, int32:size)
|
||||
// None (compound end): Tag( 0, "", 0, None, 0) => used to determine the end of a compound tag, only the type gets stored
|
||||
// byte: Tag( 1, String:name, uint16:name_size, byte:content, 1) => a single signed byte, size and content type not stored
|
||||
// int16: Tag( 2, String:name, uint16:name_size, int16:content, 2) => 16 bit signed integer, size and content type not stored
|
||||
// int32: Tag( 3, String:name, uint16:name_size, int32:content, 4) => 32 bit signed integer, size and content type not stored
|
||||
// int64: Tag( 4, String:name, uint16:name_size, int64:content, 8) => 64 bit signed integer, size and content type not stored
|
||||
// float32: Tag( 5, String:name, uint16:name_size, float32:content,4) => 32 bit IEEE754 floating point number, size and content type not stored
|
||||
// float64: Tag( 6, String:name, uint16:name_size, float64:content,8) => 64 bit IEEE754 floating point number, size and content type not stored
|
||||
// byte[]: Tag( 7, String:name, uint16:name_size, byte[]:content, int32:size) => content stored prefixed with size, content type not stored
|
||||
// String: Tag( 8, String:name, uint16:name_size, byte[]:content, uint16:size) => Java style modified UTF-8 string, content stored prefixed with size, content type not stored
|
||||
// Tag[] (list): Tag<Tag:type>( 9, String:name, uint16:name_size, Tag[]:content, int32:size) => list of tags of the same type with tag type and name information omitted prefixed by (in order) content type and size
|
||||
// Tag[] (compound): Tag(10, String:name, uint16:name_size, Tag[]:content, int32:size) => list of tags, last tag is always an end tag, size and content type not stored
|
||||
// int32[]: Tag(11, String:name, uint16:name_size, int32[]:content,int32:size) => list of 32 bit signed integers prefixed with its size, content type not stored, endianness unknown at this point
|
||||
// int64[]: Tag(12, String:name, uint16:name_size, int64[]:content,int32:size) => list of 64 bit signed integers prefixed with its size, content type not stored, endianness unknown at this point
|
||||
|
|
Loading…
Reference in New Issue