nbt

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2024 License: AGPL-3.0 Imports: 9 Imported by: 23

Documentation

Index

Constants

View Source
const (
	NbtUnknown   = -1
	NbtEnd       = 0x00
	NbtByte      = 0x01
	NbtShort     = 0x02
	NbtInt       = 0x03
	NbtLong      = 0x04
	NbtFloat     = 0x05
	NbtDouble    = 0x06
	NbtByteArray = 0x07
	NbtString    = 0x08
	NbtList      = 0x09
	NbtCompound  = 0x0a
	NbtIntArray  = 0x0b
	NbtLongArray = 0x0c
)

Variables

View Source
var NBTNewer = map[Byte]func() NBT{
	NbtEnd:       func() NBT { return _NBTEndIns },
	NbtByte:      func() NBT { return new(NBTByte) },
	NbtShort:     func() NBT { return new(NBTShort) },
	NbtInt:       func() NBT { return new(NBTInt) },
	NbtLong:      func() NBT { return new(NBTLong) },
	NbtFloat:     func() NBT { return new(NBTFloat) },
	NbtDouble:    func() NBT { return new(NBTDouble) },
	NbtByteArray: func() NBT { return new(NBTByteArray) },
	NbtString:    func() NBT { return new(NBTString) },
	NbtList:      func() NBT { return new(NBTList) },
	NbtCompound:  func() NBT { return new(NBTCompound) },
	NbtIntArray:  func() NBT { return new(NBTIntArray) },
	NbtLongArray: func() NBT { return new(NBTLongArray) },
}

Functions

func DecodeUtf8m

func DecodeUtf8m(str []byte) string

Decode Java modified UTF8 to normal UTF8 string

func EncodeUtf8m

func EncodeUtf8m(str string) (out []byte)

Encode a UTF8 string to Java modified UTF8

func WriteNBT

func WriteNBT(b *PacketBuilder, n NBT)

Types

type Byte

type Byte = liter.Byte

type ByteArray

type ByteArray = liter.ByteArray

type Decompressor

type Decompressor = func(in []byte) (out []byte, ok bool)

type Double

type Double = liter.Double

type Float

type Float = liter.Float

type Int

type Int = liter.Int

type Long

type Long = liter.Long

type NBT

type NBT interface {
	Type() Byte
	Name() string
	SetName(name string)

	fmt.Stringer
	liter.Encodable
	liter.Decodable
}

func ParseFromBytes

func ParseFromBytes(buf []byte) (nbt NBT, err error)

func ReadNBT

func ReadNBT(r *PacketReader) (n NBT, err error)

type NBTByte

type NBTByte struct {
	Data Byte
	// contains filtered or unexported fields
}

func (*NBTByte) DecodeFrom

func (n *NBTByte) DecodeFrom(r *PacketReader) (err error)

func (*NBTByte) Encode

func (n *NBTByte) Encode(b *PacketBuilder)

func (*NBTByte) Name

func (n *NBTByte) Name() string

func (*NBTByte) SetName

func (n *NBTByte) SetName(name string)

func (*NBTByte) String

func (n *NBTByte) String() string

func (*NBTByte) Type

func (n *NBTByte) Type() Byte

type NBTByteArray

type NBTByteArray struct {
	Data ByteArray
	// contains filtered or unexported fields
}

func (*NBTByteArray) DecodeFrom

func (n *NBTByteArray) DecodeFrom(r *PacketReader) (err error)

func (*NBTByteArray) Encode

func (n *NBTByteArray) Encode(b *PacketBuilder)

func (*NBTByteArray) Name

func (n *NBTByteArray) Name() string

func (*NBTByteArray) SetName

func (n *NBTByteArray) SetName(name string)

func (*NBTByteArray) String

func (n *NBTByteArray) String() string

func (*NBTByteArray) Type

func (n *NBTByteArray) Type() Byte

type NBTCompound

type NBTCompound struct {
	Data []NBT
	// contains filtered or unexported fields
}

func (*NBTCompound) DecodeFrom

func (n *NBTCompound) DecodeFrom(r *PacketReader) (err error)

func (*NBTCompound) Encode

func (n *NBTCompound) Encode(b *PacketBuilder)

func (*NBTCompound) Get

func (n *NBTCompound) Get(name string) NBT

func (*NBTCompound) Name

func (n *NBTCompound) Name() string

func (*NBTCompound) Set

func (n *NBTCompound) Set(name string, tag NBT)

func (*NBTCompound) SetName

func (n *NBTCompound) SetName(name string)

func (*NBTCompound) String

func (n *NBTCompound) String() string

func (*NBTCompound) Type

func (n *NBTCompound) Type() Byte

type NBTDouble

type NBTDouble struct {
	Data Double
	// contains filtered or unexported fields
}

func (*NBTDouble) DecodeFrom

func (n *NBTDouble) DecodeFrom(r *PacketReader) (err error)

func (*NBTDouble) Encode

func (n *NBTDouble) Encode(b *PacketBuilder)

func (*NBTDouble) Name

func (n *NBTDouble) Name() string

func (*NBTDouble) SetName

func (n *NBTDouble) SetName(name string)

func (*NBTDouble) String

func (n *NBTDouble) String() string

func (*NBTDouble) Type

func (n *NBTDouble) Type() Byte

type NBTEnd

type NBTEnd struct{}

func (*NBTEnd) DecodeFrom

func (n *NBTEnd) DecodeFrom(r *PacketReader) error

func (*NBTEnd) Encode

func (n *NBTEnd) Encode(b *PacketBuilder)

func (*NBTEnd) Name

func (n *NBTEnd) Name() string

func (*NBTEnd) SetName

func (n *NBTEnd) SetName(name string)

func (*NBTEnd) String

func (n *NBTEnd) String() string

func (*NBTEnd) Type

func (n *NBTEnd) Type() Byte

type NBTFloat

type NBTFloat struct {
	Data Float
	// contains filtered or unexported fields
}

func (*NBTFloat) DecodeFrom

func (n *NBTFloat) DecodeFrom(r *PacketReader) (err error)

func (*NBTFloat) Encode

func (n *NBTFloat) Encode(b *PacketBuilder)

func (*NBTFloat) Name

func (n *NBTFloat) Name() string

func (*NBTFloat) SetName

func (n *NBTFloat) SetName(name string)

func (*NBTFloat) String

func (n *NBTFloat) String() string

func (*NBTFloat) Type

func (n *NBTFloat) Type() Byte

type NBTIdNotExistsErr

type NBTIdNotExistsErr struct {
	Id Byte
}

func (*NBTIdNotExistsErr) Error

func (e *NBTIdNotExistsErr) Error() string

type NBTInt

type NBTInt struct {
	Data Int
	// contains filtered or unexported fields
}

func (*NBTInt) DecodeFrom

func (n *NBTInt) DecodeFrom(r *PacketReader) (err error)

func (*NBTInt) Encode

func (n *NBTInt) Encode(b *PacketBuilder)

func (*NBTInt) Name

func (n *NBTInt) Name() string

func (*NBTInt) SetName

func (n *NBTInt) SetName(name string)

func (*NBTInt) String

func (n *NBTInt) String() string

func (*NBTInt) Type

func (n *NBTInt) Type() Byte

type NBTIntArray

type NBTIntArray struct {
	Data []Int
	// contains filtered or unexported fields
}

func (*NBTIntArray) DecodeFrom

func (n *NBTIntArray) DecodeFrom(r *PacketReader) (err error)

func (*NBTIntArray) Encode

func (n *NBTIntArray) Encode(b *PacketBuilder)

func (*NBTIntArray) Name

func (n *NBTIntArray) Name() string

func (*NBTIntArray) SetName

func (n *NBTIntArray) SetName(name string)

func (*NBTIntArray) String

func (n *NBTIntArray) String() string

func (*NBTIntArray) Type

func (n *NBTIntArray) Type() Byte

type NBTList

type NBTList struct {
	Data []NBT
	// contains filtered or unexported fields
}

func (*NBTList) DecodeFrom

func (n *NBTList) DecodeFrom(r *PacketReader) (err error)

func (*NBTList) Elem

func (n *NBTList) Elem() Byte

func (*NBTList) Encode

func (n *NBTList) Encode(b *PacketBuilder)

func (*NBTList) Name

func (n *NBTList) Name() string

func (*NBTList) SetName

func (n *NBTList) SetName(name string)

func (*NBTList) String

func (n *NBTList) String() string

func (*NBTList) Type

func (n *NBTList) Type() Byte

type NBTLong

type NBTLong struct {
	Data Long
	// contains filtered or unexported fields
}

func (*NBTLong) DecodeFrom

func (n *NBTLong) DecodeFrom(r *PacketReader) (err error)

func (*NBTLong) Encode

func (n *NBTLong) Encode(b *PacketBuilder)

func (*NBTLong) Name

func (n *NBTLong) Name() string

func (*NBTLong) SetName

func (n *NBTLong) SetName(name string)

func (*NBTLong) String

func (n *NBTLong) String() string

func (*NBTLong) Type

func (n *NBTLong) Type() Byte

type NBTLongArray

type NBTLongArray struct {
	Data []Long
	// contains filtered or unexported fields
}

func (*NBTLongArray) DecodeFrom

func (n *NBTLongArray) DecodeFrom(r *PacketReader) (err error)

func (*NBTLongArray) Encode

func (n *NBTLongArray) Encode(b *PacketBuilder)

func (*NBTLongArray) Name

func (n *NBTLongArray) Name() string

func (*NBTLongArray) SetName

func (n *NBTLongArray) SetName(name string)

func (*NBTLongArray) String

func (n *NBTLongArray) String() string

func (*NBTLongArray) Type

func (n *NBTLongArray) Type() Byte

type NBTShort

type NBTShort struct {
	Data Short
	// contains filtered or unexported fields
}

func (*NBTShort) DecodeFrom

func (n *NBTShort) DecodeFrom(r *PacketReader) (err error)

func (*NBTShort) Encode

func (n *NBTShort) Encode(b *PacketBuilder)

func (*NBTShort) Name

func (n *NBTShort) Name() string

func (*NBTShort) SetName

func (n *NBTShort) SetName(name string)

func (*NBTShort) String

func (n *NBTShort) String() string

func (*NBTShort) Type

func (n *NBTShort) Type() Byte

type NBTString

type NBTString struct {
	Data String
	// contains filtered or unexported fields
}

func (*NBTString) DecodeFrom

func (n *NBTString) DecodeFrom(r *PacketReader) (err error)

func (*NBTString) Encode

func (n *NBTString) Encode(b *PacketBuilder)

func (*NBTString) Name

func (n *NBTString) Name() string

func (*NBTString) SetName

func (n *NBTString) SetName(name string)

func (*NBTString) String

func (n *NBTString) String() string

func (*NBTString) Type

func (n *NBTString) Type() Byte

type PacketBuilder

type PacketBuilder = liter.PacketBuilder

type PacketReader

type PacketReader = liter.PacketReader

type Short

type Short = liter.Short

type String

type String = liter.String

type UByte

type UByte = liter.UByte

type UShort

type UShort = liter.UShort

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL