A Minecraft: Java Edition server core written from scratch in C++ — raw sockets, hand-rolled protocol, no reference code.
⚠️ Work in progress. This is a protocol experiment, not a playable server. It currently gets a vanilla 1.19.4 client through the server list and the beginning of the login flow — world, chunks and gameplay are not implemented.
- 🤝 Handshake state machine — parses the handshake packet (protocol version, address, next state) exactly like the vanilla protocol defines it
- 📋 Server list status — responds to status requests with JSON: version, player counts, MOTD description and a base64-encoded
favicon.png - 🏓 Ping / pong — echoes the client's ping payload so latency shows up in the server list
- 🔑 Login start handling — reads the player nickname and UUID, logs the UUID in canonical form, and answers with a Login Success packet
- 🌍 Login (play) packet — sends the Join Game packet including the full registry codec (
registry-codec.nbt), dimension list, view/simulation distance and respawn flags - 🔢 VarInt codec & packet buffer — custom
Bufferclass for writing VarInts, strings, arrays, longs and booleans into outgoing packets - 🧵 Threaded architecture — a listener thread accepts TCP connections, each connection reads packets on its own thread, and a 50 ms tick loop runs separately
- 🖥️ Console commands — minimal REPL on stdin (
exit, ...) - 📜 Logging — colored console output plus a rolling
latest.logvia plog
- Winsock2 (
Ws2_32) — raw TCP sockets - nlohmann/json — status response JSON
- plog — logging
- zlib — compression (linked statically)
- Base64 — favicon encoding
- Custom local libraries:
nbt,bson,socketsand the author'sengine(filesystem / network helpers)
Requirements: CMake ≥ 3.25 and a C++20 MSVC toolchain. The server is Windows-only (Winsock).
Note:
CMakeLists.txtpulls several dependencies from a local directory (LIBRARIES_PATH,E:/Projects/librariesby default): plog, zlib, nbt, bson, b64, sockets and the author's engine sources. These are not vendored in this repository, so you must provide them and pointLIBRARIES_PATHat their location before configuring.
git clone https://github.com/kewldan/MinecraftServerCore.git
cd MinecraftServerCore
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
cmake --build build --config ReleaseThe executable is emitted into the repository root (MinecraftCore.exe). Run it from there so it can find registry-codec.nbt and favicon.png, then point a Minecraft 1.19.4 client at localhost:25565.