McProtoNet is a .NET library for the Minecraft Java Edition protocol, client side. It gives you the transport, the packets, and a simple client. You write the bot.
Bots join a server, listen to game chat, and walk into any text you type. The picture shows 117 of them. This is examples/FormationBots — a few hundred lines on top of the library.
⚠️ McProtoNet is under active development. The API changes between versions, and not all packets are modeled yet.
- Transport.
MinecraftConnectionframes packets over any duplexStreamonSystem.IO.Pipelines. Compression is libdeflate, encryption is AES/CFB8 with hardware cores for x86 (AES-NI) and ARM64 (NEON). The cipher beats BouncyCastle by about 2x in our benchmarks and allocates nothing per call. - Packets. Typed packet classes for protocols 735–776 (Minecraft 1.16 → 26.2), generated from F# specs. One allocation per packet, no reflection, no boxing on the hot path. Unknown packets stay available as raw id + bytes.
- Client.
MinecraftClientconnects over TCP, resolves SRV records, and moves packets. It also finds LAN servers. Handshake, login, and game logic stay in your code — the examples show the whole path. - NBT. A standalone reader and writer for the NBT format, with Modified UTF-8 strings.
- Works with offline-mode servers. Mojang authentication is not implemented yet.
dotnet add package McProtoNet
The package pulls in the rest of the stack. You can also take a single layer:
| Package | What it holds |
|---|---|
McProtoNet |
Client glue: connect, SRV lookup, typed send, LAN search |
McProtoNet.Protocol |
Generated packets, types, and handler bases |
McProtoNet.Transport |
Framing, compression, encryption |
McProtoNet.Primitives |
VarInt readers and writers, packet structs |
McProtoNet.NBT |
NBT reader and writer |
The transport depends on the native package McProtoNet.Native 1.0.0, which
carries libdeflate.
Every push to the dev branch publishes packages to a Feedz feed. Versions look
like 2.0.0-preview.4.<height> and are prerelease, so --prerelease is needed.
Stable releases go to nuget.org.
dotnet nuget add source https://f.feedz.io/mcprotonet/night/nuget/index.json -n mcprotonet-night
dotnet add package McProtoNet --prerelease
using McProtoNet;
using HandshakeSb = McProtoNet.Protocol.Packets.Handshaking.Serverbound;
using LoginSb = McProtoNet.Protocol.Packets.Login.Serverbound;
const int Pv = 772;
await using var client = new MinecraftClient(new MinecraftClientOptions { Host = "localhost" });
await client.ConnectAsync();
await client.SendAsync(new HandshakeSb.SetProtocolPacket(Pv, "localhost", 25565, 2), Pv);
await client.SendAsync(new LoginSb.LoginStartPacket("Steve", V764_Last: new(Guid.NewGuid())), Pv);
await foreach (var packet in client.ReadPacketsAsync())
{
// bot derives from ClientboundHandler and overrides the packets it wants
await bot.HandleAsync(in packet, Pv);
}The receive loop and the phase machine live in your code on purpose. examples/MinimalBot walks the full path in one file: handshake → login → configuration → play, with keep-alives and chat. examples/FormationBots runs one client per bot in the picture above.
| Minecraft | 1.16 → 26.2 (protocols 735–776) |
| Runtime | .NET 8, .NET 9, .NET 10, .NET 11 |
MIT. See LICENSE.
Questions, bugs, ideas: Discord or GitHub issues.
You can support development with crypto. Send only in the network named next to the address; a transfer that arrives through another network cannot be returned. None of the addresses needs a memo or a tag.
USDT, TRON network (TRC-20): TVw4jCehZspPk3aT1fecQWhEzH2LEkG9WG
TON and USDT, TON network: UQDp_mDSj3VH0uIqBl2aNsyZJ8Drymo3qX-nlYNr5r6zTCaI
BTC, Bitcoin network: bc1q3ushl443q9xvclxtqxcvltdd64ffy3h8x7xsm4
The same is on the site: Support the project.
