Handcrafted Minecraft Server Implementation in Kotlin
Krypton is a from-scratch, modular Minecraft: Java Edition server implementation targeting version 26.2 (protocol 776). Built for educational exploration of the Minecraft network protocol — every packet is hand-rolled, every state transition is explicit.
| State | Support |
|---|---|
| HANDSHAKE | ✅ Full |
| STATUS (Ping) | ✅ Full |
| LOGIN | ✅ Offline mode |
| CONFIGURATION | ✅ ClientInformation, SelectKnownPacks, FinishConfiguration |
| PLAY | 🚧 In progress — RegistryData sniffing infrastructure ready |
Krypton/
├── krypton-core # BinaryBuffer, MinecraftBinaryFormat, NBT I/O, VarInt types
├── krypton-network # TCP server, packet framing (VarInt length prefix)
├── krypton-protocol # Connection state machine, packet definitions, PacketIds
└── krypton-server # Server entry point, session/handler layer, registry sniffer tool
Each module is self-contained with a single responsibility. Handlers follow a state-per-class pattern (HandshakeHandler, StatusHandler, LoginHandler, ConfigHandler) dispatched by a ConnectionStateMachine.
- JDK 25+
- Kotlin 2.x (via Gradle)
- A vanilla Minecraft 26.2 server (for registry sniffing)
# Build all modules
./gradlew build
# Sniff RegistryData from a running vanilla 26.2 server
./gradlew fetchRegistry -PmcVersion=26.2
# Start Krypton server
./gradlew :krypton-server:runLaunch Minecraft 26.2 client, connect to localhost:25566.
- Zero dependency on vanilla jars — binary encoding, VarInt, NBT, and framing all implemented in pure Kotlin
- BinaryBuffer — hand-rolled zero-copy binary I/O buffer for MC protocol
- MinecraftBinaryFormat — kotlinx.serialization adapter mapping Kotlin types to MC wire format
- NBT support — NbtTag sealed interface with Compound, String, Byte; writer + reader for unnamed packet-embedded format
- Compression — zlib inflate/deflate support in RegistrySniffer for connecting to vanilla servers
- Versioned Registry Sniffing —
./gradlew fetchRegistrycaptures RegistryData from a vanilla server, stored inAuto-Generated-Registry/26.2/
./gradlew build -x test # Compile only
./gradlew tasks --group=krypton
./gradlew fetchRegistry -PmcVersion=26.2 # Sniff vanilla registriesAll packet IDs are centralized in PacketIds object under krypton-protocol:
PacketIds.HandshakeS2C.DISCONNECT
PacketIds.LoginS2C.LOGIN_FINISHED
PacketIds.ConfigurationS2C.REGISTRY_DATA
// etc.GNU General Public License v3.0 — See LICENSE
Created by CoffeePop studio