diff options
Diffstat (limited to 'azalea/src')
| -rw-r--r-- | azalea/src/accept_resource_packs.rs | 24 | ||||
| -rw-r--r-- | azalea/src/bot.rs | 36 | ||||
| -rw-r--r-- | azalea/src/container.rs | 5 | ||||
| -rw-r--r-- | azalea/src/lib.rs | 6 | ||||
| -rw-r--r-- | azalea/src/pathfinder/mod.rs | 66 | ||||
| -rw-r--r-- | azalea/src/prelude.rs | 6 |
6 files changed, 81 insertions, 62 deletions
diff --git a/azalea/src/accept_resource_packs.rs b/azalea/src/accept_resource_packs.rs index c310d541..4518abcb 100644 --- a/azalea/src/accept_resource_packs.rs +++ b/azalea/src/accept_resource_packs.rs @@ -1,12 +1,18 @@ -use azalea_client::InConfigState; -use azalea_client::chunks::handle_chunk_batch_finished_event; -use azalea_client::inventory::InventorySet; -use azalea_client::packet::config::SendConfigPacketEvent; -use azalea_client::packet::game::SendPacketEvent; -use azalea_client::packet::{death_event_on_0_health, game::ResourcePackEvent}; -use azalea_client::respawn::perform_respawn; -use azalea_protocol::packets::config; -use azalea_protocol::packets::game::s_resource_pack::{self, ServerboundResourcePack}; +use azalea_client::{ + InConfigState, + chunks::handle_chunk_batch_finished_event, + inventory::InventorySet, + packet::{ + config::SendConfigPacketEvent, + death_event_on_0_health, + game::{ResourcePackEvent, SendPacketEvent}, + }, + respawn::perform_respawn, +}; +use azalea_protocol::packets::{ + config, + game::s_resource_pack::{self, ServerboundResourcePack}, +}; use bevy_app::Update; use bevy_ecs::prelude::*; diff --git a/azalea/src/bot.rs b/azalea/src/bot.rs index 63a3adcb..8bc9d594 100644 --- a/azalea/src/bot.rs +++ b/azalea/src/bot.rs @@ -1,9 +1,13 @@ use std::f64::consts::PI; -use azalea_client::mining::Mining; -use azalea_client::tick_broadcast::{TickBroadcast, UpdateBroadcast}; -use azalea_core::position::{BlockPos, Vec3}; -use azalea_core::tick::GameTick; +use azalea_client::{ + mining::Mining, + tick_broadcast::{TickBroadcast, UpdateBroadcast}, +}; +use azalea_core::{ + position::{BlockPos, Vec3}, + tick::GameTick, +}; use azalea_entity::{ EyeHeight, Jumping, LocalEntity, LookDirection, Position, clamp_look_direction, metadata::Player, @@ -14,18 +18,20 @@ use bevy_ecs::prelude::*; use futures_lite::Future; use tracing::trace; -use crate::accept_resource_packs::AcceptResourcePacksPlugin; -use crate::app::{App, Plugin, PluginGroup, PluginGroupBuilder}; -use crate::auto_respawn::AutoRespawnPlugin; -use crate::container::ContainerPlugin; -use crate::ecs::{ - component::Component, - entity::Entity, - event::EventReader, - query::{With, Without}, - system::{Commands, Query}, +use crate::{ + accept_resource_packs::AcceptResourcePacksPlugin, + app::{App, Plugin, PluginGroup, PluginGroupBuilder}, + auto_respawn::AutoRespawnPlugin, + container::ContainerPlugin, + ecs::{ + component::Component, + entity::Entity, + event::EventReader, + query::{With, Without}, + system::{Commands, Query}, + }, + pathfinder::PathfinderPlugin, }; -use crate::pathfinder::PathfinderPlugin; #[derive(Clone, Default)] pub struct BotPlugin; diff --git a/azalea/src/container.rs b/azalea/src/container.rs index ebc033f3..6715cd63 100644 --- a/azalea/src/container.rs +++ b/azalea/src/container.rs @@ -1,10 +1,9 @@ -use std::fmt; -use std::fmt::Debug; +use std::{fmt, fmt::Debug}; -use azalea_client::packet::game::ReceiveGamePacketEvent; use azalea_client::{ Client, inventory::{CloseContainerEvent, ContainerClickEvent, Inventory}, + packet::game::ReceiveGamePacketEvent, }; use azalea_core::position::BlockPos; use azalea_inventory::{ItemStack, Menu, operations::ClickOperation}; diff --git a/azalea/src/lib.rs b/azalea/src/lib.rs index 26dde1fa..25c317e2 100644 --- a/azalea/src/lib.rs +++ b/azalea/src/lib.rs @@ -13,8 +13,7 @@ pub mod pathfinder; pub mod prelude; pub mod swarm; -use std::net::SocketAddr; -use std::time::Duration; +use std::{net::SocketAddr, time::Duration}; use app::Plugins; pub use azalea_auth as auth; @@ -39,8 +38,7 @@ pub use bevy_ecs as ecs; pub use bot::*; use ecs::component::Component; use futures::{Future, future::BoxFuture}; -use protocol::connect::Proxy; -use protocol::{ServerAddress, resolver::ResolverError}; +use protocol::{ServerAddress, connect::Proxy, resolver::ResolverError}; use swarm::SwarmBuilder; use thiserror::Error; diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs index 58c3736c..1b8a71c8 100644 --- a/azalea/src/pathfinder/mod.rs +++ b/azalea/src/pathfinder/mod.rs @@ -12,23 +12,27 @@ pub mod rel_block_pos; pub mod simulation; pub mod world; -use std::collections::VecDeque; -use std::ops::RangeInclusive; -use std::sync::Arc; -use std::sync::atomic::{self, AtomicUsize}; -use std::time::{Duration, Instant}; -use std::{cmp, thread}; +use std::{ + cmp, + collections::VecDeque, + ops::RangeInclusive, + sync::{ + Arc, + atomic::{self, AtomicUsize}, + }, + thread, + time::{Duration, Instant}, +}; use astar::{Edge, PathfinderTimeout}; -use azalea_client::inventory::{Inventory, InventorySet, SetSelectedHotbarSlotEvent}; -use azalea_client::mining::{Mining, StartMiningBlockEvent}; -use azalea_client::movement::MoveEventsSet; -use azalea_client::{InstanceHolder, StartSprintEvent, StartWalkEvent}; -use azalea_core::position::BlockPos; -use azalea_core::tick::GameTick; -use azalea_entity::LocalEntity; -use azalea_entity::metadata::Player; -use azalea_entity::{Physics, Position}; +use azalea_client::{ + InstanceHolder, StartSprintEvent, StartWalkEvent, + inventory::{Inventory, InventorySet, SetSelectedHotbarSlotEvent}, + mining::{Mining, StartMiningBlockEvent}, + movement::MoveEventsSet, +}; +use azalea_core::{position::BlockPos, tick::GameTick}; +use azalea_entity::{LocalEntity, Physics, Position, metadata::Player}; use azalea_physics::PhysicsSet; use azalea_world::{InstanceContainer, InstanceName}; use bevy_app::{PreUpdate, Update}; @@ -41,21 +45,25 @@ use rel_block_pos::RelBlockPos; use tokio::sync::broadcast::error::RecvError; use tracing::{debug, error, info, trace, warn}; -use self::debug::debug_render_path_with_particles; -use self::goals::Goal; -use self::mining::MiningCache; -use self::moves::{ExecuteCtx, IsReachedCtx, SuccessorsFn}; -use crate::app::{App, Plugin}; -use crate::bot::{JumpEvent, LookAtEvent}; -use crate::ecs::{ - component::Component, - entity::Entity, - event::{EventReader, EventWriter}, - query::{With, Without}, - system::{Commands, Query, Res}, +use self::{ + debug::debug_render_path_with_particles, + goals::Goal, + mining::MiningCache, + moves::{ExecuteCtx, IsReachedCtx, SuccessorsFn}, +}; +use crate::{ + BotClientExt, WalkDirection, + app::{App, Plugin}, + bot::{JumpEvent, LookAtEvent}, + ecs::{ + component::Component, + entity::Entity, + event::{EventReader, EventWriter}, + query::{With, Without}, + system::{Commands, Query, Res}, + }, + pathfinder::{astar::a_star, moves::PathfinderCtx, world::CachedWorld}, }; -use crate::pathfinder::{astar::a_star, moves::PathfinderCtx, world::CachedWorld}; -use crate::{BotClientExt, WalkDirection}; #[derive(Clone, Default)] pub struct PathfinderPlugin; diff --git a/azalea/src/prelude.rs b/azalea/src/prelude.rs index 648fad6a..969b1e86 100644 --- a/azalea/src/prelude.rs +++ b/azalea/src/prelude.rs @@ -6,8 +6,10 @@ pub use azalea_core::tick::GameTick; // this is necessary to make the macros that reference bevy_ecs work pub use crate::ecs as bevy_ecs; -pub use crate::ecs::{component::Component, resource::Resource}; pub use crate::{ - ClientBuilder, bot::BotClientExt, container::ContainerClientExt, + ClientBuilder, + bot::BotClientExt, + container::ContainerClientExt, + ecs::{component::Component, resource::Resource}, pathfinder::PathfinderClientExt, }; |
