Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Handshake = NewRegistry(HandshakeState) Status = NewRegistry(StatusState) Config = NewRegistry(ConfigState) Login = NewRegistry(LoginState) Play = NewRegistry(PlayState) )
The registries storing the packets for a connection state.
Functions ¶
This section is empty.
Types ¶
type PacketMapping ¶
type PacketRegistry ¶
type PacketRegistry struct { Direction proto.Direction // The direction the registered packets are send to. Protocols map[proto.Protocol]*ProtocolRegistry // The protocol versions. // Whether to fallback to the minimum protocol version // in case a protocol could not be found. Fallback bool }
PacketRegistry stores packets protocol versions sent to server or client.
func NewPacketRegistry ¶
func NewPacketRegistry(direction proto.Direction) *PacketRegistry
func (*PacketRegistry) ProtocolRegistry ¶
func (p *PacketRegistry) ProtocolRegistry(protocol proto.Protocol) *ProtocolRegistry
ProtocolRegistry gets the ProtocolRegistry for a protocol.
func (*PacketRegistry) Register ¶
func (p *PacketRegistry) Register(packetOf proto.Packet, mappings ...*PacketMapping)
Register registers a packet type with the corresponding protocol versions for each mapping.
type ProtocolRegistry ¶
type ProtocolRegistry struct { Protocol proto.Protocol // The protocol version of the registered packets. PacketIDs map[proto.PacketID]proto.PacketType // Gets packet type by packet id. PacketTypes map[proto.PacketType]proto.PacketID // Gets packet id by packet type. }
ProtocolRegistry stores packets of a protocol version.
func FromDirection ¶
func (*ProtocolRegistry) CreatePacket ¶
func (r *ProtocolRegistry) CreatePacket(id proto.PacketID) proto.Packet
CreatePacket returns a new zero valued instance of the type of the mapped packet id or nil if not found.
type Registry ¶
type Registry struct { State ServerBound *PacketRegistry ClientBound *PacketRegistry }
Registry stores server/client bound packets for a specific State.
func NewRegistry ¶
NewRegistry returns a new state registry.
type State ¶
type State int
State is a Java edition client state.
Click to show internal directories.
Click to hide internal directories.