Documentation ¶
Overview ¶
Package nbt implement the Named Binary Tag format of Minecraft. It provides api like encoding/xml package.
Index ¶
Examples ¶
Constants ¶
View Source
const ( TagEnd byte = iota TagByte TagShort TagInt TagLong TagFloat TagDouble TagByteArray TagString TagList TagCompound TagIntArray TagLongArray TagNone = 0xFF )
Tag type IDs
Variables ¶
View Source
var ErrEND = errors.New("unexpected TAG_End")
ErrEND error will be returned when reading a NBT with only Tag_End
View Source
var (
ErrMustBeStruct = errors.New("a compound can only be a struct")
)
Functions ¶
func IsArrayTag ¶
func Marshal ¶
Example ¶
var value = struct { Name string `nbt:"name"` }{"Tnze"} var buf bytes.Buffer if err := Marshal(&buf, value); err != nil { panic(err) } fmt.Printf("% 02x ", buf.Bytes())
Output: 0a 00 00 08 00 04 6e 61 6d 65 00 04 54 6e 7a 65 00
Types ¶
type DecoderReader ¶
type DecoderReader = interface { io.ByteScanner io.Reader }
type Unmarshaler ¶
type Unmarshaler interface {
Unmarshal(tagType byte, tagName string, r DecoderReader) error
}
Click to show internal directories.
Click to hide internal directories.