packets

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MinecraftPacket

type MinecraftPacket struct {
	// PacketID is a VarInt identifier of the packet
	// refer to wiki.vg for all the packet ids
	PacketID int32

	Data *bytes.Buffer
}

Basic struct containing the PacketID and many methods for serialization.

Compliant to the PacketOP interface

func (*MinecraftPacket) DeserializeData

func (p *MinecraftPacket) DeserializeData(inter interface{}) error

DeserializeData deserializes the data buffer into the struct fields which have a type struct tag

func (*MinecraftPacket) Serialize

func (p *MinecraftPacket) Serialize(compressionTreshold int32) ([]byte, error)

When compressionTreshold is a value below zero the packet gets serialized with the "Without Compression" format. This happens when a server never sent a set compression packet

func (*MinecraftPacket) SerializeData

func (p *MinecraftPacket) SerializeData(inter interface{}) error

SerializeData serializes all the fields in the struct with a type struct tag into the data buffer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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