Documentation ¶
Index ¶
- Constants
- func BlockPosition(src *bytes.Buffer, x *BlockPos) error
- func Float32(src *bytes.Buffer, x *float32) error
- func GameRules(src *bytes.Buffer, x *map[string]interface{}) error
- func String(src *bytes.Buffer, x *string) error
- func UBlockPosition(src *bytes.Buffer, x *BlockPos) error
- func Varint32(src *bytes.Buffer, x *int32) error
- func Varint64(src *bytes.Buffer, x *int64) error
- func Varuint32(src *bytes.Buffer, x *uint32) error
- func Varuint64(src *bytes.Buffer, x *uint64) error
- func Vec3(src *bytes.Buffer, x *mgl32.Vec3) error
- func WriteBlockPosition(dst *bytes.Buffer, x BlockPos) error
- func WriteFloat32(dst *bytes.Buffer, x float32) error
- func WriteGameRules(dst *bytes.Buffer, x map[string]interface{}) error
- func WriteString(dst *bytes.Buffer, x string) error
- func WriteUBlockPosition(dst *bytes.Buffer, x BlockPos) error
- func WriteVarint32(dst *bytes.Buffer, x int32) error
- func WriteVarint64(dst *bytes.Buffer, x int64) error
- func WriteVaruint32(dst *bytes.Buffer, x uint32) error
- func WriteVaruint64(dst *bytes.Buffer, x uint64) error
- func WriteVec3(dst *bytes.Buffer, x mgl32.Vec3) error
- type BlockPos
Constants ¶
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
BlockPosition reads a BlockPos from Buffer src and stores it to the BlockPos pointer passed.
func Float32 ¶ added in v0.1.0
Float32 reads a float32 from Buffer src, setting the result to the pointer to a float32 passed.
func GameRules ¶ added in v0.1.0
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
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
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 ¶
Varint32 reads up to 5 bytes from the source buffer passed and sets the integer produced to a pointer.
func Varint64 ¶
Varint64 reads up to 10 bytes from the source buffer passed and sets the integer produced to a pointer.
func Varuint32 ¶
Varuint32 reads up to 5 bytes from the source buffer passed and sets the integer produced to a pointer.
func Varuint64 ¶
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
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
WriteBlockPosition writes a BlockPos x to Buffer dst, composed of 3 varint32s.
func WriteFloat32 ¶ added in v0.1.0
WriteFloat32 writes a float32 to Buffer dst, by first converting it to a uint32.
func WriteGameRules ¶ added in v0.1.0
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
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
WriteUBlockPosition writes an unsigned BlockPos x to Buffer dst, composed of a varint32, varuint32 and a varint32.
func WriteVarint32 ¶
WriteVarint32 writes an int32 to the destination buffer passed with a size of 1-5 bytes.
func WriteVarint64 ¶
WriteVarint64 writes an int64 to the destination buffer passed with a size of 1-10 bytes.
func WriteVaruint32 ¶
WriteVaruint32 writes a uint32 to the destination buffer passed with a size of 1-5 bytes.
func WriteVaruint64 ¶
WriteVaruint64 writes a uint64 to the destination buffer passed with a size of 1-10 bytes.
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 ¶
X returns the X coordinate of the block position. It is equivalent to BlockPos[0].