protocol

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2019 License: MIT Imports: 7 Imported by: 197

Documentation

Index

Constants

View Source
const (
	// CurrentProtocol is the current protocol version for the version below.
	CurrentProtocol = 354
	// CurrentVersion is the current version of Minecraft as supported by the `packet` package.
	CurrentVersion = "1.11.1"
)

Variables

This section is empty.

Functions

func BlockPosition added in v0.1.0

func BlockPosition(src *bytes.Buffer, x *BlockPos) error

BlockPosition reads a BlockPos from Buffer src and stores it to the BlockPos pointer passed.

func Float32 added in v0.1.0

func Float32(src *bytes.Buffer, x *float32) error

Float32 reads a float32 from Buffer src, setting the result to the pointer to a float32 passed.

func GameRules added in v0.1.0

func GameRules(src *bytes.Buffer, x *map[string]interface{}) error

GameRules reads a map of game rules from Buffer src. It sets one of the types 'bool', 'float32' or 'uint32' to the map x, with the key being the name of the game rule.

func String added in v0.1.0

func String(src *bytes.Buffer, x *string) error

String reads a string from Buffer src, setting the result to the pointer to a string passed. The string read is prefixed by a varuint32.

func UBlockPosition added in v0.1.0

func UBlockPosition(src *bytes.Buffer, x *BlockPos) error

UBlockPosition reads an unsigned BlockPos from Buffer src and stores it to the BlockPos pointer passed. The difference between this and BlockPosition is that the Y coordinate is read as a varuint32.

func Varint32

func Varint32(src *bytes.Buffer, x *int32) error

Varint32 reads up to 5 bytes from the source buffer passed and sets the integer produced to a pointer.

func Varint64

func Varint64(src *bytes.Buffer, x *int64) error

Varint64 reads up to 10 bytes from the source buffer passed and sets the integer produced to a pointer.

func Varuint32

func Varuint32(src *bytes.Buffer, x *uint32) error

Varuint32 reads up to 5 bytes from the source buffer passed and sets the integer produced to a pointer.

func Varuint64

func Varuint64(src *bytes.Buffer, x *uint64) error

Varuint64 reads up to 10 bytes from the source buffer passed and sets the integer produced to a pointer.

func Vec3 added in v0.1.0

func Vec3(src *bytes.Buffer, x *mgl32.Vec3) error

Vec3 reads an mgl32.Vec3 (float32 vector) from Buffer src, setting the result to the pointer to an mgl32.Vec3 passed.

func WriteBlockPosition added in v0.1.0

func WriteBlockPosition(dst *bytes.Buffer, x BlockPos) error

WriteBlockPosition writes a BlockPos x to Buffer dst, composed of 3 varint32s.

func WriteFloat32 added in v0.1.0

func WriteFloat32(dst *bytes.Buffer, x float32) error

WriteFloat32 writes a float32 to Buffer dst, by first converting it to a uint32.

func WriteGameRules added in v0.1.0

func WriteGameRules(dst *bytes.Buffer, x map[string]interface{}) error

WriteGameRules writes a map of game rules x, indexed by their names to Buffer dst. The types of the map values must be either 'bool', 'float32' or 'uint32'. If one of the values has a different type, the function will panic.

func WriteString added in v0.1.0

func WriteString(dst *bytes.Buffer, x string) error

WriteString writes a string x to Buffer dst. The string is a slice of bytes prefixed by a varuint32 specifying its length.

func WriteUBlockPosition added in v0.1.0

func WriteUBlockPosition(dst *bytes.Buffer, x BlockPos) error

WriteUBlockPosition writes an unsigned BlockPos x to Buffer dst, composed of a varint32, varuint32 and a varint32.

func WriteVarint32

func WriteVarint32(dst *bytes.Buffer, x int32) error

WriteVarint32 writes an int32 to the destination buffer passed with a size of 1-5 bytes.

func WriteVarint64

func WriteVarint64(dst *bytes.Buffer, x int64) error

WriteVarint64 writes an int64 to the destination buffer passed with a size of 1-10 bytes.

func WriteVaruint32

func WriteVaruint32(dst *bytes.Buffer, x uint32) error

WriteVaruint32 writes a uint32 to the destination buffer passed with a size of 1-5 bytes.

func WriteVaruint64

func WriteVaruint64(dst *bytes.Buffer, x uint64) error

WriteVaruint64 writes a uint64 to the destination buffer passed with a size of 1-10 bytes.

func WriteVec3 added in v0.1.0

func WriteVec3(dst *bytes.Buffer, x mgl32.Vec3) error

WriteVec3 writes an mgl32.Vec3 (float32 vector) to Buffer dst, writing each of the float32s separately.

Types

type BlockPos

type BlockPos [3]int32

BlockPos is the position of a block. It is composed of three integers, and is typically written as either 3 varint32s or a varint32, varuint32 and varint32.

func (BlockPos) X

func (pos BlockPos) X() int32

X returns the X coordinate of the block position. It is equivalent to BlockPos[0].

func (BlockPos) Y

func (pos BlockPos) Y() int32

Y returns the Y coordinate of the block position. It is equivalent to BlockPos[1].

func (BlockPos) Z

func (pos BlockPos) Z() int32

Z returns the Z coordinate of the block position. It is equivalent to BlockPos[2].

Directories

Path Synopsis
jwt

Jump to

Keyboard shortcuts

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