Documentation ¶
Index ¶
- Constants
- Variables
- func Compress(s *Stream, typ CompressType, level int) ([]byte, error)
- func GetTagName(id byte) string
- func GetTagPayload(id byte) int
- 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) 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
- 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
- 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) 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
- 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) 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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) 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
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 array for int(4bytes). IDTagIntArray // IDTagLongArray is a array for long(8bytes). IDTagLongArray )
const DefaultCompressionLevel = -1
DefaultCompressionLevel set the default compression level when it's compressing
Variables ¶
var ( // BigEndian is for MCJE, anvil and more... BigEndian = binary.BigEndian // LittleEndian is for MCBE leveldb format LittleEndian = binary.LittleEndian )
Functions ¶
func Compress ¶
func Compress(s *Stream, typ CompressType, level int) ([]byte, error)
Compress compresses stream's bytes You can use compression level in "compress/gzip" and "compress/zlib" for level If you set the default compression level, you can set DefaultCompressionLevel This often is used for player and level data
func GetTagPayload ¶ added in v1.2.3
GetTagPayload returns payload (bytes) of tag
Types ¶
type Byte ¶
type Byte struct { Value int8 // contains filtered or unexported fields }
Byte is a tag for a byte
func NewByteTag ¶ added in v1.2.2
NewByteTag returns a new Byte tag
func (*Byte) ToByteArray ¶
ToByteArray returns value as []byte
func (*Byte) ToIntArray ¶
ToIntArray returns value as []int32
func (*Byte) ToLongArray ¶ added in v1.2.0
ToLongArray returns value as []int64
type ByteArray ¶
type ByteArray struct { Value []byte // contains filtered or unexported fields }
ByteArray is a tag for []byte
func NewByteArrayTag ¶ added in v1.2.2
NewByteArrayTag returns a new ByteArray tag
func (*ByteArray) ToByteArray ¶
ToByteArray returns value as []byte
func (*ByteArray) ToIntArray ¶
ToIntArray returns value as []int32
func (*ByteArray) ToLongArray ¶ added in v1.2.0
ToLongArray returns value as []int64
type Compound ¶
Compound is a map contained tags
func NewCompoundTag ¶ added in v1.2.2
NewCompoundTag returns a new Compound tag
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) GetLongArray ¶ added in v1.2.1
GetLongArray gets a tag with name as []int64
func (*Compound) ToByteArray ¶
ToByteArray returns value as []byte
func (*Compound) ToIntArray ¶
ToIntArray returns value as []int32
func (*Compound) ToLongArray ¶ added in v1.2.0
ToLongArray returns value as []int64
type CompressType ¶ added in v1.1.0
type CompressType int
CompressType is a compression type
const ( // CompressGZip compresses with gzip CompressGZip CompressType = iota // CompressZlib compresses with zlib CompressZlib )
func (CompressType) DefaultCompression ¶ added in v1.2.0
func (ct CompressType) DefaultCompression() int
DefaultCompression returns the default compression level
type Double ¶
type Double struct { Value float64 // contains filtered or unexported fields }
Double is a tag for float64
func NewDoubleTag ¶ added in v1.2.2
NewDoubleTag returns a new Double tag
func (*Double) ToByteArray ¶
ToByteArray returns value as []byte
func (*Double) ToIntArray ¶
ToIntArray returns value as []int32
func (*Double) ToLongArray ¶ added in v1.2.0
ToLongArray returns value as []int64
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
func (*End) ToLongArray ¶ added in v1.2.0
ToLongArray returns value as []int64
type Float ¶
type Float struct { Value float32 // contains filtered or unexported fields }
Float is a tag for a float
func NewFloatTag ¶ added in v1.2.2
NewFloatTag returns a new Float tag
func (*Float) ToByteArray ¶
ToByteArray returns value as []byte
func (*Float) ToIntArray ¶
ToIntArray returns value as []int32
func (*Float) ToLongArray ¶ added in v1.2.0
ToLongArray returns value as []int64
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
func (*Int) ToLongArray ¶ added in v1.2.0
ToLongArray returns value as []int64
type IntArray ¶
type IntArray struct { Value []int32 // contains filtered or unexported fields }
IntArray is a tag for a int array
func NewIntArrayTag ¶ added in v1.2.2
NewIntArrayTag returns a new IntArray tag
func (*IntArray) ToByteArray ¶
ToByteArray returns value as []byte
func (*IntArray) ToIntArray ¶
ToIntArray returns value as []int32
func (*IntArray) ToLongArray ¶ added in v1.2.0
ToLongArray returns value as []int64
type List ¶
List is a container for tags
func NewListTag ¶ added in v1.2.2
NewListTag returns a new List tag
func (*List) ToByteArray ¶
ToByteArray returns value as []byte
func (*List) ToIntArray ¶
ToIntArray returns value as []int32
func (*List) ToLongArray ¶ added in v1.2.0
ToLongArray returns value as []int64
type Long ¶
type Long struct { Value int64 // contains filtered or unexported fields }
Long is a tag for an int64
func NewLongTag ¶ added in v1.2.2
NewLongTag returns a new Long tag
func (*Long) ToByteArray ¶
ToByteArray returns value as []byte
func (*Long) ToIntArray ¶
ToIntArray returns value as []int32
func (*Long) ToLongArray ¶ added in v1.2.0
ToLongArray returns value as []int64
type LongArray ¶ added in v1.2.0
type LongArray struct { Value []int64 // contains filtered or unexported fields }
LongArray is a tag for a array of longs
func NewLongArrayTag ¶ added in v1.2.2
NewLongArrayTag returns a new LongArray tag
func (*LongArray) ToByteArray ¶ added in v1.2.0
ToByteArray returns value as []byte
func (*LongArray) ToIntArray ¶ added in v1.2.1
ToIntArray returns value as []int32
func (*LongArray) ToLongArray ¶ added in v1.2.0
ToLongArray returns value as []int64
type Short ¶
type Short struct { Value int16 // contains filtered or unexported fields }
Short is a tag for a short
func NewShortTag ¶ added in v1.2.2
NewShortTag returns a new Short tag
func (*Short) ToByteArray ¶
ToByteArray returns value as []byte
func (*Short) ToIntArray ¶
ToIntArray returns value as []int32
func (*Short) ToLongArray ¶ added in v1.2.0
ToLongArray returns value as []int64
type Stream ¶
type Stream struct { Stream *binary.OrderStream Payload int }
Stream is binary nbt stream
func FromBytes ¶ added in v1.2.0
FromBytes returns new stream with bytes If the bytes is compressed, it will uncompresses
func FromFile ¶
FromFile returns new stream from file If the bytes is compressed, it will uncompresses
func FromReader ¶
FromReader returns new stream from Reader If the bytes is compressed, it will uncompresses
func NewStreamBytes ¶
NewStreamBytes returns new Stream with bytes data
func (*Stream) GetPayload ¶ added in v1.2.3
type String ¶
type String struct { Value string // contains filtered or unexported fields }
String is a tag for string
func NewStringTag ¶ added in v1.2.2
NewStringTag returns a new String tag
func (*String) ToByteArray ¶
ToByteArray returns value as []byte
func (*String) ToIntArray ¶
ToIntArray returns value as []int32
func (*String) ToLongArray ¶ added in v1.2.0
ToLongArray returns value as []int64
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) // ToLongArray returns value as []int64 ToLongArray() ([]int64, error) }
Tag is a nbt tag interface