Documentation ¶
Index ¶
- Constants
- func DefaultJsonCodec() codec.Codec
- func JsonCodec(protocol proto.Protocol) codec.Codec
- func LatestJsonCodec() codec.Codec
- func Marshal(protocol proto.Protocol, c component.Component) ([]byte, error)
- func MarshalPlain(c component.Component) (string, error)
- func PReadBool(r io.Reader, b *bool)
- func PReadByte(rd io.Reader, b *byte)
- func PReadByteVal(rd io.Reader) byte
- func PReadBytes(rd io.Reader, b *[]byte)
- func PReadBytesVal(rd io.Reader) []byte
- func PReadInt(r io.Reader, i *int)
- func PReadInt64(r io.Reader, i *int64)
- func PReadInt64Val(rd io.Reader) int64
- func PReadString(rd io.Reader, s *string)
- func PReadStringMax(rd io.Reader, s *string, max int)
- func PReadStringVal(rd io.Reader) string
- func PReadStrings(r io.Reader, i *[]string)
- func PReadUint8(rd io.Reader, i *uint8)
- func PVarInt(rd io.Reader, i *int)
- func PWriteBool(w io.Writer, b bool)
- func PWriteByte(w io.Writer, b byte)
- func PWriteBytes(wr io.Writer, b []byte)
- func PWriteCompoundBinaryTag(w io.Writer, protocol proto.Protocol, cbt CompoundBinaryTag)
- func PWriteInt(w io.Writer, i int)
- func PWriteInt64(w io.Writer, i int64)
- func PWriteString(wr io.Writer, s string)
- func PWriteStrings(w io.Writer, s []string)
- func PWriteVarInt(wr io.Writer, i int)
- 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 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 ReadKey(rd io.Reader) (key.Key, error)
- func ReadKeyArray(rd io.Reader) ([]key.Key, 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 ReadUUIDIntArray(rd io.Reader) (uuid.UUID, 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 ReadVarIntArray(rd io.Reader) ([]int, error)
- func Recover(err *error)
- func RecoverFunc(fn func() error) (err error)
- func WriteBinaryTag(w io.Writer, protocol proto.Protocol, bt BinaryTag) 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 WriteKey(wr io.Writer, k key.Key) error
- func WriteKeyArray(wr io.Writer, keys []key.Key) 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 WriteUUIDIntArray(wr io.Writer, id 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 WriteVarIntArray(wr io.Writer, array []int) error
- func WriteVarIntN(writer io.Writer, val int) (n int, err error)
- type BinaryTag
- type CompoundBinaryTag
- type PReader
- func (r *PReader) Bool(b *bool)
- func (r *PReader) Byte(b *byte)
- func (r *PReader) Bytes(b *[]byte)
- func (r *PReader) Int(i *int)
- func (r *PReader) Int64(i *int64)
- func (r *PReader) Ok() bool
- func (r *PReader) String(s *string)
- func (r *PReader) StringMax(s *string, max int)
- func (r *PReader) Strings(i *[]string)
- func (r *PReader) Uint8(i *uint8)
- func (r *PReader) VarInt(i *int)
- type PWriter
- func (w *PWriter) Bool(b bool)
- func (w *PWriter) Byte(b byte)
- func (w *PWriter) Bytes(b []byte)
- func (w *PWriter) CompoundBinaryTag(cbt CompoundBinaryTag, protocol proto.Protocol)
- func (w *PWriter) Int(i int)
- func (w *PWriter) Int64(i int64)
- func (w *PWriter) String(s string)
- func (w *PWriter) Strings(s []string)
- func (w *PWriter) VarInt(i int)
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 PReadByteVal ¶ added in v0.35.0
func PReadBytes ¶ added in v0.35.0
func PReadBytesVal ¶ added in v0.35.0
func PReadInt64 ¶ added in v0.35.0
func PReadInt64Val ¶ added in v0.35.0
func PReadString ¶ added in v0.35.0
func PReadStringVal ¶ added in v0.35.0
func PReadStrings ¶ added in v0.35.0
func PReadUint8 ¶ added in v0.36.0
func PWriteBool ¶ added in v0.35.0
func PWriteByte ¶ added in v0.35.0
func PWriteBytes ¶ added in v0.35.0
func PWriteCompoundBinaryTag ¶ added in v0.35.0
func PWriteCompoundBinaryTag(w io.Writer, protocol proto.Protocol, cbt CompoundBinaryTag)
func PWriteInt64 ¶ added in v0.35.0
func PWriteString ¶ added in v0.35.0
func PWriteStrings ¶ added in v0.35.0
func PWriteVarInt ¶ added in v0.35.0
func ReadBytes17 ¶
ReadBytes17 reads bytes with the Minecraft 1.7 style length.
func ReadExtendedForgeShort ¶
ReadExtendedForgeShort reads a Minecraft-style extended short from the specified {@code buf}.
func ReadKey ¶ added in v0.35.0
ReadKey reads a standard Mojang Text namespaced:key from the reader.
func ReadKeyArray ¶ added in v0.35.0
ReadKeyArray reads a standard Mojang Text namespaced:key array from the reader.
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 ReadVarIntArray ¶ added in v0.35.0
ReadVarIntArray reads a VarInt array from the reader.
func Recover ¶ added in v0.35.0
func Recover(err *error)
Recover is a helper function to recover from a panic and set the error pointer to the recovered error. If the panic is not an error, it will be re-panicked.
Usage:
func fn() (err error) { defer Recover(&err) // code that may panic(err) }
func RecoverFunc ¶ added in v0.35.0
RecoverFunc is a helper function to recover from a panic and set the error pointer to the recovered error. If the panic is not an error, it will be re-panicked.
Usage:
return RecoverFunc(func() error { // code that may panic(err) })
func WriteBinaryTag ¶ added in v0.35.0
WriteBinaryTag writes a binary tag to the provided writer.
func WriteComponent ¶ added in v0.19.0
func WriteKey ¶ added in v0.35.0
WriteKey writes a standard Mojang Text namespaced:key to the writer.
func WriteKeyArray ¶ added in v0.35.0
WriteKeyArray writes a standard Mojang Text namespaced:key array to the writer.
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)
func WriteUint8N ¶ added in v0.19.1
func WriteVarIntArray ¶ added in v0.35.0
WriteVarIntArray writes a variable-length integer array to the writer.
Types ¶
type CompoundBinaryTag ¶ added in v0.35.0
type CompoundBinaryTag = BinaryTag
CompoundBinaryTag is a compound binary tag.
func ReadCompoundTag ¶ added in v0.35.0
ReadCompoundTag reads a compound binary tag from the provided reader.
type PReader ¶ added in v0.35.0
type PReader struct {
// contains filtered or unexported fields
}
func PanicReader ¶ added in v0.35.0
type PWriter ¶ added in v0.35.0
type PWriter struct {
// contains filtered or unexported fields
}
func PanicWriter ¶ added in v0.35.0
func (*PWriter) CompoundBinaryTag ¶ added in v0.35.0
func (w *PWriter) CompoundBinaryTag(cbt CompoundBinaryTag, protocol proto.Protocol)