protocol

package
v0.0.0-...-b9cfb1f Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddEntityEntry

type AddEntityEntry interface {
	GetUniqueId() int64
	GetRuntimeId() uint64
	GetEntityType() uint32
	GetPosition() r3.Vector
	GetMotion() r3.Vector
	GetRotation() data.Rotation
	GetAttributeMap() data.AttributeMap
	GetEntityData() map[uint32][]interface{}
}

type AddPlayerEntry

type AddPlayerEntry interface {
	AddEntityEntry
	GetDisplayName() string
	GetName() string
}

type Handler

type Handler interface {
	GetPriority() int
	SetPriority(int) bool
}

Handler is an interface satisfied by every packet handler.

type IPacketManager

type IPacketManager interface {
	GetIdList() info.PacketIdList
	GetHandlers(packet info.PacketName) [][]Handler
	GetHandlersById(id int) [][]Handler
	RegisterHandler(packet info.PacketName, handler Handler) bool
	DeregisterPacketHandlers(packet info.PacketName, priority int)
	GetPackets() map[int]func() packets.IPacket
	RegisterPacket(packetId int, packetFunc func() packets.IPacket)
	GetPacket(packetId int) packets.IPacket
	IsPacketRegistered(packetId int) bool

	GetAddEntity(AddEntityEntry) packets.IPacket
	GetAddPlayer(uuid.UUID, AddPlayerEntry) packets.IPacket
	GetChunkRadiusUpdated(int32) packets.IPacket
	GetCraftingData() packets.IPacket
	GetDisconnect(string, bool) packets.IPacket
	GetFullChunkData(*chunks.Chunk) packets.IPacket
	GetMovePlayer(uint64, r3.Vector, data.Rotation, byte, bool, uint64) packets.IPacket
	GetPlayerList(byte, map[string]PlayerListEntry) packets.IPacket
	GetPlayStatus(int32) packets.IPacket
	GetRemoveEntity(int64) packets.IPacket
	GetResourcePackChunkData(string, int32, int64, []byte) packets.IPacket
	GetResourcePackDataInfo(packs.Pack) packets.IPacket
	GetResourcePackInfo(bool, *packs.Stack, *packs.Stack) packets.IPacket
	GetResourcePackStack(bool, *packs.Stack, *packs.Stack) packets.IPacket
	GetServerHandshake(string) packets.IPacket
	GetSetEntityData(uint64, map[uint32][]interface{}) packets.IPacket
	GetStartGame(StartGameEntry, []byte) packets.IPacket
	GetText(types.Text) packets.IPacket
	GetTransfer(string, uint16) packets.IPacket
	GetUpdateAttributes(uint64, data.AttributeMap) packets.IPacket
	GetNetworkChunkPublisherUpdatePacket(position blocks.Position, radius uint32) packets.IPacket
	GetMoveEntity(uint64, r3.Vector, data.Rotation, byte, bool) packets.IPacket
	GetPlayerSkin(uuid2 uuid.UUID, skinId, geometryName, geometryData string, skinData, capeData []byte) packets.IPacket
	GetPlayerAction(runtimeId uint64, action int32, position blocks.Position, face int32) packets.IPacket
	GetAnimate(action int32, runtimeId uint64, float float32) packets.IPacket
	GetUpdateBlock(position blocks.Position, blockRuntimeId, dataLayerId uint32) packets.IPacket
}

type PacketManagerBase

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

PacketManagerBase is a struct providing the base for a PacketManagerBase. It provides utility functions for a basic PacketManagerBase implementation.

func NewPacketManagerBase

func NewPacketManagerBase(idList info.PacketIdList, packets map[int]func() packets.IPacket, handlers map[int][][]Handler) *PacketManagerBase

NewBase returns a new PacketManagerBase with the given PacketManagerBase number and packets.

func (*PacketManagerBase) DeregisterPacketHandlers

func (Base *PacketManagerBase) DeregisterPacketHandlers(packet info.PacketName, priority int)

DeregisterPackHandlers deregisters all packet handlers listening for packets with the given ID, on the given priority.

func (*PacketManagerBase) GetHandlers

func (Base *PacketManagerBase) GetHandlers(packet info.PacketName) [][]Handler

GetHandlers returns all handlers registered for the given packet name.

func (*PacketManagerBase) GetHandlersById

func (Base *PacketManagerBase) GetHandlersById(id int) [][]Handler

GetHandlersById returns all handlers registered on the given ID.

func (*PacketManagerBase) GetIdList

func (Base *PacketManagerBase) GetIdList() info.PacketIdList

GetIdList returns the packet name => Id list of the bedrock.

func (*PacketManagerBase) GetPacket

func (Base *PacketManagerBase) GetPacket(packetId int) packets.IPacket

GetPacket returns a packet with the given packet ID.

func (*PacketManagerBase) GetPackets

func (Base *PacketManagerBase) GetPackets() map[int]func() packets.IPacket

GetPackets returns a packet ID => packet function map containing all registered packets.

func (*PacketManagerBase) IsPacketRegistered

func (Base *PacketManagerBase) IsPacketRegistered(packetId int) bool

IsPacketRegistered checks if the PacketManagerBase has a packet with the given packet ID.

func (*PacketManagerBase) RegisterHandler

func (Base *PacketManagerBase) RegisterHandler(packet info.PacketName, handler Handler) bool

RegisterHandler registers a new packet handler to listen for packets with the given ID. This function uses the priority of the handler. Returns a bool indicating success.

func (*PacketManagerBase) RegisterPacket

func (Base *PacketManagerBase) RegisterPacket(packetId int, packetFunc func() packets.IPacket)

RegisterPacket registers a packet function with the given packet ID.

type PlayerListEntry

type PlayerListEntry interface {
	AddPlayerEntry
	GetXUID() string
	GetUUID() uuid.UUID
	GetSkinId() string
	GetSkinData() []byte
	GetCapeData() []byte
	GetGeometryName() string
	GetGeometryData() string
	GetPlatform() int32
}

type StartGameEntry

type StartGameEntry interface {
	GetRuntimeId() uint64
	GetUniqueId() int64
	GetPosition() r3.Vector
	GetDimension() *worlds.Dimension
}

Jump to

Keyboard shortcuts

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