I made the foundation for a Minecraft client written in Rust, supporting protocol version 776 (Minecraft 26.2). At the moment the client is still in early development and is not yet usable as a game client. It can log in and stay connected, but world, rendering and input are still missing.
One challenging aspect was the difference between normal Ints and VarInts (Minecraft internal data type). VarInts are different from normal Ints, instead of using a fixed byte count for every number it can be different for smaller or bigger numbers, and can save space when sending data over the network. In each byte, the top bit says whether another byte follows, and the other 7 bits carry the number. I walked into that trap when building the teleport confirmation packet of the client and accidentally sent a normal Int instead of a VarInt and the server complained about extra bytes.
I am proud that I wrote all the packets I used by hand and now I understand how the Minecraft protocol works. The Minecraft Wiki helped me with that.
For testing it is very important that you have a running Minecraft 26.2 server and online-mode is disabled. Look at the README for quick start and server setup guide.
- 6 devlogs
- 50h