aboutsummaryrefslogtreecommitdiff
path: root/azalea
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-02-22 23:01:54 +0000
committermat <git@matdoes.dev>2025-02-22 23:01:54 +0000
commit34f53baf85fb5c7163ec5d71a8ab9d45d3f271b6 (patch)
tree7920fec1203e8e96463a142f5f6da6164e76e684 /azalea
parentbdd2fc91e11e2896d8e1c7046df247e1075bd40d (diff)
downloadazalea-drasl-34f53baf85fb5c7163ec5d71a8ab9d45d3f271b6.tar.xz
update to rust edition 2024
Diffstat (limited to 'azalea')
-rw-r--r--azalea/benches/checks.rs2
-rw-r--r--azalea/benches/pathfinder.rs8
-rw-r--r--azalea/benches/physics.rs4
-rw-r--r--azalea/build.rs8
-rw-r--r--azalea/examples/nearest_entity.rs2
-rw-r--r--azalea/examples/steal.rs4
-rw-r--r--azalea/examples/testbot/commands.rs4
-rw-r--r--azalea/examples/testbot/commands/debug.rs2
-rw-r--r--azalea/examples/testbot/commands/movement.rs2
-rw-r--r--azalea/examples/testbot/killaura.rs2
-rw-r--r--azalea/examples/testbot/main.rs4
-rw-r--r--azalea/src/auto_respawn.rs2
-rw-r--r--azalea/src/auto_tool.rs6
-rw-r--r--azalea/src/bot.rs9
-rw-r--r--azalea/src/container.rs4
-rw-r--r--azalea/src/lib.rs4
-rw-r--r--azalea/src/pathfinder/debug.rs22
-rw-r--r--azalea/src/pathfinder/mining.rs2
-rw-r--r--azalea/src/pathfinder/mod.rs91
-rw-r--r--azalea/src/pathfinder/moves/basic.rs2
-rw-r--r--azalea/src/pathfinder/moves/mod.rs8
-rw-r--r--azalea/src/pathfinder/simulation.rs6
-rw-r--r--azalea/src/prelude.rs4
-rw-r--r--azalea/src/swarm/mod.rs27
24 files changed, 121 insertions, 108 deletions
diff --git a/azalea/benches/checks.rs b/azalea/benches/checks.rs
index b246f1f6..ee737359 100644
--- a/azalea/benches/checks.rs
+++ b/azalea/benches/checks.rs
@@ -2,7 +2,7 @@ use std::hint::black_box;
use azalea::pathfinder::mining::MiningCache;
pub use azalea_registry as registry;
-use criterion::{criterion_group, criterion_main, Criterion};
+use criterion::{Criterion, criterion_group, criterion_main};
fn benchmark(c: &mut Criterion) {
let mining_cache = MiningCache::new(None);
diff --git a/azalea/benches/pathfinder.rs b/azalea/benches/pathfinder.rs
index bc6a2fea..79c8efc9 100644
--- a/azalea/benches/pathfinder.rs
+++ b/azalea/benches/pathfinder.rs
@@ -1,21 +1,21 @@
use std::{hint::black_box, sync::Arc, time::Duration};
use azalea::{
+ BlockPos,
pathfinder::{
- astar::{self, a_star, PathfinderTimeout},
+ astar::{self, PathfinderTimeout, a_star},
goals::{BlockPosGoal, Goal},
mining::MiningCache,
rel_block_pos::RelBlockPos,
world::CachedWorld,
},
- BlockPos,
};
use azalea_core::position::{ChunkBlockPos, ChunkPos};
use azalea_inventory::Menu;
use azalea_world::{Chunk, ChunkStorage, PartialChunkStorage};
-use criterion::{criterion_group, criterion_main, Bencher, Criterion};
+use criterion::{Bencher, Criterion, criterion_group, criterion_main};
use parking_lot::RwLock;
-use rand::{rngs::StdRng, Rng, SeedableRng};
+use rand::{Rng, SeedableRng, rngs::StdRng};
#[allow(dead_code)]
fn generate_bedrock_world(
diff --git a/azalea/benches/physics.rs b/azalea/benches/physics.rs
index 146b3018..5eb164d7 100644
--- a/azalea/benches/physics.rs
+++ b/azalea/benches/physics.rs
@@ -1,10 +1,10 @@
use azalea::{
- pathfinder::simulation::{SimulatedPlayerBundle, SimulationSet},
Vec3,
+ pathfinder::simulation::{SimulatedPlayerBundle, SimulationSet},
};
use azalea_core::position::{ChunkBlockPos, ChunkPos};
use azalea_world::{Chunk, ChunkStorage, PartialChunkStorage};
-use criterion::{criterion_group, criterion_main, Bencher, Criterion};
+use criterion::{Bencher, Criterion, criterion_group, criterion_main};
#[allow(dead_code)]
fn generate_world(partial_chunks: &mut PartialChunkStorage, size: u32) -> ChunkStorage {
diff --git a/azalea/build.rs b/azalea/build.rs
index 18300151..cd0a16b2 100644
--- a/azalea/build.rs
+++ b/azalea/build.rs
@@ -7,7 +7,9 @@ fn main() {
if toolchain.contains("nightly") {
return;
} else {
- panic!("Azalea currently requires nightly Rust. You can run `rustup override set nightly` to set the toolchain for this directory.");
+ panic!(
+ "Azalea currently requires nightly Rust. You can run `rustup override set nightly` to set the toolchain for this directory."
+ );
}
}
@@ -22,7 +24,9 @@ fn main() {
if rustc_command.status.success() {
let rustc_output = String::from_utf8(rustc_command.stdout).unwrap();
if !rustc_output.contains("nightly") {
- panic!("Azalea currently requires nightly Rust. Please check the documentation for your installation method and ensure you are using the nightly toolchain.");
+ panic!(
+ "Azalea currently requires nightly Rust. Please check the documentation for your installation method and ensure you are using the nightly toolchain."
+ );
}
} else {
let rustc_output = String::from_utf8(rustc_command.stderr).unwrap();
diff --git a/azalea/examples/nearest_entity.rs b/azalea/examples/nearest_entity.rs
index d50e6c46..911f9f58 100644
--- a/azalea/examples/nearest_entity.rs
+++ b/azalea/examples/nearest_entity.rs
@@ -1,5 +1,5 @@
-use azalea::nearest_entity::EntityFinder;
use azalea::ClientBuilder;
+use azalea::nearest_entity::EntityFinder;
use azalea::{Bot, LookAtEvent};
use azalea_client::Account;
use azalea_core::tick::GameTick;
diff --git a/azalea/examples/steal.rs b/azalea/examples/steal.rs
index f64fb8f3..74501ada 100644
--- a/azalea/examples/steal.rs
+++ b/azalea/examples/steal.rs
@@ -2,9 +2,9 @@
use std::sync::Arc;
-use azalea::{prelude::*, BlockPos};
-use azalea_inventory::operations::QuickMoveClick;
+use azalea::{BlockPos, prelude::*};
use azalea_inventory::ItemStack;
+use azalea_inventory::operations::QuickMoveClick;
use parking_lot::Mutex;
#[tokio::main]
diff --git a/azalea/examples/testbot/commands.rs b/azalea/examples/testbot/commands.rs
index 9cdb3cb7..c3cf1b47 100644
--- a/azalea/examples/testbot/commands.rs
+++ b/azalea/examples/testbot/commands.rs
@@ -2,12 +2,12 @@ pub mod combat;
pub mod debug;
pub mod movement;
+use azalea::Client;
+use azalea::GameProfileComponent;
use azalea::brigadier::prelude::*;
use azalea::chat::ChatPacket;
use azalea::ecs::prelude::*;
use azalea::entity::metadata::Player;
-use azalea::Client;
-use azalea::GameProfileComponent;
use parking_lot::Mutex;
use crate::State;
diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs
index 10b9711d..fe552668 100644
--- a/azalea/examples/testbot/commands/debug.rs
+++ b/azalea/examples/testbot/commands/debug.rs
@@ -3,12 +3,12 @@
use std::{env, fs::File, io::Write, thread, time::Duration};
use azalea::{
+ BlockPos,
brigadier::prelude::*,
entity::{LookDirection, Position},
interact::HitResultComponent,
pathfinder::{ExecutingPath, Pathfinder},
world::MinecraftEntityId,
- BlockPos,
};
use parking_lot::Mutex;
diff --git a/azalea/examples/testbot/commands/movement.rs b/azalea/examples/testbot/commands/movement.rs
index b0adec8b..a8511cc5 100644
--- a/azalea/examples/testbot/commands/movement.rs
+++ b/azalea/examples/testbot/commands/movement.rs
@@ -1,11 +1,11 @@
use std::time::Duration;
use azalea::{
+ BlockPos, SprintDirection, WalkDirection,
brigadier::prelude::*,
entity::{EyeHeight, Position},
pathfinder::goals::{BlockPosGoal, RadiusGoal, XZGoal},
prelude::*,
- BlockPos, SprintDirection, WalkDirection,
};
use parking_lot::Mutex;
diff --git a/azalea/examples/testbot/killaura.rs b/azalea/examples/testbot/killaura.rs
index d86356fe..e98fe6ec 100644
--- a/azalea/examples/testbot/killaura.rs
+++ b/azalea/examples/testbot/killaura.rs
@@ -1,6 +1,6 @@
use azalea::{
ecs::prelude::*,
- entity::{metadata::AbstractMonster, Dead, LocalEntity, Position},
+ entity::{Dead, LocalEntity, Position, metadata::AbstractMonster},
prelude::*,
world::{InstanceName, MinecraftEntityId},
};
diff --git a/azalea/examples/testbot/main.rs b/azalea/examples/testbot/main.rs
index 958c17d0..410d1b6d 100644
--- a/azalea/examples/testbot/main.rs
+++ b/azalea/examples/testbot/main.rs
@@ -29,13 +29,13 @@ use std::time::Duration;
use std::{env, process};
use std::{sync::Arc, thread};
+use azalea::ClientInformation;
use azalea::brigadier::command_dispatcher::CommandDispatcher;
use azalea::ecs::prelude::*;
use azalea::pathfinder::PathfinderDebugParticles;
use azalea::prelude::*;
use azalea::swarm::prelude::*;
-use azalea::ClientInformation;
-use commands::{register_commands, CommandSource};
+use commands::{CommandSource, register_commands};
use parking_lot::Mutex;
#[tokio::main]
diff --git a/azalea/src/auto_respawn.rs b/azalea/src/auto_respawn.rs
index 43ec4821..191e6df7 100644
--- a/azalea/src/auto_respawn.rs
+++ b/azalea/src/auto_respawn.rs
@@ -1,6 +1,6 @@
use azalea_client::{
packet_handling::{death_event_on_0_health, game::DeathEvent},
- respawn::{perform_respawn, PerformRespawnEvent},
+ respawn::{PerformRespawnEvent, perform_respawn},
};
use bevy_app::Update;
use bevy_ecs::prelude::*;
diff --git a/azalea/src/auto_tool.rs b/azalea/src/auto_tool.rs
index 9aea23d7..81fe3131 100644
--- a/azalea/src/auto_tool.rs
+++ b/azalea/src/auto_tool.rs
@@ -1,7 +1,7 @@
-use azalea_block::{fluid_state::FluidKind, Block, BlockState};
-use azalea_client::{inventory::Inventory, Client};
+use azalea_block::{Block, BlockState, fluid_state::FluidKind};
+use azalea_client::{Client, inventory::Inventory};
use azalea_entity::{FluidOnEyes, Physics};
-use azalea_inventory::{components, ItemStack, Menu};
+use azalea_inventory::{ItemStack, Menu, components};
#[derive(Debug)]
pub struct BestToolResult {
diff --git a/azalea/src/bot.rs b/azalea/src/bot.rs
index 539a5281..aae8af05 100644
--- a/azalea/src/bot.rs
+++ b/azalea/src/bot.rs
@@ -1,13 +1,13 @@
use std::f64::consts::PI;
+use azalea_client::TickBroadcast;
use azalea_client::interact::SwingArmEvent;
use azalea_client::mining::Mining;
-use azalea_client::TickBroadcast;
use azalea_core::position::{BlockPos, Vec3};
use azalea_core::tick::GameTick;
use azalea_entity::{
- clamp_look_direction, metadata::Player, EyeHeight, Jumping, LocalEntity, LookDirection,
- Position,
+ EyeHeight, Jumping, LocalEntity, LookDirection, Position, clamp_look_direction,
+ metadata::Player,
};
use azalea_physics::PhysicsSet;
use bevy_app::Update;
@@ -185,8 +185,7 @@ fn look_at_listener(
direction_looking_at(&position.up(eye_height.into()), &event.position);
trace!(
"look at {:?} (currently at {:?})",
- event.position,
- **position
+ event.position, **position
);
*look_direction = new_look_direction;
}
diff --git a/azalea/src/container.rs b/azalea/src/container.rs
index 38877616..e1a018b0 100644
--- a/azalea/src/container.rs
+++ b/azalea/src/container.rs
@@ -2,12 +2,12 @@ use std::fmt::Debug;
use std::fmt::Formatter;
use azalea_client::{
+ Client,
inventory::{CloseContainerEvent, ContainerClickEvent, Inventory},
packet_handling::game::PacketEvent,
- Client,
};
use azalea_core::position::BlockPos;
-use azalea_inventory::{operations::ClickOperation, ItemStack, Menu};
+use azalea_inventory::{ItemStack, Menu, operations::ClickOperation};
use azalea_protocol::packets::game::ClientboundGamePacket;
use bevy_app::{App, Plugin, Update};
use bevy_ecs::{component::Component, prelude::EventReader, system::Commands};
diff --git a/azalea/src/lib.rs b/azalea/src/lib.rs
index e50fde0a..0a8300b1 100644
--- a/azalea/src/lib.rs
+++ b/azalea/src/lib.rs
@@ -37,9 +37,9 @@ pub use bevy_app as app;
pub use bevy_ecs as ecs;
pub use bot::*;
use ecs::component::Component;
-use futures::{future::BoxFuture, Future};
+use futures::{Future, future::BoxFuture};
use protocol::connect::Proxy;
-use protocol::{resolver::ResolverError, ServerAddress};
+use protocol::{ServerAddress, resolver::ResolverError};
use swarm::SwarmBuilder;
use thiserror::Error;
diff --git a/azalea/src/pathfinder/debug.rs b/azalea/src/pathfinder/debug.rs
index ca08cbc5..98778cad 100644
--- a/azalea/src/pathfinder/debug.rs
+++ b/azalea/src/pathfinder/debug.rs
@@ -1,4 +1,4 @@
-use azalea_client::{chat::SendChatEvent, InstanceHolder};
+use azalea_client::{InstanceHolder, chat::SendChatEvent};
use azalea_core::position::Vec3;
use bevy_ecs::prelude::*;
@@ -89,16 +89,16 @@ pub fn debug_render_path_with_particles(
z: start_vec3.z + (end_vec3.z - start_vec3.z) * percent,
};
let particle_command = format!(
- "/particle dust{{color:[{r},{g},{b}],scale:{size}}} {start_x} {start_y} {start_z} {delta_x} {delta_y} {delta_z} 0 {count}",
- size = 1,
- start_x = pos.x,
- start_y = pos.y,
- start_z = pos.z,
- delta_x = 0,
- delta_y = 0,
- delta_z = 0,
- count = 1
- );
+ "/particle dust{{color:[{r},{g},{b}],scale:{size}}} {start_x} {start_y} {start_z} {delta_x} {delta_y} {delta_z} 0 {count}",
+ size = 1,
+ start_x = pos.x,
+ start_y = pos.y,
+ start_z = pos.z,
+ delta_x = 0,
+ delta_y = 0,
+ delta_z = 0,
+ count = 1
+ );
chat_events.send(SendChatEvent {
entity,
content: particle_command,
diff --git a/azalea/src/pathfinder/mining.rs b/azalea/src/pathfinder/mining.rs
index 8c1b2e1d..40cdf8a2 100644
--- a/azalea/src/pathfinder/mining.rs
+++ b/azalea/src/pathfinder/mining.rs
@@ -1,7 +1,7 @@
use std::{cell::UnsafeCell, ops::RangeInclusive};
use azalea_block::{
- block_state::BlockStateIntegerRepr, properties::Waterlogged, BlockState, BlockStates,
+ BlockState, BlockStates, block_state::BlockStateIntegerRepr, properties::Waterlogged,
};
use azalea_inventory::Menu;
use nohash_hasher::IntMap;
diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs
index ae23788b..0db627ac 100644
--- a/azalea/src/pathfinder/mod.rs
+++ b/azalea/src/pathfinder/mod.rs
@@ -14,8 +14,8 @@ pub mod world;
use std::collections::VecDeque;
use std::ops::RangeInclusive;
-use std::sync::atomic::{self, AtomicUsize};
use std::sync::Arc;
+use std::sync::atomic::{self, AtomicUsize};
use std::time::{Duration, Instant};
use std::{cmp, thread};
@@ -26,8 +26,8 @@ use azalea_client::movement::MoveEventsSet;
use azalea_client::{InstanceHolder, StartSprintEvent, StartWalkEvent};
use azalea_core::position::BlockPos;
use azalea_core::tick::GameTick;
-use azalea_entity::metadata::Player;
use azalea_entity::LocalEntity;
+use azalea_entity::metadata::Player;
use azalea_entity::{Physics, Position};
use azalea_physics::PhysicsSet;
use azalea_world::{InstanceContainer, InstanceName};
@@ -42,11 +42,12 @@ use parking_lot::RwLock;
use rel_block_pos::RelBlockPos;
use tracing::{debug, error, info, trace, warn};
-use self::debug::debug_render_path_with_particles;
pub use self::debug::PathfinderDebugParticles;
+use self::debug::debug_render_path_with_particles;
use self::goals::Goal;
use self::mining::MiningCache;
use self::moves::{ExecuteCtx, IsReachedCtx, SuccessorsFn};
+use crate::WalkDirection;
use crate::app::{App, Plugin};
use crate::bot::{JumpEvent, LookAtEvent};
use crate::ecs::{
@@ -57,7 +58,6 @@ use crate::ecs::{
system::{Commands, Query, Res},
};
use crate::pathfinder::{astar::a_star, moves::PathfinderCtx, world::CachedWorld};
-use crate::WalkDirection;
#[derive(Clone, Default)]
pub struct PathfinderPlugin;
@@ -874,54 +874,62 @@ pub fn recalculate_near_end_of_path(
&& !pathfinder.is_calculating
&& executing_path.is_path_partial
{
- if let Some(goal) = pathfinder.goal.as_ref().cloned() {
- debug!("Recalculating path because it's empty or ends soon");
- debug!(
- "recalculate_near_end_of_path executing_path.is_path_partial: {}",
- executing_path.is_path_partial
- );
- goto_events.send(GotoEvent {
- entity,
- goal,
- successors_fn,
- allow_mining: pathfinder.allow_mining,
- min_timeout: if executing_path.path.len() == 50 {
- // we have quite some time until the node is reached, soooo we might as well
- // burn some cpu cycles to get a good path
- PathfinderTimeout::Time(Duration::from_secs(5))
- } else {
- PathfinderTimeout::Time(Duration::from_secs(1))
- },
- max_timeout: pathfinder.max_timeout.expect("max_timeout should be set"),
- });
- pathfinder.is_calculating = true;
+ match pathfinder.goal.as_ref().cloned() {
+ Some(goal) => {
+ debug!("Recalculating path because it's empty or ends soon");
+ debug!(
+ "recalculate_near_end_of_path executing_path.is_path_partial: {}",
+ executing_path.is_path_partial
+ );
+ goto_events.send(GotoEvent {
+ entity,
+ goal,
+ successors_fn,
+ allow_mining: pathfinder.allow_mining,
+ min_timeout: if executing_path.path.len() == 50 {
+ // we have quite some time until the node is reached, soooo we might as
+ // well burn some cpu cycles to get a good
+ // path
+ PathfinderTimeout::Time(Duration::from_secs(5))
+ } else {
+ PathfinderTimeout::Time(Duration::from_secs(1))
+ },
+ max_timeout: pathfinder.max_timeout.expect("max_timeout should be set"),
+ });
+ pathfinder.is_calculating = true;
- if executing_path.path.is_empty() {
- if let Some(new_path) = executing_path.queued_path.take() {
- executing_path.path = new_path;
- if executing_path.path.is_empty() {
- info!("the path we just swapped to was empty, so reached end of path");
+ if executing_path.path.is_empty() {
+ if let Some(new_path) = executing_path.queued_path.take() {
+ executing_path.path = new_path;
+ if executing_path.path.is_empty() {
+ info!(
+ "the path we just swapped to was empty, so reached end of path"
+ );
+ walk_events.send(StartWalkEvent {
+ entity,
+ direction: WalkDirection::None,
+ });
+ commands.entity(entity).remove::<ExecutingPath>();
+ break;
+ }
+ } else {
walk_events.send(StartWalkEvent {
entity,
direction: WalkDirection::None,
});
commands.entity(entity).remove::<ExecutingPath>();
- break;
}
- } else {
+ }
+ }
+ _ => {
+ if executing_path.path.is_empty() {
+ // idk when this can happen but stop moving just in case
walk_events.send(StartWalkEvent {
entity,
direction: WalkDirection::None,
});
- commands.entity(entity).remove::<ExecutingPath>();
}
}
- } else if executing_path.path.is_empty() {
- // idk when this can happen but stop moving just in case
- walk_events.send(StartWalkEvent {
- entity,
- direction: WalkDirection::None,
- });
}
}
}
@@ -968,8 +976,7 @@ pub fn tick_execute_path(
};
trace!(
"executing move, position: {}, last_reached_node: {}",
- **position,
- executing_path.last_reached_node
+ **position, executing_path.last_reached_node
);
(movement.data.execute)(ctx);
}
@@ -1117,11 +1124,11 @@ mod tests {
use azalea_world::{Chunk, ChunkStorage, PartialChunkStorage};
use super::{
+ GotoEvent,
astar::PathfinderTimeout,
goals::BlockPosGoal,
moves,
simulation::{SimulatedPlayerBundle, Simulation},
- GotoEvent,
};
fn setup_blockposgoal_simulation(
diff --git a/azalea/src/pathfinder/moves/basic.rs b/azalea/src/pathfinder/moves/basic.rs
index 8a679376..4955ed08 100644
--- a/azalea/src/pathfinder/moves/basic.rs
+++ b/azalea/src/pathfinder/moves/basic.rs
@@ -6,7 +6,7 @@ use azalea_core::{
position::{BlockPos, Vec3},
};
-use super::{default_is_reached, Edge, ExecuteCtx, IsReachedCtx, MoveData, PathfinderCtx};
+use super::{Edge, ExecuteCtx, IsReachedCtx, MoveData, PathfinderCtx, default_is_reached};
use crate::pathfinder::{astar, costs::*, rel_block_pos::RelBlockPos};
pub fn basic_move(ctx: &mut PathfinderCtx, node: RelBlockPos) {
diff --git a/azalea/src/pathfinder/moves/mod.rs b/azalea/src/pathfinder/moves/mod.rs
index 68c65d5d..83e6369f 100644
--- a/azalea/src/pathfinder/moves/mod.rs
+++ b/azalea/src/pathfinder/moves/mod.rs
@@ -4,8 +4,8 @@ pub mod parkour;
use std::{fmt::Debug, sync::Arc};
use azalea_client::{
- inventory::SetSelectedHotbarSlotEvent, mining::StartMiningBlockEvent, SprintDirection,
- StartSprintEvent, StartWalkEvent, WalkDirection,
+ SprintDirection, StartSprintEvent, StartWalkEvent, WalkDirection,
+ inventory::SetSelectedHotbarSlotEvent, mining::StartMiningBlockEvent,
};
use azalea_core::position::{BlockPos, Vec3};
use azalea_inventory::Menu;
@@ -17,9 +17,9 @@ use super::{
astar,
mining::MiningCache,
rel_block_pos::RelBlockPos,
- world::{is_block_state_passable, CachedWorld},
+ world::{CachedWorld, is_block_state_passable},
};
-use crate::{auto_tool::best_tool_in_hotbar_for_block, JumpEvent, LookAtEvent};
+use crate::{JumpEvent, LookAtEvent, auto_tool::best_tool_in_hotbar_for_block};
type Edge = astar::Edge<RelBlockPos, MoveData>;
diff --git a/azalea/src/pathfinder/simulation.rs b/azalea/src/pathfinder/simulation.rs
index 0067c19f..ab0e540a 100644
--- a/azalea/src/pathfinder/simulation.rs
+++ b/azalea/src/pathfinder/simulation.rs
@@ -2,10 +2,10 @@
use std::sync::Arc;
-use azalea_client::{inventory::Inventory, packet_handling::game::SendPacketEvent, PhysicsState};
+use azalea_client::{PhysicsState, inventory::Inventory, packet_handling::game::SendPacketEvent};
use azalea_core::{position::Vec3, resource_location::ResourceLocation, tick::GameTick};
use azalea_entity::{
- attributes::AttributeInstance, Attributes, EntityDimensions, LookDirection, Physics, Position,
+ Attributes, EntityDimensions, LookDirection, Physics, Position, attributes::AttributeInstance,
};
use azalea_registry::EntityKind;
use azalea_world::{ChunkStorage, Instance, InstanceContainer, MinecraftEntityId, PartialInstance};
@@ -87,7 +87,7 @@ fn create_simulation_instance(chunks: ChunkStorage) -> (App, Arc<RwLock<Instance
fn create_simulation_player_complete_bundle(
instance: Arc<RwLock<Instance>>,
player: &SimulatedPlayerBundle,
-) -> impl Bundle {
+) -> impl Bundle + use<> {
let instance_name = simulation_instance_name();
(
diff --git a/azalea/src/prelude.rs b/azalea/src/prelude.rs
index d1442b10..4f68f1ea 100644
--- a/azalea/src/prelude.rs
+++ b/azalea/src/prelude.rs
@@ -8,6 +8,6 @@ pub use azalea_core::tick::GameTick;
pub use crate::ecs as bevy_ecs;
pub use crate::ecs::{component::Component, system::Resource};
pub use crate::{
- bot::BotClientExt, container::ContainerClientExt, pathfinder::PathfinderClientExt,
- ClientBuilder,
+ ClientBuilder, bot::BotClientExt, container::ContainerClientExt,
+ pathfinder::PathfinderClientExt,
};
diff --git a/azalea/src/swarm/mod.rs b/azalea/src/swarm/mod.rs
index 696f751b..cc0d7eb1 100644
--- a/azalea/src/swarm/mod.rs
+++ b/azalea/src/swarm/mod.rs
@@ -9,14 +9,14 @@ pub mod prelude;
use std::{collections::HashMap, future::Future, net::SocketAddr, sync::Arc, time::Duration};
use azalea_client::{
- chat::ChatPacket, start_ecs_runner, Account, Client, DefaultPlugins, Event, JoinError,
- StartClientOpts,
+ Account, Client, DefaultPlugins, Event, JoinError, StartClientOpts, chat::ChatPacket,
+ start_ecs_runner,
};
-use azalea_protocol::{resolver, ServerAddress};
+use azalea_protocol::{ServerAddress, resolver};
use azalea_world::InstanceContainer;
use bevy_app::{App, PluginGroup, PluginGroupBuilder, Plugins};
use bevy_ecs::{component::Component, entity::Entity, system::Resource, world::World};
-use futures::future::{join_all, BoxFuture};
+use futures::future::{BoxFuture, join_all};
use parking_lot::{Mutex, RwLock};
use tokio::sync::mpsc;
use tracing::{debug, error};
@@ -692,14 +692,17 @@ impl Swarm {
.min(Duration::from_secs(15));
let username = account.username.clone();
- if let JoinError::Disconnect { reason } = &e {
- error!(
- "Error joining as {username}, server says: \"{reason}\". Waiting {delay:?} and trying again."
- );
- } else {
- error!(
- "Error joining as {username}: {e}. Waiting {delay:?} and trying again."
- );
+ match &e {
+ JoinError::Disconnect { reason } => {
+ error!(
+ "Error joining as {username}, server says: \"{reason}\". Waiting {delay:?} and trying again."
+ );
+ }
+ _ => {
+ error!(
+ "Error joining as {username}: {e}. Waiting {delay:?} and trying again."
+ );
+ }
}
tokio::time::sleep(delay).await;