aboutsummaryrefslogtreecommitdiff
path: root/azalea
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-08-12 11:00:11 -1000
committermat <git@matdoes.dev>2025-08-12 11:00:11 -1000
commit7f4e3c583dd669561e8502822952fc9afe26e005 (patch)
tree831fbcb717493858c31ad58796e01494da276d76 /azalea
parentc36c3c0ed02b3727ba61b45a6a7febf1a008a7dc (diff)
downloadazalea-drasl-7f4e3c583dd669561e8502822952fc9afe26e005.tar.xz
add nearest_entity_by and improve some docs
Diffstat (limited to 'azalea')
-rw-r--r--azalea/README.md7
-rw-r--r--azalea/examples/testbot/commands.rs7
-rw-r--r--azalea/src/container.rs4
-rw-r--r--azalea/src/pathfinder/goto_event.rs5
4 files changed, 14 insertions, 9 deletions
diff --git a/azalea/README.md b/azalea/README.md
index 4f7506d1..3454ed2e 100644
--- a/azalea/README.md
+++ b/azalea/README.md
@@ -32,10 +32,6 @@ opt-level = 3
The documentation for the latest Azalea crates.io release is available at [docs.rs/azalea](https://docs.rs/azalea/latest/azalea/) and the docs for the latest bleeding-edge (git) version are at [azalea.matdoes.dev](https://azalea.matdoes.dev/azalea/).
-Note that the `azalea` crate is technically just a wrapper over [`azalea_client`] that adds some extra functions.
-Because of this, some 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
```rust,no_run
@@ -76,6 +72,9 @@ async fn handle(bot: Client, event: Event, state: State) -> anyhow::Result<()> {
}
```
+There are more examples in the [examples directory](https://github.com/azalea-rs/azalea/tree/main/azalea/examples).
+You may also find it helpful to read the code for [other people's Azalea bots](https://github.com/azalea-rs/azalea#real-world-bots-using-azalea).
+
# Swarms
Azalea lets you create "swarms", which are a group of bots in the same world that can perform actions together. See [testbot](https://github.com/azalea-rs/azalea/blob/main/azalea/examples/testbot/main.rs) for an example. Also, if you're using swarms, you should also `use` both `azalea::prelude::*` and `azalea::swarm::prelude::*`.
diff --git a/azalea/examples/testbot/commands.rs b/azalea/examples/testbot/commands.rs
index ecd68ade..7486780e 100644
--- a/azalea/examples/testbot/commands.rs
+++ b/azalea/examples/testbot/commands.rs
@@ -31,9 +31,10 @@ impl CommandSource {
pub fn entity(&mut self) -> Option<Entity> {
let username = self.chat.sender()?;
- self.bot.entity_by::<With<Player>, &GameProfileComponent>(
- |profile: &&GameProfileComponent| profile.name == username,
- )
+ self.bot
+ .any_entity_by::<With<Player>, &GameProfileComponent>(
+ |profile: &&GameProfileComponent| profile.name == username,
+ )
}
}
diff --git a/azalea/src/container.rs b/azalea/src/container.rs
index ee618df2..a7b496ea 100644
--- a/azalea/src/container.rs
+++ b/azalea/src/container.rs
@@ -174,7 +174,7 @@ impl ContainerHandleRef {
///
/// Note that any modifications you make to the `Menu` you're given will not
/// actually cause any packets to be sent. If you're trying to modify your
- /// inventory, use [`ContainerHandle::click`] instead
+ /// inventory, use [`Self::click`] instead
pub fn menu(&self) -> Option<Menu> {
let ecs = self.client.ecs.lock();
let inventory = ecs
@@ -224,6 +224,8 @@ impl ContainerHandleRef {
});
}
+ /// Simulate a click in the container and send the packet to perform the
+ /// action.
pub fn click(&self, operation: impl Into<ClickOperation>) {
let operation = operation.into();
self.client.ecs.lock().send_event(ContainerClickEvent {
diff --git a/azalea/src/pathfinder/goto_event.rs b/azalea/src/pathfinder/goto_event.rs
index dfd89122..d87d1586 100644
--- a/azalea/src/pathfinder/goto_event.rs
+++ b/azalea/src/pathfinder/goto_event.rs
@@ -12,7 +12,10 @@ use crate::pathfinder::{
///
/// Also see [`PathfinderClientExt::goto`].
///
-/// This event is read by [`goto_listener`].
+/// This event is read by [`goto_listener`]
+///
+/// [`goto_listener`]: crate::pathfinder::goto_listener
+/// [`PathfinderClientExt::goto`]: crate::pathfinder::PathfinderClientExt::goto
#[derive(Event)]
#[non_exhaustive]
pub struct GotoEvent {