Documentation ¶
Index ¶
- Constants
- Variables
- func Compress(s *Stream) ([]byte, error)
- func GetTagName(id byte) string
- type 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) 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
- 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) 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
- 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) 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) 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) 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 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) 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
- 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) 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
- 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) 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
- 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) 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
- 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) 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
- 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) 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
- 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) 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 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) 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
- type 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) 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
Constants ¶
const ( // IDTagEnd signifies end for compound tag // Payload: none IDTagEnd = iota // IDTagByte is a signed byte (-128 to 127) // Payload is 1byte IDTagByte // IDTagShort is a signed short (-32768 to 32767) // Payload is 2 bytes IDTagShort // IDTagInt is a signed int (-2147483648 to 2147483647) // Payload is 4 bytes IDTagInt // IDTagLong is a signed long (-9223372036854775808 to 9223372036854775807) // Payload is 8 bytes IDTagLong // IDTagFloat is a signed single float (IEEE-754) // Payload is 4 bytes IDTagFloat // IDTagDouble is a signed single double (IEEE-754) // Payload is 8 bytes IDTagDouble // IDTagByteArray is a array of signed bytes // Payload is 4 bytes(len of data with signed int) + len bytes IDTagByteArray // IDTagString is a UTF-8 string (max 32767 bytes) // Payload is 2 bytes (len of data with short) + len bytes IDTagString // IDTagList is a list of nameless tags, all tags need same type. // Payload is 1 byte(tag type with byte) + 4 bytes(len with signed int) + len bytes IDTagList // IDTagCompound is a list of named tags. IDTagCompound // IDTagIntArray is a list of int. IDTagIntArray )
Variables ¶
var ( // BigEndian is for MCJE, anvil and more... BigEndian = binary.BigEndian // LittleEndian is for MCBE leveldb format LittleEndian = binary.LittleEndian )
Functions ¶
Types ¶
type Byte ¶
type Byte struct { Value int8 // contains filtered or unexported fields }
Byte is a tag for a byte
func (*Byte) ToByteArray ¶
ToByteArray returns value as []byte
func (*Byte) ToIntArray ¶
ToIntArray returns value as []int32
type ByteArray ¶
type ByteArray struct { Value []byte // contains filtered or unexported fields }
ByteArray is a tag for []byte
func (*ByteArray) ToByteArray ¶
ToByteArray returns value as []byte
func (*ByteArray) ToIntArray ¶
ToIntArray returns value as []int32
type Compound ¶
Compound is a map contained tags
func (*Compound) GetByteArray ¶
GetByteArray gets a tag with name as []byte
func (*Compound) GetCompound ¶
GetCompound gets a tag with name as *Compound
func (*Compound) GetIntArray ¶
GetIntArray gets a tag with name as []int32
func (*Compound) ToByteArray ¶
ToByteArray returns value as []byte
func (*Compound) ToIntArray ¶
ToIntArray returns value as []int32
type Double ¶
type Double struct { Value float64 // contains filtered or unexported fields }
Double is a tag for float64
func (*Double) ToByteArray ¶
ToByteArray returns value as []byte
func (*Double) ToIntArray ¶
ToIntArray returns value as []int32
type End ¶
type End struct {
// contains filtered or unexported fields
}
End is a end tag It shows stream end of tag data
func (*End) ToByteArray ¶
ToByteArray returns value as []byte
func (*End) ToIntArray ¶
ToIntArray returns value as []int32
type Float ¶
type Float struct { Value float32 // contains filtered or unexported fields }
Float is a tag for a float
func (*Float) ToByteArray ¶
ToByteArray returns value as []byte
func (*Float) ToIntArray ¶
ToIntArray returns value as []int32
type Int ¶
type Int struct { Value int32 // contains filtered or unexported fields }
Int is a tag for an int
func (*Int) ToByteArray ¶
ToByteArray returns value as []byte
func (*Int) ToIntArray ¶
ToIntArray returns value as []int32
type IntArray ¶
type IntArray struct { Value []int32 // contains filtered or unexported fields }
IntArray is a tag for a int array
func (*IntArray) ToByteArray ¶
ToByteArray returns value as []byte
func (*IntArray) ToIntArray ¶
ToIntArray returns value as []int32
type List ¶
List is a container for tags
func (*List) ToByteArray ¶
ToByteArray returns value as []byte
func (*List) ToIntArray ¶
ToIntArray returns value as []int32
type Long ¶
type Long struct { Value int64 // contains filtered or unexported fields }
Long is a tag for an int64
func (*Long) ToByteArray ¶
ToByteArray returns value as []byte
func (*Long) ToIntArray ¶
ToIntArray returns value as []int32
type Short ¶
type Short struct { Value int16 // contains filtered or unexported fields }
Short is a tag for a short
func (*Short) ToByteArray ¶
ToByteArray returns value as []byte
func (*Short) ToIntArray ¶
ToIntArray returns value as []int32
type Stream ¶
type Stream struct {
Stream *binary.OrderStream
}
Stream is binary nbt stream
func FromFile ¶
FromFile returns new stream from file If the data is comressed, uncompresses with gzip
func FromReader ¶
FromReader returns new stream from Reader If the data is compressed, uncompresses with gzip
func NewStreamBytes ¶
NewStreamBytes returns new Stream with bytes data
type String ¶
type String struct { Value string // contains filtered or unexported fields }
String is a tag for string
func (*String) ToByteArray ¶
ToByteArray returns value as []byte
func (*String) ToIntArray ¶
ToIntArray returns value as []int32
type Tag ¶
type Tag interface { // ID returns tag id ID() byte // Name returns tag's name Name() string // SetName set name in tag SetName(name string) // Read reads tag from Stream Read(nbt *Stream) error // Write writes tag for Stream Write(nbt *Stream) error // ToBool returns value as bool ToBool() (bool, error) // ToByte returns value as byte ToByte() (byte, error) // ToRune returns value as rune ToRune() (rune, error) // ToInt returns value as int ToInt() (int, error) // ToUInt returns value as uint ToUInt() (uint, error) // ToUInt8 returns value as uint8 ToUInt8() (uint8, error) // ToUInt16 returns value as uint16 ToUInt16() (uint16, error) // ToUInt32 returns value as uint32 ToUInt32() (uint32, error) // ToUInt64 returns value as uint64 ToUInt64() (uint64, error) // ToInt8 returns value as int8 ToInt8() (int8, error) // ToInt16 returns value as int16 ToInt16() (int16, error) // ToInt32 returns value as int32 ToInt32() (int32, error) // ToInt64 returns value as int64 ToInt64() (int64, error) // ToFloat32 returns value as float32 ToFloat32() (float32, error) // ToFloat64 returns value as float64 ToFloat64() (float64, error) // ToByteArray returns value as []byte ToByteArray() ([]byte, error) // ToString returns value as string ToString() (string, error) // ToIntArray returns value as []int32 ToIntArray() ([]int32, error) }
Tag is a nbt tag interface