Documentation ¶
Overview ¶
nbt provides the ability to read/write NBT data structures from Readers and Writers.
NBT is the data serialization format used in many places in the official Notchian Minecraft server, typically to represent structured world, chunk and player information.
An NBT data structure can be created with code such as the following:
root := &Compound{ map[string]ITag{ "Data": &Compound{ map[string]ITag{ "Byte": &Byte{1}, "Short": &Short{2}, "Int": &Int{3}, "Long": &Long{4}, "Float": &Float{5}, "Double": &Double{6}, "String": &String{"foo"}, "List": &List{TagByte, []ITag{&Byte{1}, &Byte{2}}}, }, }, }, }
It is required that the root structure be a Compound for compatibility with existing NBT structures observed in the official server.
NBT structures can be read from an io.Reader with the Read function.
Index ¶
Constants ¶
View Source
const ( // Tag types. All these values can be used to create a new tag, except // TagEnd. TagEnd = TagType(0) TagByte = TagType(1) TagShort = TagType(2) TagInt = TagType(3) TagLong = TagType(4) TagFloat = TagType(5) TagDouble = TagType(6) TagByteArray = TagType(7) TagString = TagType(8) TagList = TagType(9) TagCompound = TagType(10) )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Compound ¶
func NewCompound ¶
func NewCompound() *Compound
type ITag ¶
type ITag interface { Type() TagType Read(io.Reader) error Write(io.Writer) error Lookup(path string) ITag }
ITag is the interface for all tags that can be represented in an NBT tree.
Click to show internal directories.
Click to hide internal directories.