A collection of Rust crates for making Minecraft: Bedrock Edition bots, clients and tools.
Currently supported Minecraft version: 1.26.51 (protocol 2193).
Warning
Acacia is pre-release. APIs change without notice.
- RakNet and NetherNet transports, picked automatically per server
- Joining dedicated servers by address, Realms (
examples/realm_join.rs) and game-hosted LAN worlds (examples/lan_join.rs); friends' worlds aren't supported yet - Online (Xbox Live) and offline login, with token caching across reconnects
- SOCKS5 proxies per bot, for both the game connection and sign-in
- Every packet, generated from minecraft-data and decoded only when you ask for it
- Player physics and pathfinding
- Chunks and block state, shared between bots on the same server
- Typed events: chat (with regex matching), forms, health, players, windows, titles
- Gameplay actions: breaking and placing blocks, attacking, containers and inventory, crafting and workstations, eating and equipping, signs, books, beds, riding, fishing and elytra
- Bots that look like a vanilla Android player: login data, input cadence, spawn sequence and reaction times match recorded vanilla sessions
Join us on Discord for questions, bug reports and to share bots you've built.
- Do everything a vanilla Bedrock client can do.
- Be indistinguishable from a vanilla client on the wire.
- Run many bots cheaply: a network-free core, no work for packets nobody reads.
- Track the latest Minecraft version.
- Java Edition from the same API, pinned to one Java version (docs/java-edition.md).
- Supporting several protocol versions at once. Pin an older release for an older server.
- Graphics.
use acacia_bot::{client::Client, pathfind::Goal, Bot, BotConfig, BotEvent, Events};
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::builder("127.0.0.1:19132").offline("Acacia");
let config = BotConfig { physics: true, events: Events::CHAT, ..BotConfig::default() };
let mut bot = Bot::connect(client, config).await?;
while let Some(event) = bot.next().await {
match event {
BotEvent::Chat(msg) if msg.message == "!spawn" => {
bot.client().chat("on my way");
bot.goto(Goal::XZ(0, 0)).await?;
}
BotEvent::Disconnected(reason) => println!("disconnected: {reason:?}"),
_ => {}
}
}
Ok(())
}Without the bot layer, acacia-client is a bare connection that hands you raw packets:
use acacia_client::{proto::{packets::Text, Packet}, Client, Event};
let mut client = Client::builder("play.example.net")
.offline("Bot") // or .online(credentials, key) via acacia_client::auth
.chunk_radius(2)
.subscribe([Text::ID]) // undelivered packet IDs are never decoded or queued
.connect().await?; // resolves once the player has spawned
while let Some(Event::Packet(p)) = client.recv().await {
let text: Text = p.decode()?;
}More in each crate's examples/ directory.
| Crate | Role |
|---|---|
acacia-bot |
High-level Bot: game state, events, physics, pathfinding and gameplay actions |
acacia-host |
Runs bots on shard threads for other languages: command JSON in, one ordered stream of event and result batches out |
acacia-api |
The schema other languages drive bots through: commands, events, snapshots, errors; generated TS types and JSON Schemas |
acacia-client |
tokio driver, SOCKS5 proxying, the Client connection API, ping |
acacia-session |
Network-free session: batching, compression, encryption, the login sequence |
acacia-raknet |
Network-free RakNet: handshake, reliability, splits, ordering, ACK/NACK |
acacia-nethernet |
Network-free NetherNet: signaling, framing, WebRTC via str0m (client, and the direct-connect server side) |
acacia-proto |
All packets, generated by tools/codegen; decoded on demand |
acacia-auth |
Login payloads; Microsoft, Xbox and PlayFab sign-in behind the online feature |
acacia-world |
Block registry, chunk decoding, shared chunk storage |
acacia-physics |
Player movement simulation, ported from bedsim |
acacia-testserver |
Replays recorded server sessions for offline tests |
acacia-mitm |
Proxy (RakNet or NetherNet): records vanilla-client captures; as a library, drops, rewrites and injects packets |
Dependencies only point downward. The network-free crates never open a socket or spawn a task, so the same code drives real connections, replay tests and benchmarks. See docs/DESIGN.md.
Acacia isn't on crates.io yet. Depend on it through git:
[dependencies]
acacia-bot = { git = "https://github.com/acacia-rs/acacia" }
tokio = { version = "1", features = ["macros", "rt"] }Requires Rust 1.98 or newer. For a local server to test against, see docs/testing.md.
- docs/DESIGN.md: architecture and the decisions behind it
- docs/auth.md: the sign-in chain and its endpoints
- docs/proto.md: packet generation and lazy decoding
- docs/testing.md: local BDS setup, examples and test commands
cargo doc --openfor the API reference
See CONTRIBUTING.md. Report security issues privately, as SECURITY.md describes.
MIT. Includes MIT-licensed data and code from minecraft-data, Boar, bedsim and gophertunnel; see THIRD-PARTY.md.