Documentation ¶
Index ¶
- Constants
- func DefaultJsonCodec() codec.Codec
- func JsonCodec(protocol proto.Protocol) codec.Codec
- func LatestJsonCodec() codec.Codec
- func MarshalPlain(c component.Component) (string, error)
- func NewNBTDecoder(r io.Reader) *nbt.Decoder
- func NewNBTEncoder(w io.Writer) *nbt.Encoder
- func ReadBool(reader io.Reader) (val bool, err error)
- func ReadByte(reader io.Reader) (val byte, err error)
- func ReadBytes(rd io.Reader) ([]byte, error)
- func ReadBytes17(rd io.Reader) ([]byte, error)
- func ReadBytesLen(rd io.Reader, maxLength int) (bytes []byte, err error)
- func ReadComponent(rd io.Reader, protocol proto.Protocol) (component.Component, error)
- func ReadExtendedForgeShort(rd io.Reader) (int, error)
- func ReadFloat32(reader io.Reader) (val float32, err error)
- func ReadFloat64(reader io.Reader) (val float64, err error)
- func ReadInt(rd io.Reader) (int, error)
- func ReadInt16(reader io.Reader) (val int16, err error)
- func ReadInt32(reader io.Reader) (val int32, err error)
- func ReadInt64(reader io.Reader) (val int64, err error)
- func ReadInt8(reader io.Reader) (val int8, err error)
- func ReadIntArray(rd io.Reader) ([]int, error)
- func ReadProperties(rd io.Reader) (props []profile.Property, err error)
- func ReadRawBytes(rd io.Reader) ([]byte, error)
- func ReadString(rd io.Reader) (string, error)
- func ReadStringArray(rd io.Reader) ([]string, error)
- func ReadStringMax(rd io.Reader, max int) (string, error)
- func ReadStringWithoutLen(rd io.Reader) (string, error)
- func ReadUTF(rd io.Reader) (string, error)
- func ReadUUID(rd io.Reader) (id uuid.UUID, err error)
- func ReadUint16(reader io.Reader) (val uint16, err error)
- func ReadUint32(reader io.Reader) (val uint32, err error)
- func ReadUint64(reader io.Reader) (val uint64, err error)
- func ReadUint8(reader io.Reader) (val uint8, err error)
- func ReadUnixMilli(rd io.Reader) (time.Time, error)
- func ReadVarInt(r io.Reader) (result int, err error)
- func WriteBool(writer io.Writer, val bool) (err error)
- func WriteByte(writer io.Writer, val byte) (err error)
- func WriteBytes(wr io.Writer, b []byte) (err error)
- func WriteBytes17(wr io.Writer, b []byte, allowExtended bool) error
- func WriteComponent(wr io.Writer, protocol proto.Protocol, c component.Component) error
- func WriteExtendedForgeShort(wr io.Writer, toWrite int) (err error)
- func WriteFloat32(writer io.Writer, val float32) (err error)
- func WriteFloat64(writer io.Writer, val float64) (err error)
- func WriteInt(writer io.Writer, val int) (err error)
- func WriteInt16(writer io.Writer, val int16) (err error)
- func WriteInt32(writer io.Writer, val int32) (err error)
- func WriteInt64(writer io.Writer, val int64) (err error)
- func WriteInt8(writer io.Writer, val int8) (err error)
- func WriteNBT(w io.Writer, nbt NBT) error
- func WriteProperties(wr io.Writer, properties []profile.Property) error
- func WriteRawBytes(wr io.Writer, b []byte) (err error)
- func WriteString(writer io.Writer, val string) (err error)
- func WriteStrings(wr io.Writer, a []string) error
- func WriteUTF(wr io.Writer, s string) error
- func WriteUUID(wr io.Writer, uuid uuid.UUID) error
- func WriteUint16(writer io.Writer, val uint16) (err error)
- func WriteUint32(writer io.Writer, val uint32) (err error)
- func WriteUint64(writer io.Writer, val uint64) (err error)
- func WriteUint8(writer io.Writer, val uint8) (err error)
- func WriteUint8N(writer io.Writer, val uint8) (n int, err error)
- func WriteVarInt(writer io.Writer, val int) (err error)
- func WriteVarIntN(writer io.Writer, val int) (n int, err error)
- type NBT
- func (b NBT) Bool(name string) (bool, bool)
- func (b NBT) ByteArray(name string) (ret []byte, ok bool)
- func (b NBT) Float32(name string) (ret float32, ok bool)
- func (b NBT) Float64(name string) (ret float64, ok bool)
- func (b NBT) Int(name string) (int, bool)
- func (b NBT) Int16(name string) (ret int16, ok bool)
- func (b NBT) Int32(name string) (ret int32, ok bool)
- func (b NBT) Int32Array(name string) (ret []int32, ok bool)
- func (b NBT) Int64(name string) (ret int64, ok bool)
- func (b NBT) Int64Array(name string) (ret []int64, ok bool)
- func (b NBT) Int8(name string) (ret int8, ok bool)
- func (b NBT) List(name string) (ret []NBT, ok bool)
- func (b NBT) NBT(name string) (ret NBT, ok bool)
- func (b NBT) String(name string) (ret string, ok bool)
- func (b NBT) Uint8(name string) (ret uint8, ok bool)
- func (b NBT) Write(w io.Writer) error
Constants ¶
const (
DefaultMaxStringSize = bufio.MaxScanTokenSize
)
const ForgeMaxArrayLength = math.MaxInt32 & 0x1FFF9A
Variables ¶
This section is empty.
Functions ¶
func DefaultJsonCodec ¶
DefaultJsonCodec returns a legacy supportive codec.
func JsonCodec ¶
JsonCodec returns the appropriate codec for the given protocol version. This is used to constrain messages sent to older clients.
func LatestJsonCodec ¶
func MarshalPlain ¶ added in v0.19.0
MarshalPlain marshals a component into plain text. A component.Translation is formatted as "{key}".
func ReadBytes17 ¶
ReadBytes17 reads bytes with the Minecraft 1.7 style length.
func ReadComponent ¶ added in v0.19.0
func ReadExtendedForgeShort ¶
ReadExtendedForgeShort reads a Minecraft-style extended short from the specified {@code buf}.
func ReadRawBytes ¶ added in v0.15.1
Reads a non length prefixed string from the reader. This is necessary for parsing certain packets like the velocity login/hello packet (no length prefix).
func ReadStringWithoutLen ¶
ReadStringWithoutLen reads a non length-prefixed string from the Reader. We need this for the legacy 1.7 version, being inconsistent when sending the plugin message channel brand.
func WriteComponent ¶ added in v0.19.0
func WriteRawBytes ¶ added in v0.15.1
Writes a raw strema of bytes to a file with no length prefix. Necessary for the Velocity hello/login packet (it uses a non-standard packet format)
func WriteUUID ¶
Encoded as an unsigned 128-bit integer (or two unsigned 64-bit integers: the most significant 64 bits and then the least significant 64 bits)