datatypes

package
v0.0.0-...-f0cfbad Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrVarIntTooLarge = errors.New("minecomm: varint too large")
View Source
var ErrVarLongTooLarge = errors.New("minecomm: varlong too large")

Functions

func DecodeVarInt

func DecodeVarInt(reader io.Reader) (result int32, numRead int, err error)

func DecodeVarLong

func DecodeVarLong(reader io.Reader) (result int64, numRead int, err error)

func EncodeVarInt

func EncodeVarInt(input int32) (varint []byte, n int)

EncodeVarInt takes an int32 and encodes it into an array of bytes of n size as specified on https://wiki.vg/Data_types#VarInt_and_VarLong

func EncodeVarLong

func EncodeVarLong(inputValue int64) (varint []byte, n int)

EncodeVarLong takes an in64, and encodes it into an array of bytes of size n as specified on https://wiki.vg/Data_types#VarInt_and_VarLong

Types

type Position

type Position struct {
	X int32 `mc:"x" json:"x"`
	Y int16 `mc:"y" json:"y"`
	Z int32 `mc:"z" json:"z"`
}

Position represents a 3D position in the Minecraft world

func Decode

func Decode(data []byte) *Position

Decode converts a 64-bit binary representation to a Position

func (*Position) Encode

func (p *Position) Encode() []byte

Encode converts a Position to its 64-bit representation

Jump to

Keyboard shortcuts

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