Versions in this module Expand all Collapse all v1 v1.1.0 Sep 10, 2023 v1.0.0 Sep 10, 2023 Changes in this version + const DefaultCompressionLevel + const IDTagByte + const IDTagByteArray + const IDTagCompound + const IDTagDouble + const IDTagEnd + const IDTagFloat + const IDTagInt + const IDTagIntArray + const IDTagList + const IDTagLong + const IDTagLongArray + const IDTagShort + const IDTagString + var BigEndian = binary.BigEndian + var LittleEndian = binary.LittleEndian + func Compress(s *Stream, typ CompressType, level int) ([]byte, error) + func GetTagName(id byte) string + type Byte struct + Value int8 + func NewByteTag(name string, val int8) *Byte + func (t *Byte) ID() byte + func (t *Byte) Name() string + func (t *Byte) Read(n *Stream) (err error) + func (t *Byte) SetName(name string) + func (t *Byte) ToBool() (bool, error) + func (t *Byte) ToByte() (byte, error) + func (t *Byte) ToByteArray() ([]byte, error) + func (t *Byte) ToFloat32() (float32, error) + func (t *Byte) ToFloat64() (float64, error) + func (t *Byte) ToInt() (int, error) + func (t *Byte) ToInt16() (int16, error) + func (t *Byte) ToInt32() (int32, error) + func (t *Byte) ToInt64() (int64, error) + func (t *Byte) ToInt8() (int8, error) + func (t *Byte) ToIntArray() ([]int32, error) + func (t *Byte) ToLongArray() ([]int64, error) + func (t *Byte) ToRune() (rune, error) + func (t *Byte) ToString() (string, error) + func (t *Byte) ToUInt() (uint, error) + func (t *Byte) ToUInt16() (uint16, error) + func (t *Byte) ToUInt32() (uint32, error) + func (t *Byte) ToUInt64() (uint64, error) + func (t *Byte) ToUInt8() (uint8, error) + func (t *Byte) Write(n *Stream) error + type ByteArray struct + Value []byte + func NewByteArrayTag(name string, val []byte) *ByteArray + func (t *ByteArray) ID() byte + func (t *ByteArray) Name() string + func (t *ByteArray) Read(n *Stream) error + func (t *ByteArray) SetName(name string) + func (t *ByteArray) ToBool() (bool, error) + func (t *ByteArray) ToByte() (byte, error) + func (t *ByteArray) ToByteArray() ([]byte, error) + func (t *ByteArray) ToFloat32() (float32, error) + func (t *ByteArray) ToFloat64() (float64, error) + func (t *ByteArray) ToInt() (int, error) + func (t *ByteArray) ToInt16() (int16, error) + func (t *ByteArray) ToInt32() (int32, error) + func (t *ByteArray) ToInt64() (int64, error) + func (t *ByteArray) ToInt8() (int8, error) + func (t *ByteArray) ToIntArray() ([]int32, error) + func (t *ByteArray) ToLongArray() ([]int64, error) + func (t *ByteArray) ToRune() (rune, error) + func (t *ByteArray) ToString() (string, error) + func (t *ByteArray) ToUInt() (uint, error) + func (t *ByteArray) ToUInt16() (uint16, error) + func (t *ByteArray) ToUInt32() (uint32, error) + func (t *ByteArray) ToUInt64() (uint64, error) + func (t *ByteArray) ToUInt8() (uint8, error) + func (t *ByteArray) Write(n *Stream) error + type Compound struct + Value map[string]Tag + func NewCompoundTag(name string, val map[string]Tag) *Compound + func (t *Compound) Get(name string) (Tag, bool) + func (t *Compound) GetBool(name string) (bool, error) + func (t *Compound) GetByte(name string) (byte, error) + func (t *Compound) GetByteArray(name string) ([]byte, error) + func (t *Compound) GetCompound(name string) (*Compound, error) + func (t *Compound) GetDouble(name string) (float64, error) + func (t *Compound) GetFloat(name string) (float32, error) + func (t *Compound) GetInt(name string) (int32, error) + func (t *Compound) GetIntArray(name string) ([]int32, error) + func (t *Compound) GetList(name string) ([]Tag, error) + func (t *Compound) GetLong(name string) (int64, error) + func (t *Compound) GetLongArray(name string) ([]int64, error) + func (t *Compound) GetShort(name string) (int16, error) + func (t *Compound) GetString(name string) (string, error) + func (t *Compound) Has(name string) bool + func (t *Compound) ID() byte + func (t *Compound) Name() string + func (t *Compound) OrderedKeys() []string + func (t *Compound) Read(n *Stream) (err error) + func (t *Compound) Set(tag Tag) + func (t *Compound) SetName(name string) + func (t *Compound) ToBool() (bool, error) + func (t *Compound) ToByte() (byte, error) + func (t *Compound) ToByteArray() ([]byte, error) + func (t *Compound) ToFloat32() (float32, error) + func (t *Compound) ToFloat64() (float64, error) + func (t *Compound) ToInt() (int, error) + func (t *Compound) ToInt16() (int16, error) + func (t *Compound) ToInt32() (int32, error) + func (t *Compound) ToInt64() (int64, error) + func (t *Compound) ToInt8() (int8, error) + func (t *Compound) ToIntArray() ([]int32, error) + func (t *Compound) ToLongArray() ([]int64, error) + func (t *Compound) ToRune() (rune, error) + func (t *Compound) ToString() (string, error) + func (t *Compound) ToUInt() (uint, error) + func (t *Compound) ToUInt16() (uint16, error) + func (t *Compound) ToUInt32() (uint32, error) + func (t *Compound) ToUInt64() (uint64, error) + func (t *Compound) ToUInt8() (uint8, error) + func (t *Compound) Write(n *Stream) error + type CompressType int + const CompressGZip + const CompressZlib + func (ct CompressType) DefaultCompression() int + type Double struct + Value float64 + func NewDoubleTag(name string, val float64) *Double + func (t *Double) ID() byte + func (t *Double) Name() string + func (t *Double) Read(n *Stream) (err error) + func (t *Double) SetName(name string) + func (t *Double) ToBool() (bool, error) + func (t *Double) ToByte() (byte, error) + func (t *Double) ToByteArray() ([]byte, error) + func (t *Double) ToFloat32() (float32, error) + func (t *Double) ToFloat64() (float64, error) + func (t *Double) ToInt() (int, error) + func (t *Double) ToInt16() (int16, error) + func (t *Double) ToInt32() (int32, error) + func (t *Double) ToInt64() (int64, error) + func (t *Double) ToInt8() (int8, error) + func (t *Double) ToIntArray() ([]int32, error) + func (t *Double) ToLongArray() ([]int64, error) + func (t *Double) ToRune() (rune, error) + func (t *Double) ToString() (string, error) + func (t *Double) ToUInt() (uint, error) + func (t *Double) ToUInt16() (uint16, error) + func (t *Double) ToUInt32() (uint32, error) + func (t *Double) ToUInt64() (uint64, error) + func (t *Double) ToUInt8() (uint8, error) + func (t *Double) Write(n *Stream) error + type End struct + func NewEndTag(name string) *End + func (t *End) ID() byte + func (t *End) Name() string + func (t *End) Read(nbt *Stream) error + func (t *End) SetName(name string) + func (t *End) ToBool() (bool, error) + func (t *End) ToByte() (byte, error) + func (t *End) ToByteArray() ([]byte, error) + func (t *End) ToFloat32() (float32, error) + func (t *End) ToFloat64() (float64, error) + func (t *End) ToInt() (int, error) + func (t *End) ToInt16() (int16, error) + func (t *End) ToInt32() (int32, error) + func (t *End) ToInt64() (int64, error) + func (t *End) ToInt8() (int8, error) + func (t *End) ToIntArray() ([]int32, error) + func (t *End) ToLongArray() ([]int64, error) + func (t *End) ToRune() (rune, error) + func (t *End) ToString() (string, error) + func (t *End) ToUInt() (uint, error) + func (t *End) ToUInt16() (uint16, error) + func (t *End) ToUInt32() (uint32, error) + func (t *End) ToUInt64() (uint64, error) + func (t *End) ToUInt8() (uint8, error) + func (t *End) Write(nbt *Stream) error + type Float struct + Value float32 + func NewFloatTag(name string, val float32) *Float + func (t *Float) ID() byte + func (t *Float) Name() string + func (t *Float) Read(n *Stream) (err error) + func (t *Float) SetName(name string) + func (t *Float) ToBool() (bool, error) + func (t *Float) ToByte() (byte, error) + func (t *Float) ToByteArray() ([]byte, error) + func (t *Float) ToFloat32() (float32, error) + func (t *Float) ToFloat64() (float64, error) + func (t *Float) ToInt() (int, error) + func (t *Float) ToInt16() (int16, error) + func (t *Float) ToInt32() (int32, error) + func (t *Float) ToInt64() (int64, error) + func (t *Float) ToInt8() (int8, error) + func (t *Float) ToIntArray() ([]int32, error) + func (t *Float) ToLongArray() ([]int64, error) + func (t *Float) ToRune() (rune, error) + func (t *Float) ToString() (string, error) + func (t *Float) ToUInt() (uint, error) + func (t *Float) ToUInt16() (uint16, error) + func (t *Float) ToUInt32() (uint32, error) + func (t *Float) ToUInt64() (uint64, error) + func (t *Float) ToUInt8() (uint8, error) + func (t *Float) Write(n *Stream) error + type Int struct + Value int32 + func NewIntTag(name string, val int32) *Int + func (t *Int) ID() byte + func (t *Int) Name() string + func (t *Int) Read(n *Stream) (err error) + func (t *Int) SetName(name string) + func (t *Int) ToBool() (bool, error) + func (t *Int) ToByte() (byte, error) + func (t *Int) ToByteArray() ([]byte, error) + func (t *Int) ToFloat32() (float32, error) + func (t *Int) ToFloat64() (float64, error) + func (t *Int) ToInt() (int, error) + func (t *Int) ToInt16() (int16, error) + func (t *Int) ToInt32() (int32, error) + func (t *Int) ToInt64() (int64, error) + func (t *Int) ToInt8() (int8, error) + func (t *Int) ToIntArray() ([]int32, error) + func (t *Int) ToLongArray() ([]int64, error) + func (t *Int) ToRune() (rune, error) + func (t *Int) ToString() (string, error) + func (t *Int) ToUInt() (uint, error) + func (t *Int) ToUInt16() (uint16, error) + func (t *Int) ToUInt32() (uint32, error) + func (t *Int) ToUInt64() (uint64, error) + func (t *Int) ToUInt8() (uint8, error) + func (t *Int) Write(n *Stream) error + type IntArray struct + Value []int32 + func NewIntArrayTag(name string, val []int32) *IntArray + func (t *IntArray) ID() byte + func (t *IntArray) Name() string + func (t *IntArray) Read(n *Stream) (err error) + func (t *IntArray) SetName(name string) + func (t *IntArray) ToBool() (bool, error) + func (t *IntArray) ToByte() (byte, error) + func (t *IntArray) ToByteArray() ([]byte, error) + func (t *IntArray) ToFloat32() (float32, error) + func (t *IntArray) ToFloat64() (float64, error) + func (t *IntArray) ToInt() (int, error) + func (t *IntArray) ToInt16() (int16, error) + func (t *IntArray) ToInt32() (int32, error) + func (t *IntArray) ToInt64() (int64, error) + func (t *IntArray) ToInt8() (int8, error) + func (t *IntArray) ToIntArray() ([]int32, error) + func (t *IntArray) ToLongArray() ([]int64, error) + func (t *IntArray) ToRune() (rune, error) + func (t *IntArray) ToString() (string, error) + func (t *IntArray) ToUInt() (uint, error) + func (t *IntArray) ToUInt16() (uint16, error) + func (t *IntArray) ToUInt32() (uint32, error) + func (t *IntArray) ToUInt64() (uint64, error) + func (t *IntArray) ToUInt8() (uint8, error) + func (t *IntArray) Write(n *Stream) error + type List struct + ListType byte + Value []Tag + func NewListTag(name string, val []Tag, typ byte) *List + func (t *List) ID() byte + func (t *List) Name() string + func (t *List) Read(n *Stream) (err error) + func (t *List) SetName(name string) + func (t *List) ToBool() (bool, error) + func (t *List) ToByte() (byte, error) + func (t *List) ToByteArray() ([]byte, error) + func (t *List) ToFloat32() (float32, error) + func (t *List) ToFloat64() (float64, error) + func (t *List) ToInt() (int, error) + func (t *List) ToInt16() (int16, error) + func (t *List) ToInt32() (int32, error) + func (t *List) ToInt64() (int64, error) + func (t *List) ToInt8() (int8, error) + func (t *List) ToIntArray() ([]int32, error) + func (t *List) ToLongArray() ([]int64, error) + func (t *List) ToRune() (rune, error) + func (t *List) ToString() (string, error) + func (t *List) ToUInt() (uint, error) + func (t *List) ToUInt16() (uint16, error) + func (t *List) ToUInt32() (uint32, error) + func (t *List) ToUInt64() (uint64, error) + func (t *List) ToUInt8() (uint8, error) + func (t *List) Write(n *Stream) error + type Long struct + Value int64 + func NewLongTag(name string, val int64) *Long + func (t *Long) ID() byte + func (t *Long) Name() string + func (t *Long) Read(n *Stream) (err error) + func (t *Long) SetName(name string) + func (t *Long) ToBool() (bool, error) + func (t *Long) ToByte() (byte, error) + func (t *Long) ToByteArray() ([]byte, error) + func (t *Long) ToFloat32() (float32, error) + func (t *Long) ToFloat64() (float64, error) + func (t *Long) ToInt() (int, error) + func (t *Long) ToInt16() (int16, error) + func (t *Long) ToInt32() (int32, error) + func (t *Long) ToInt64() (int64, error) + func (t *Long) ToInt8() (int8, error) + func (t *Long) ToIntArray() ([]int32, error) + func (t *Long) ToLongArray() ([]int64, error) + func (t *Long) ToRune() (rune, error) + func (t *Long) ToString() (string, error) + func (t *Long) ToUInt() (uint, error) + func (t *Long) ToUInt16() (uint16, error) + func (t *Long) ToUInt32() (uint32, error) + func (t *Long) ToUInt64() (uint64, error) + func (t *Long) ToUInt8() (uint8, error) + func (t *Long) Write(n *Stream) error + type LongArray struct + Value []int64 + func NewLongArrayTag(name string, val []int64) *LongArray + func (t *LongArray) ID() byte + func (t *LongArray) Name() string + func (t *LongArray) Read(n *Stream) (err error) + func (t *LongArray) SetName(name string) + func (t *LongArray) ToBool() (bool, error) + func (t *LongArray) ToByte() (byte, error) + func (t *LongArray) ToByteArray() ([]byte, error) + func (t *LongArray) ToFloat32() (float32, error) + func (t *LongArray) ToFloat64() (float64, error) + func (t *LongArray) ToInt() (int, error) + func (t *LongArray) ToInt16() (int16, error) + func (t *LongArray) ToInt32() (int32, error) + func (t *LongArray) ToInt64() (int64, error) + func (t *LongArray) ToInt8() (int8, error) + func (t *LongArray) ToIntArray() ([]int32, error) + func (t *LongArray) ToLongArray() ([]int64, error) + func (t *LongArray) ToRune() (rune, error) + func (t *LongArray) ToString() (string, error) + func (t *LongArray) ToUInt() (uint, error) + func (t *LongArray) ToUInt16() (uint16, error) + func (t *LongArray) ToUInt32() (uint32, error) + func (t *LongArray) ToUInt64() (uint64, error) + func (t *LongArray) ToUInt8() (uint8, error) + func (t *LongArray) Write(n *Stream) error + type Short struct + Value int16 + func NewShortTag(name string, val int16) *Short + func (t *Short) ID() byte + func (t *Short) Name() string + func (t *Short) Read(n *Stream) (err error) + func (t *Short) SetName(name string) + func (t *Short) ToBool() (bool, error) + func (t *Short) ToByte() (byte, error) + func (t *Short) ToByteArray() ([]byte, error) + func (t *Short) ToFloat32() (float32, error) + func (t *Short) ToFloat64() (float64, error) + func (t *Short) ToInt() (int, error) + func (t *Short) ToInt16() (int16, error) + func (t *Short) ToInt32() (int32, error) + func (t *Short) ToInt64() (int64, error) + func (t *Short) ToInt8() (int8, error) + func (t *Short) ToIntArray() ([]int32, error) + func (t *Short) ToLongArray() ([]int64, error) + func (t *Short) ToRune() (rune, error) + func (t *Short) ToString() (string, error) + func (t *Short) ToUInt() (uint, error) + func (t *Short) ToUInt16() (uint16, error) + func (t *Short) ToUInt32() (uint32, error) + func (t *Short) ToUInt64() (uint64, error) + func (t *Short) ToUInt8() (uint8, error) + func (t *Short) Write(n *Stream) error + type Stream struct + Stream *binary.OrderStream + func FromBytes(b []byte, order binary.Order) (*Stream, error) + func FromFile(path string, order binary.Order) (*Stream, error) + func FromReader(reader io.Reader, order binary.Order) (*Stream, error) + func NewStream(order binary.Order) *Stream + func NewStreamBytes(order binary.Order, b []byte) *Stream + func (s *Stream) Bytes() []byte + func (s *Stream) ReadTag() (Tag, error) + func (s *Stream) Reset() + func (s *Stream) WriteTag(tag Tag) error + type String struct + Value string + func NewStringTag(name string, val string) *String + func (t *String) ID() byte + func (t *String) Name() string + func (t *String) Read(n *Stream) (err error) + func (t *String) SetName(name string) + func (t *String) ToBool() (bool, error) + func (t *String) ToByte() (byte, error) + func (t *String) ToByteArray() ([]byte, error) + func (t *String) ToFloat32() (float32, error) + func (t *String) ToFloat64() (float64, error) + func (t *String) ToInt() (int, error) + func (t *String) ToInt16() (int16, error) + func (t *String) ToInt32() (int32, error) + func (t *String) ToInt64() (int64, error) + func (t *String) ToInt8() (int8, error) + func (t *String) ToIntArray() ([]int32, error) + func (t *String) ToLongArray() ([]int64, error) + func (t *String) ToRune() (rune, error) + func (t *String) ToString() (string, error) + func (t *String) ToUInt() (uint, error) + func (t *String) ToUInt16() (uint16, error) + func (t *String) ToUInt32() (uint32, error) + func (t *String) ToUInt64() (uint64, error) + func (t *String) ToUInt8() (uint8, error) + func (t *String) Write(n *Stream) error + type Tag interface + ID func() byte + Name func() string + Read func(nbt *Stream) error + SetName func(name string) + ToBool func() (bool, error) + ToByte func() (byte, error) + ToByteArray func() ([]byte, error) + ToFloat32 func() (float32, error) + ToFloat64 func() (float64, error) + ToInt func() (int, error) + ToInt16 func() (int16, error) + ToInt32 func() (int32, error) + ToInt64 func() (int64, error) + ToInt8 func() (int8, error) + ToIntArray func() ([]int32, error) + ToLongArray func() ([]int64, error) + ToRune func() (rune, error) + ToString func() (string, error) + ToUInt func() (uint, error) + ToUInt16 func() (uint16, error) + ToUInt32 func() (uint32, error) + ToUInt64 func() (uint64, error) + ToUInt8 func() (uint8, error) + Write func(nbt *Stream) error