Expand description
Azalea is a framework for creating Minecraft bots.
Internally, it’s just a wrapper over azalea_client
, adding useful
functions for making bots. Because of this, lots of the documentation will
refer to azalea_client
. You can just replace these with azalea
in your
code, since everything from azalea_client is re-exported in azalea.
Examples
//! A bot that logs chat messages sent in the server to the console.
use azalea::prelude::*;
use parking_lot::Mutex;
use std::sync::Arc;
#[tokio::main]
async fn main() {
let account = Account::offline("bot");
// or Account::microsoft("example@example.com").await.unwrap();
azalea::start(azalea::Options {
account,
address: "localhost",
state: State::default(),
plugins: vec![],
handle,
})
.await
.unwrap();
}
#[derive(Default, Clone)]
pub struct State {}
async fn handle(bot: Client, event: Event, state: State) -> anyhow::Result<()> {
match event {
Event::Chat(m) => {
println!(m.message().to_ansi(None));
}
_ => {}
}
Ok(())
}
Modules
Ping Minecraft servers.
The Azalea prelude. Things that are necessary for a bare-bones bot are re-exported here.
Structs
Something that can join Minecraft servers.
A player that you control that is currently in a Minecraft server.
The options that are passed to
azalea::start
.A player in the dimension or tab list.
Enums
Events are sent before they’re processed, so for example game ticks happen
at the beginning of a tick before anything has happened.
Traits
Plugins can keep their own personal state, listen to events, and add new functions to Client.
Functions
Join a server and start handling events. This function will run forever until
it gets disconnected from the server.