Skip to content

CoffeePopStudio/Krypton

Repository files navigation

Krypton

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.

Status

State Support
HANDSHAKE ✅ Full
STATUS (Ping) ✅ Full
LOGIN ✅ Offline mode
CONFIGURATION ✅ ClientInformation, SelectKnownPacks, FinishConfiguration
PLAY 🚧 In progress — RegistryData sniffing infrastructure ready

Architecture

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.

Quick Start

Prerequisites

  • JDK 25+
  • Kotlin 2.x (via Gradle)
  • A vanilla Minecraft 26.2 server (for registry sniffing)

Build & Run

# 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:run

Connect

Launch Minecraft 26.2 client, connect to localhost:25566.

Features

  • 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 fetchRegistry captures RegistryData from a vanilla server, stored in Auto-Generated-Registry/26.2/

Development

Key Commands

./gradlew build -x test       # Compile only
./gradlew tasks --group=krypton
./gradlew fetchRegistry -PmcVersion=26.2   # Sniff vanilla registries

Packet IDs

All packet IDs are centralized in PacketIds object under krypton-protocol:

PacketIds.HandshakeS2C.DISCONNECT
PacketIds.LoginS2C.LOGIN_FINISHED
PacketIds.ConfigurationS2C.REGISTRY_DATA
// etc.

License

GNU General Public License v3.0 — See LICENSE

Credits

Created by CoffeePop studio

About

一个 Kotlin 原版 Minecraft 服务端 | A vanilla Minecraft server reimplementation written in Kotlin

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages