aboutsummaryrefslogtreecommitdiff
path: root/azalea
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-09-26 09:26:22 -0630
committermat <git@matdoes.dev>2025-09-26 21:56:32 +0600
commit0ec25dc45ec912bd9ef07ed9107f968de55f4a18 (patch)
treedc393947dc6edba57baac65b4ee899f6108fe545 /azalea
parentc811dc471a31175d985e2d448a772c628dcad5f6 (diff)
downloadazalea-drasl-0ec25dc45ec912bd9ef07ed9107f968de55f4a18.tar.xz
don't re-export azalea::bot::*, and some doc improvements
Diffstat (limited to 'azalea')
-rw-r--r--azalea/examples/nearest_entity.rs6
-rw-r--r--azalea/src/auto_tool.rs2
-rw-r--r--azalea/src/lib.rs7
-rw-r--r--azalea/src/pathfinder/goals.rs2
-rw-r--r--azalea/src/pathfinder/mod.rs7
-rw-r--r--azalea/src/pathfinder/moves/mod.rs5
-rw-r--r--azalea/src/pathfinder/simulation.rs2
-rw-r--r--azalea/src/swarm/mod.rs2
8 files changed, 22 insertions, 11 deletions
diff --git a/azalea/examples/nearest_entity.rs b/azalea/examples/nearest_entity.rs
index e859751e..80bb544d 100644
--- a/azalea/examples/nearest_entity.rs
+++ b/azalea/examples/nearest_entity.rs
@@ -1,4 +1,8 @@
-use azalea::{Bot, ClientBuilder, LookAtEvent, nearest_entity::EntityFinder};
+use azalea::{
+ ClientBuilder,
+ bot::{Bot, LookAtEvent},
+ nearest_entity::EntityFinder,
+};
use azalea_client::Account;
use azalea_core::tick::GameTick;
use azalea_entity::{
diff --git a/azalea/src/auto_tool.rs b/azalea/src/auto_tool.rs
index 0182e200..3d8d6e36 100644
--- a/azalea/src/auto_tool.rs
+++ b/azalea/src/auto_tool.rs
@@ -4,7 +4,7 @@ use azalea_core::position::BlockPos;
use azalea_entity::{FluidOnEyes, Physics};
use azalea_inventory::{ItemStack, Menu, components};
-use crate::BotClientExt;
+use crate::bot::BotClientExt;
#[derive(Debug)]
pub struct BestToolResult {
diff --git a/azalea/src/lib.rs b/azalea/src/lib.rs
index 7b4ec5ae..ae49c649 100644
--- a/azalea/src/lib.rs
+++ b/azalea/src/lib.rs
@@ -4,7 +4,7 @@
pub mod accept_resource_packs;
pub mod auto_respawn;
pub mod auto_tool;
-mod bot;
+pub mod bot;
pub mod container;
pub mod nearest_entity;
pub mod pathfinder;
@@ -34,13 +34,14 @@ pub use azalea_world as world;
pub use bevy_app as app;
use bevy_app::AppExit;
pub use bevy_ecs as ecs;
-pub use bot::*;
use ecs::component::Component;
use futures::{Future, future::BoxFuture};
use protocol::{ServerAddress, connect::Proxy, resolver::ResolverError};
use swarm::SwarmBuilder;
use thiserror::Error;
+use crate::bot::DefaultBotPlugins;
+
pub type BoxHandleFn<S, R> =
Box<dyn Fn(Client, azalea_client::Event, S) -> BoxFuture<'static, R> + Send>;
pub type HandleFn<S, Fut> = fn(Client, azalea_client::Event, S) -> Fut;
@@ -111,7 +112,7 @@ impl ClientBuilder<NoState, ()> {
/// .build()
/// .disable::<azalea::chat_signing::ChatSigningPlugin>(),
/// )
- /// .add_plugins(azalea::DefaultBotPlugins);
+ /// .add_plugins(azalea::bot::DefaultBotPlugins);
/// # client_builder.set_handler(handle);
/// # #[derive(Component, Clone, Default)]
/// # pub struct State;
diff --git a/azalea/src/pathfinder/goals.rs b/azalea/src/pathfinder/goals.rs
index 7a830973..18ab50c1 100644
--- a/azalea/src/pathfinder/goals.rs
+++ b/azalea/src/pathfinder/goals.rs
@@ -236,7 +236,7 @@ impl Goal for ReachBlockPosGoal {
}
let eye_position = n.center_bottom().up(1.62);
- let look_direction = crate::direction_looking_at(eye_position, self.pos.center());
+ let look_direction = crate::bot::direction_looking_at(eye_position, self.pos.center());
let block_hit_result = azalea_client::interact::pick::pick_block(
look_direction,
eye_position,
diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs
index 736309a2..6fbf0de4 100644
--- a/azalea/src/pathfinder/mod.rs
+++ b/azalea/src/pathfinder/mod.rs
@@ -1,5 +1,8 @@
//! A pathfinding plugin to make bots able to traverse the world.
//!
+//! For the new functions on `Client` that the pathfinder adds, see
+//! [`PathfinderClientExt`].
+//!
//! Much of this code is based on [Baritone](https://github.com/cabaletta/baritone).
pub mod astar;
@@ -59,9 +62,9 @@ use self::{
moves::{ExecuteCtx, IsReachedCtx, SuccessorsFn},
};
use crate::{
- BotClientExt, WalkDirection,
+ WalkDirection,
app::{App, Plugin},
- bot::{JumpEvent, LookAtEvent},
+ bot::{BotClientExt, JumpEvent, LookAtEvent},
ecs::{
component::Component,
entity::Entity,
diff --git a/azalea/src/pathfinder/moves/mod.rs b/azalea/src/pathfinder/moves/mod.rs
index 6d1c7c55..3111516d 100644
--- a/azalea/src/pathfinder/moves/mod.rs
+++ b/azalea/src/pathfinder/moves/mod.rs
@@ -24,7 +24,10 @@ use super::{
rel_block_pos::RelBlockPos,
world::{CachedWorld, is_block_state_passable},
};
-use crate::{JumpEvent, LookAtEvent, auto_tool::best_tool_in_hotbar_for_block};
+use crate::{
+ auto_tool::best_tool_in_hotbar_for_block,
+ bot::{JumpEvent, LookAtEvent},
+};
type Edge = astar::Edge<RelBlockPos, MoveData>;
diff --git a/azalea/src/pathfinder/simulation.rs b/azalea/src/pathfinder/simulation.rs
index 89a8b3c4..78de1642 100644
--- a/azalea/src/pathfinder/simulation.rs
+++ b/azalea/src/pathfinder/simulation.rs
@@ -63,7 +63,7 @@ fn create_simulation_instance(chunks: ChunkStorage) -> (App, Arc<RwLock<Instance
azalea_entity::EntityPlugin,
azalea_client::movement::MovementPlugin,
super::PathfinderPlugin,
- crate::BotPlugin,
+ crate::bot::BotPlugin,
azalea_client::task_pool::TaskPoolPlugin::default(),
// for mining
azalea_client::inventory::InventoryPlugin,
diff --git a/azalea/src/swarm/mod.rs b/azalea/src/swarm/mod.rs
index 25f11f1e..f2e65715 100644
--- a/azalea/src/swarm/mod.rs
+++ b/azalea/src/swarm/mod.rs
@@ -126,7 +126,7 @@ impl SwarmBuilder<NoState, NoSwarmState, (), ()> {
///
/// let swarm_builder = SwarmBuilder::new_without_plugins()
/// .add_plugins(azalea::DefaultPlugins.build().disable::<azalea::chat_signing::ChatSigningPlugin>())
- /// .add_plugins(azalea::DefaultBotPlugins)
+ /// .add_plugins(azalea::bot::DefaultBotPlugins)
/// .add_plugins(azalea::swarm::DefaultSwarmPlugins);
/// # swarm_builder.set_handler(handle).set_swarm_handler(swarm_handle);
/// # #[derive(Component, Resource, Clone, Default)]