diff options
| author | mat <git@matdoes.dev> | 2023-11-12 17:13:43 -0600 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2023-11-12 17:13:43 -0600 |
| commit | 03cc28d8e71ed969b21a0824a93dd8e2671e3178 (patch) | |
| tree | 88cd604d8fe54d4c79f6cb67ab8b6a2872529a49 | |
| parent | 3d22b5b91cf8ea790e98273d114f26589e8280ae (diff) | |
| download | azalea-drasl-03cc28d8e71ed969b21a0824a93dd8e2671e3178.tar.xz | |
improve docs a bit
| -rwxr-xr-x | azalea-client/src/chat.rs | 9 | ||||
| -rw-r--r-- | azalea-client/src/client.rs | 7 | ||||
| -rw-r--r-- | azalea-client/src/entity_query.rs | 2 | ||||
| -rw-r--r-- | azalea-world/src/world.rs | 2 | ||||
| -rwxr-xr-x | azalea/README.md | 22 | ||||
| -rw-r--r-- | azalea/src/pathfinder/mod.rs | 2 |
6 files changed, 27 insertions, 17 deletions
diff --git a/azalea-client/src/chat.rs b/azalea-client/src/chat.rs index f238dd47..dbc2843c 100755 --- a/azalea-client/src/chat.rs +++ b/azalea-client/src/chat.rs @@ -122,10 +122,11 @@ impl ChatPacket { } impl Client { - /// Sends chat message to the server. This only sends the chat packet and - /// not the command packet. The [`Client::chat`] function handles checking - /// whether the message is a command and using the proper packet for you, - /// so you should use that instead. + /// Send a chat message to the server. This only sends the chat packet and + /// not the command packet, which means on some servers you can use this to + /// send chat messages that start with a `/`. The [`Client::chat`] function + /// handles checking whether the message is a command and using the + /// proper packet for you, so you should use that instead. pub fn send_chat_packet(&self, message: &str) { self.ecs.lock().send_event(SendChatKindEvent { entity: self.entity, diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs index f4622eed..7f4a6170 100644 --- a/azalea-client/src/client.rs +++ b/azalea-client/src/client.rs @@ -133,7 +133,8 @@ pub enum JoinError { } impl Client { - /// Create a new client from the given GameProfile, Connection, and World. + /// Create a new client from the given [`GameProfile`], ECS Entity, ECS + /// World, and schedule runner function. /// You should only use this if you want to change these fields from the /// defaults, otherwise use [`Client::join`]. pub fn new( @@ -562,9 +563,9 @@ impl Client { /// Get the username of this client. /// /// This is a shortcut for - /// `bot.component::<GameProfileComponent>().name.clone()`. + /// `bot.component::<GameProfileComponent>().name.to_owned()`. pub fn username(&self) -> String { - self.component::<GameProfileComponent>().name.clone() + self.component::<GameProfileComponent>().name.to_owned() } /// Get the Minecraft UUID of this client. diff --git a/azalea-client/src/entity_query.rs b/azalea-client/src/entity_query.rs index 484da6f8..42b7b0ca 100644 --- a/azalea-client/src/entity_query.rs +++ b/azalea-client/src/entity_query.rs @@ -56,6 +56,8 @@ impl Client { /// } /// # } /// ``` + /// + /// [`Entity`]: bevy_ecs::entity::Entity pub fn entity_by<F: ReadOnlyWorldQuery, Q: ReadOnlyWorldQuery>( &mut self, predicate: impl EntityPredicate<Q, F>, diff --git a/azalea-world/src/world.rs b/azalea-world/src/world.rs index 63e1d770..a41b2530 100644 --- a/azalea-world/src/world.rs +++ b/azalea-world/src/world.rs @@ -36,6 +36,8 @@ impl PartialInstance { /// An entity ID used by Minecraft. These are not guaranteed to be unique in /// shared worlds, that's what [`Entity`] is for. +/// +/// [`Entity`]: bevy_ecs::entity::Entity #[derive(Component, Copy, Clone, Debug, PartialEq, Eq, Deref, DerefMut)] pub struct MinecraftEntityId(pub u32); diff --git a/azalea/README.md b/azalea/README.md index 5a3751d5..1ec82cd3 100755 --- a/azalea/README.md +++ b/azalea/README.md @@ -1,9 +1,7 @@ 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. +This page is primarily meant for developers that already know they want to use Azalea. +See the [readme](https://github.com/azalea-rs/azalea) for an overview of why you might want to use it. # Installation @@ -12,10 +10,8 @@ default nightly`. Then, add one of the following lines to your Cargo.toml: -Latest bleeding-edge version (recommended): -`azalea = { git="https://github.com/azalea-rs/azalea" }`\ -Latest "stable" release: -`azalea = "0.8.0"` +- Latest bleeding-edge version (recommended): `azalea = { git="https://github.com/azalea-rs/azalea" }`\ +- Latest "stable" release: `azalea = "0.8.0"` ## Optimization @@ -32,6 +28,14 @@ opt-level = 1 [profile.dev.package."*"] opt-level = 3 ``` +# Documentation + +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 @@ -73,7 +77,7 @@ async fn handle(bot: Client, event: Event, state: State) -> anyhow::Result<()> { # 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.rs) for an example. Also, if you're using swarms, you should also have both `azalea::prelude::*` and `azalea::swarm::prelude::*`. +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.rs) for an example. Also, if you're using swarms, you should also `use` both `azalea::prelude::*` and `azalea::swarm::prelude::*`. # Plugins diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs index 5763f379..c7f05eae 100644 --- a/azalea/src/pathfinder/mod.rs +++ b/azalea/src/pathfinder/mod.rs @@ -58,9 +58,9 @@ impl Plugin for PathfinderPlugin { .add_event::<PathFoundEvent>() .add_event::<StopPathfindingEvent>() .add_systems( - FixedUpdate, // putting systems in the FixedUpdate schedule makes them run every Minecraft tick // (every 50 milliseconds). + FixedUpdate, ( timeout_movement, check_node_reached, |
