A fully autonomous Minecraft bot framework built in .NET 10 / C# 14, implementing the Minecraft protocol from scratch. MinecraftProtoNet can authenticate with Microsoft accounts, connect to vanilla/modded servers, execute physics-accurate movement, navigate the world via A* pathfinding, and autonomously trade on Hypixel SkyBlock's Bazaar β all managed through a real-time Blazor Server dashboard.
| Area | Highlights |
|---|---|
| Protocol | Partial Minecraft 26.1 (Protocol 775) implementation |
| Authentication | Complete MSA β Xbox Live β XSTS β Minecraft Services OAuth chain with token caching & chat-session signing |
| Networking | TCP connection, AES/CFB8 encryption (BouncyCastle), ZLib compression, VarInt framing |
| Physics | Vanilla-accurate physics engine β AABB collision, gravity, sprinting, sneaking, swimming, and more |
| Pathfinding | C# port of Baritone β A* pathfinding with movement costs, block-breaking/placing, jump/sprint movements |
| Trading | Autonomous Hypixel SkyBlock Bazaar trading engine with order management & safety controls |
| Anti-Detection | Humanizer system β tick jitter, rotation smoothing, randomized GUI interaction delays, idle look-around |
| Dashboard | Real-time Blazor Server web UI for monitoring, controlling, and interacting with the bot |
| Commands | Extensible chat-command system with attribute-based auto-registration and per-player authorization |
| NBT | Full Named Binary Tag (NBT) reader for item/block data parsing |
MinecraftProtoNet.slnx
β
βββ MinecraftProtoNet.Core # Core protocol, networking, state, physics, services
β βββ Core/ # MinecraftClient, Connection, ProtocolConstants
β βββ Packets/ # Packet definitions (Handshaking, Login, Status, Configuration, Play)
β βββ Handlers/ # Packet handlers per protocol state
β βββ Services/ # GameLoop, PhysicsService, PacketRegistry, Inventory/Container mgmt
β βββ State/ # Entity, Level, ChunkManager, PlayerRegistry, WorldBorder
β βββ Actions/ # InteractionManager (block place/dig, entity interaction)
β βββ Commands/ # Chat command framework (ICommand, CommandRegistry)
β βββ Physics/ # Collision shapes, block shape registry, AABB math
β βββ Configuration/ # HumanizerConfig and options binding
β βββ Abstractions/ # IChatSink, IHumanizer, handler/service interfaces
β
βββ MinecraftProtoNet.Core.Auth # Microsoft + Minecraft authentication
β βββ Authenticators/ # MicrosoftAuthenticator, XboxAuthenticator, MinecraftAuthenticator
β βββ Managers/ # PlayerKeyManager (chat-session profile keys)
β βββ Dtos/ # AuthResult, token response models
β
βββ MinecraftProtoNet.Core.NBT # Named Binary Tag parsing
β βββ Tags/ # Tag types (Compound, List, String, Int, etc.)
β βββ NbtReader.cs # Binary stream reader
β βββ NbtExtensions.cs # Helper extensions
β
βββ MinecraftProtoNet.Baritone # Pathfinding & autonomous movement (Baritone port)
β βββ Pathfinding/ # A* path calculation, movement types, goals
β βββ Behaviors/ # PathingBehavior, LookBehavior, InventoryBehavior
β βββ Process/ # High-level process management
β βββ Cache/ # World cache for pathfinding lookups
β βββ Commands/ # !goto, !follow, !stop, etc.
β
βββ MinecraftProtoNet.Bazaar # Autonomous Hypixel SkyBlock Bazaar trading
β βββ Engine/ # BazaarTradingEngine, TradingState machine
β βββ Api/ # Bazaar companion API client (Refit)
β βββ Orders/ # Order lifecycle management
β βββ Safety/ # Risk controls and guards
β βββ Gui/ # Automated NPC / sign interaction
β βββ Commands/ # !bazaar chat commands
β
βββ Bot.Webcore # Blazor Server dashboard (host application)
β βββ Components/ # Razor pages & layout
β βββ Services/ # BotService, DragDropState
β βββ Program.cs # App entry point, DI composition root
β
βββ MinecraftProtoNet.Tests # xUnit + FluentAssertions + Moq test suite
β
βββ Tools/
βββ PacketIdSync # Tooling for syncing packet IDs across protocol versions
| Category | Technologies |
|---|---|
| Runtime | .NET 10, C# 14 |
| Web UI | Blazor Server (Interactive SSR) |
| Auth | MSAL (Microsoft.Identity.Client) with token caching |
| Crypto | BouncyCastle (AES/CFB8 encryption) |
| HTTP | Refit (typed REST clients for Xbox/Minecraft/Bazaar APIs) |
| Logging | Serilog (Console + File sinks), ILogger<T> |
| CLI | Spectre.Console |
| Text | Humanizer.Core |
| Testing | xUnit, FluentAssertions, Moq, Coverlet |
sequenceDiagram
participant UI as Blazor Dashboard
participant MC as MinecraftClient
participant Auth as AuthenticationFlow
participant Conn as Connection
participant Server as MC Server
UI->>MC: AuthenticateAsync()
MC->>Auth: MSA β Xbox β XSTS β MC Login
Auth-->>MC: AuthResult (token, UUID, keys)
UI->>MC: ConnectAsync(host, port)
MC->>Conn: TCP Connect
MC->>Server: Handshake (Protocol 775)
MC->>Server: Hello (username, UUID)
Server-->>MC: Encryption Request
MC->>Conn: Enable AES/CFB8
MC->>Server: Encryption Response
Server-->>MC: Set Compression
MC->>Conn: Enable ZLib
Server-->>MC: Login Success β Configuration β Play
MC->>MC: Start GameLoop (20 TPS)
loop Every Tick (~50ms)
MC->>MC: PreTick (Baritone pathfinding)
MC->>MC: PhysicsTick (movement, collision, interaction)
MC->>MC: PostTick (cleanup)
MC->>Server: Position, Action, TickEnd packets
end
stateDiagram-v2
[*] --> Handshaking
Handshaking --> Status: Intention=1
Handshaking --> Login: Intention=2
Status --> [*]: Response received
Login --> Configuration: Login Success
Configuration --> Play: Configuration Complete
Play --> [*]: Disconnect
The GameLoop runs on a dedicated background thread at the server's tick rate (default 20 TPS / 50ms). Each tick:
- Pre-Tick β External systems hook in (e.g., Baritone calculates next movement input)
- Physics Tick β Vanilla-accurate physics: carried-item sync β right/left click handling β collision detection β position update β server packet emission
- Post-Tick β Cleanup and state sync
- Tick End β
ClientTickEndPacketsent to server - Sleep β Remaining time + humanizer jitter
- .NET 10 SDK
- A Microsoft account that owns Minecraft: Java Edition
# Clone the repository
git clone <repo-url>
cd MinecraftProtoNet
# Restore and build
dotnet build
# Run the Blazor dashboard
dotnet run --project Bot.WebcoreThe dashboard will be available at http://localhost:5107.
Edit Bot.Webcore/appsettings.json to configure:
Tip
Use dotnet user-secrets for the Bazaar API key instead of storing it in appsettings.json.
Commands are triggered in-game via chat messages prefixed with !. The system uses attribute-based auto-registration β commands are discovered at startup from all loaded assemblies.
| Command | Module | Description |
|---|---|---|
!goto <x> <y> <z> |
Baritone | Pathfind to coordinates |
!follow <player> |
Baritone | Follow a player |
!stop |
Baritone | Cancel current pathfinding |
!bazaar |
Bazaar | Bazaar trading controls |
Commands from external players are blocked on remote servers by default unless their UUID is in the AuthorizedPlayerUuids list.
A faithful C# port of Baritone, the popular Minecraft pathfinding mod:
- A* Search over a 3D block graph with movement cost heuristics
- Movement types: Walk, Sprint, Jump, Ascend, Descend, Diagonal, Pillar, Parkour, WalkOff
- Behaviors:
PathingBehavior(path execution),LookBehavior(head rotation),InventoryBehavior(tool selection) - Goals:
GoalBlock,GoalXZ,GoalNear,GoalGetToBlock, and more - World Cache: Efficient block-state lookups for the pathfinder
- Integrates with the game loop via
PreTick/PostTickhooks
Fully autonomous trading on the Hypixel SkyBlock Bazaar:
- Trading Engine β State machine managing the full buy/sell lifecycle
- Order Management β Order placement, tracking, and cancellation
- Safety Controls β Guards against overspending, rate limits, and market manipulation
- GUI Automation β Interacts with NPC dialogs and sign-based input
- Companion API β External price/strategy data via a Refit HTTP client
The Humanizer system simulates human-like behavior to reduce detection risk on public servers:
| Behavior | Description |
|---|---|
| Tick Jitter | Randomizes game loop timing by Β±1β3ms |
| Rotation Noise | Adds subtle sub-degree noise to head movements |
| GUI Delays | Randomized click (100β350ms) and navigation (250β900ms) timing |
| Chat Delays | Human-like typing speed for chat commands (500β1800ms) |
| Idle Behavior | Periodic random look-around when idle |
| Remote Detection | Auto-enables on non-local servers |
Implements the complete Minecraft authentication chain:
Microsoft Account (MSAL with device-code / interactive)
β Xbox Live Token
β XSTS Token
β Minecraft Services Access Token
β Minecraft Profile (UUID + Username)
β Player Profile Keys (chat signing)
- Token caching via MSAL extensions (survives restarts)
- Chat session signing with RSA keys for secure chat (
ChatSessionUpdatePacket) - Player key management with Mojang-signed key pairs
dotnet test- Framework: xUnit
- Assertions: FluentAssertions
- Mocking: Moq
- Coverage: Coverlet
- Test projects cover Core, Baritone, Bazaar, Auth, and NBT modules
graph TD
Webcore["Bot.Webcore<br/>(Blazor Server Host)"]
Core["MinecraftProtoNet.Core<br/>(Protocol, Physics, State)"]
Auth["MinecraftProtoNet.Core.Auth<br/>(MSA + MC Auth)"]
NBT["MinecraftProtoNet.Core.NBT<br/>(NBT Parsing)"]
Baritone["MinecraftProtoNet.Baritone<br/>(Pathfinding)"]
Bazaar["MinecraftProtoNet.Bazaar<br/>(Bazaar Trading)"]
Tests["MinecraftProtoNet.Tests"]
Tools["PacketIdSync<br/>(Tooling)"]
Webcore --> Core
Webcore --> Baritone
Webcore --> Bazaar
Core --> Auth
Core --> NBT
Baritone --> Core
Baritone --> Auth
Baritone --> NBT
Bazaar --> Core
Bazaar --> NBT
Tests --> Core
Tests --> Baritone
Tests --> Bazaar
MIT License. See LICENSE for details.
{ "BazaarTrading": { "BazaarCompanionBaseUrl": "https://bazaar.amosr.uk", "BazaarCompanionApiKey": "" // Your API key }, "Humanizer": { "Enabled": false, // Enable anti-detection behaviors "ForceOnRemote": true, // Auto-enable on non-local servers "LocalNetworks": ["127.0.0.1", "localhost"], "TickJitterMinMs": -1, // Tick timing randomization "TickJitterMaxMs": 3, "RotationJitterMaxDegrees": 0.04, // Subtle head movement noise "GuiClickMinMs": 100, // GUI interaction delays "GuiClickMaxMs": 350, "BlockExternalCommandsOnRemote": true, "AuthorizedPlayerUuids": ["<uuid>"] // Players allowed to send ! commands } }