Packets
Gate provides a comprehensive packet system for handling Minecraft protocol communication. Every packet implements theproto.Packet interface and supports version-aware encoding and decoding.
Packet Interface
All packets in Gate implement theproto.Packet interface:
PacketContext provides protocol version information, packet direction, and state information needed for version-specific handling.
Common Packet Types
Gate includes packets for all Minecraft protocol states:Handshake Packets
The handshake packet initiates the connection:Keep Alive Packets
Keep alive packets maintain the connection:- 1.12.2+: int64
- 1.8-1.12.1: varint
- Before 1.8: int32
Chat Packets
Chat messages use different packet structures based on version:Disconnect Packets
Disconnect packets terminate connections with a reason:Join Game Packets
Join game packets are sent when a player joins a world:Packet Encoding
Packets use protocol-aware encoding utilities fromgo.minekube.com/gate/pkg/edition/java/proto/util:
Common Encoding Functions
Packet Decoding
Decoding mirrors encoding with version-aware logic:Common Decoding Functions
Version-Specific Encoding
Packets often need different encoding based on the protocol version:Packet Interception
You can intercept and modify packets in session handlers:Intercepting Specific Packets
For backend server packets, extendbackendPlaySessionHandler:
Packet Location Reference
Packets are organized by category in:See Also
- Plugin Channels - Plugin messaging system
- Sound System - Sound packet handling
- Protocol Documentation - Minecraft protocol reference
- pkg.go.dev - Complete API documentation

