Skip to content

Networking Overview

Pumpkin is built with a high-performance, asynchronous networking stack capable of servicing both Minecraft: Java Edition and Minecraft: Bedrock Edition clients simultaneously.

All protocol definitions, serialization traits, and wire-level codecs are isolated in the pumpkin-protocol crate, while client connection management, session state machines, and gameplay packet dispatching are managed in pumpkin/src/net.


Supported Editions

Pumpkin separates network implementations by edition due to their fundamentally distinct transport layers, packet encodings, and state models:

FeatureMinecraft: Java EditionMinecraft: Bedrock Edition
Transport LayerTCP socket streamsUDP via RakNet & NetherNet
FramingVarInt length-prefixed framesBatched packets encapsulated in 0xfe headers
EncryptionAES-128 / CFB8 stream cipherCryptographic session handshake
CompressionPer-packet ZLib (above configurable threshold)Per-batch Deflate / ZLib compression
State ModelExplicit states: Handshake, Status, Login, Config, PlayPacket-driven state progression
Protocol Cratepumpkin-protocol::javapumpkin-protocol::bedrock
Server Net Modulepumpkin::net::javapumpkin::net::bedrock

Networking Architecture

The networking pipeline routes incoming connections through specialized transport and codec layers before delegating to the unified server game loop:

  1. Transport Listeners: Independent listeners bind to their respective ports—Tokio TCP for Java Edition (:25565) and UDP/RakNet/NetherNet for Bedrock Edition (:19132).
  2. Session Abstraction: Each accepted connection spawns an isolated session task (JavaClient or BedrockClient) managing wire framing and encryption.
  3. Codec Deserialization: Wire bytes are deserialized into typed packet structs via pumpkin-protocol::java (ClientPacket/ServerPacket) and pumpkin-protocol::bedrock (PacketWrite/PacketRead).
  4. Unified Gameplay Dispatch: Decoded packets are dispatched into the unified game loop, updating player entity states and streaming world chunks.

Explore the documentation for each edition:

Lançado sob a licença MIT.