encoding

package
v0.0.0-...-ed75f63 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package encoding provides encoding and decoding of minecraft data types

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendByte

func AppendByte(data []byte, b int8) []byte

func AppendInt

func AppendInt(data []byte, i int32) []byte

func AppendLong

func AppendLong(data []byte, l int64) []byte

func AppendShort

func AppendShort(data []byte, s int16) []byte

func AppendString

func AppendString(data []byte, str string) []byte

func AppendUbyte

func AppendUbyte(data []byte, b byte) []byte

func AppendUshort

func AppendUshort(data []byte, s uint16) []byte

func AppendVarInt

func AppendVarInt(data []byte, value int32) []byte

func AppendVarLong

func AppendVarLong(data []byte, value int64) []byte

func PutVarInt

func PutVarInt(data []byte, value int32) (n int)

func ReadVarInt

func ReadVarInt(r io.Reader) (int32, error)

func String

func String(data []byte) (string, error)

func VarInt

func VarInt(data []byte) (int32, []byte, error)

func WriteVarInt

func WriteVarInt(w io.Writer, value int32) error

Types

type BitSet

type BitSet []int64

func (BitSet) Get

func (set BitSet) Get(i int) bool

func (BitSet) Set

func (set BitSet) Set(i int)

func (BitSet) Unset

func (set BitSet) Unset(i int)

type FixedBitSet

type FixedBitSet []byte

func (FixedBitSet) Get

func (set FixedBitSet) Get(i int) bool

func (FixedBitSet) Set

func (set FixedBitSet) Set(i int)

func (FixedBitSet) Unset

func (set FixedBitSet) Unset(i int)

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

func NewReader

func NewReader(r io.Reader, length int) Reader

func (Reader) BitSet

func (r Reader) BitSet(data *BitSet) error

func (Reader) Bool

func (r Reader) Bool(b *bool) error

func (Reader) Byte

func (r Reader) Byte(i *int8) error

func (Reader) ByteArray

func (r Reader) ByteArray(s *[]byte) error

Length prefixed byte array

func (Reader) Double

func (r Reader) Double(f *float64) error

func (Reader) FixedBitSet

func (r Reader) FixedBitSet(data *FixedBitSet, bits int32) error

func (Reader) FixedByteArray

func (r Reader) FixedByteArray(s []byte) error

func (Reader) Float

func (r Reader) Float(f *float32) error

func (Reader) Identifier

func (r Reader) Identifier(s *string) error

func (Reader) Int

func (r Reader) Int(i *int32) error

func (Reader) JSONTextComponent

func (r Reader) JSONTextComponent(comp *text.TextComponent) error

func (Reader) Long

func (r Reader) Long(i *int64) error

func (Reader) NBT

func (r Reader) NBT(v any) error

func (Reader) Position

func (r Reader) Position(x, y, z *int32) error

func (Reader) Read

func (r Reader) Read(dst []byte) (i int, err error)

func (Reader) ReadAll

func (r Reader) ReadAll(data *[]byte) (err error)

func (*Reader) SetLength

func (r *Reader) SetLength(length int)

func (Reader) Short

func (r Reader) Short(i *int16) error

func (Reader) String

func (r Reader) String(s *string) error

func (Reader) TextComponent

func (r Reader) TextComponent(comp *text.TextComponent) error

func (Reader) UUID

func (r Reader) UUID(u *uuid.UUID) error

func (Reader) Ubyte

func (r Reader) Ubyte(i *byte) error

func (Reader) Ushort

func (r Reader) Ushort(i *uint16) error

func (Reader) VarInt

func (r Reader) VarInt(value *int32) (i int, err error)

func (Reader) VarLong

func (r Reader) VarLong(value *int64) error

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(w *bytes.Buffer) Writer

func (Writer) BitSet

func (w Writer) BitSet(data BitSet) error

func (Writer) Bool

func (w Writer) Bool(b bool) error

func (Writer) Byte

func (w Writer) Byte(i int8) error

func (Writer) ByteArray

func (w Writer) ByteArray(s []byte) error

Length prefixed byte array

func (Writer) Double

func (w Writer) Double(f float64) error

func (Writer) FixedBitSet

func (w Writer) FixedBitSet(data FixedBitSet) error

func (Writer) FixedByteArray

func (w Writer) FixedByteArray(s []byte) error

func (Writer) Float

func (w Writer) Float(f float32) error

func (Writer) Identifier

func (w Writer) Identifier(s string) error

func (Writer) Int

func (w Writer) Int(i int32) error

func (Writer) JSONTextComponent

func (w Writer) JSONTextComponent(comp text.TextComponent) error

func (Writer) Long

func (w Writer) Long(i int64) error

func (Writer) NBT

func (w Writer) NBT(data any) error

func (Writer) Position

func (w Writer) Position(x, y, z int32) error

func (Writer) Short

func (w Writer) Short(i int16) error

func (Writer) String

func (w Writer) String(s string) error

func (Writer) StringTextComponent

func (w Writer) StringTextComponent(text string) error

func (Writer) TextComponent

func (w Writer) TextComponent(comp text.TextComponent) error

func (Writer) UUID

func (w Writer) UUID(u uuid.UUID) error

func (Writer) Ubyte

func (w Writer) Ubyte(i uint8) error

func (Writer) Ushort

func (w Writer) Ushort(i uint16) error

func (Writer) VarInt

func (w Writer) VarInt(value int32) error

func (Writer) VarLong

func (w Writer) VarLong(value int64) error

func (Writer) Write

func (w Writer) Write(data []byte) (i int, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳