aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--azalea-auth/src/cache.rs14
-rw-r--r--azalea-block/azalea-block-macros/src/lib.rs3
-rw-r--r--azalea-client/src/account.rs6
-rw-r--r--azalea-client/src/entity_query.rs3
-rw-r--r--azalea-client/src/plugins/movement.rs17
-rw-r--r--azalea-client/src/plugins/packet/config/mod.rs22
-rw-r--r--azalea-client/src/test_simulation.rs40
-rw-r--r--azalea-core/src/position.rs11
-rw-r--r--azalea-crypto/src/lib.rs3
-rw-r--r--azalea-protocol/examples/handshake_proxy.rs3
-rw-r--r--azalea-protocol/src/connect.rs49
-rw-r--r--azalea-protocol/src/read.rs16
-rw-r--r--azalea-registry/src/lib.rs6
-rw-r--r--azalea-world/src/chunk_storage.rs20
-rw-r--r--azalea-world/src/world.rs12
-rw-r--r--azalea/build.rs3
-rw-r--r--azalea/examples/nearest_entity.rs10
-rw-r--r--azalea/examples/steal.rs6
-rw-r--r--azalea/examples/testbot/commands.rs10
-rw-r--r--azalea/examples/testbot/main.rs14
-rw-r--r--azalea/src/accept_resource_packs.rs24
-rw-r--r--azalea/src/bot.rs36
-rw-r--r--azalea/src/container.rs5
-rw-r--r--azalea/src/lib.rs6
-rw-r--r--azalea/src/pathfinder/mod.rs66
-rw-r--r--azalea/src/prelude.rs6
-rw-r--r--rustfmt.toml1
27 files changed, 222 insertions, 190 deletions
diff --git a/azalea-auth/src/cache.rs b/azalea-auth/src/cache.rs
index 9207c46e..5b230f7d 100644
--- a/azalea-auth/src/cache.rs
+++ b/azalea-auth/src/cache.rs
@@ -1,13 +1,17 @@
//! Cache auth information
-use std::io;
-use std::path::Path;
-use std::time::{SystemTime, UNIX_EPOCH};
+use std::{
+ io,
+ path::Path,
+ time::{SystemTime, UNIX_EPOCH},
+};
use serde::{Deserialize, Serialize};
use thiserror::Error;
-use tokio::fs::{self, File};
-use tokio::io::{AsyncReadExt, AsyncWriteExt};
+use tokio::{
+ fs::{self, File},
+ io::{AsyncReadExt, AsyncWriteExt},
+};
use tracing::{debug, trace};
#[derive(Debug, Error)]
diff --git a/azalea-block/azalea-block-macros/src/lib.rs b/azalea-block/azalea-block-macros/src/lib.rs
index f1b5c10f..1905def0 100644
--- a/azalea-block/azalea-block-macros/src/lib.rs
+++ b/azalea-block/azalea-block-macros/src/lib.rs
@@ -2,8 +2,7 @@
mod utils;
-use std::collections::HashMap;
-use std::fmt::Write;
+use std::{collections::HashMap, fmt::Write};
use proc_macro::TokenStream;
use proc_macro2::TokenTree;
diff --git a/azalea-client/src/account.rs b/azalea-client/src/account.rs
index 9b2c2350..7e3f917d 100644
--- a/azalea-client/src/account.rs
+++ b/azalea-client/src/account.rs
@@ -2,8 +2,10 @@
use std::sync::Arc;
-use azalea_auth::AccessTokenResponse;
-use azalea_auth::certs::{Certificates, FetchCertificatesError};
+use azalea_auth::{
+ AccessTokenResponse,
+ certs::{Certificates, FetchCertificatesError},
+};
use bevy_ecs::component::Component;
use parking_lot::Mutex;
use thiserror::Error;
diff --git a/azalea-client/src/entity_query.rs b/azalea-client/src/entity_query.rs
index e6bef25f..e53cd652 100644
--- a/azalea-client/src/entity_query.rs
+++ b/azalea-client/src/entity_query.rs
@@ -3,8 +3,7 @@ use std::{any, sync::Arc};
use bevy_ecs::{
component::Component,
entity::Entity,
- query::QueryData,
- query::{QueryFilter, ROQueryItem},
+ query::{QueryData, QueryFilter, ROQueryItem},
world::World,
};
use parking_lot::Mutex;
diff --git a/azalea-client/src/plugins/movement.rs b/azalea-client/src/plugins/movement.rs
index 95fdeb6e..b4649f20 100644
--- a/azalea-client/src/plugins/movement.rs
+++ b/azalea-client/src/plugins/movement.rs
@@ -1,15 +1,15 @@
-use std::backtrace::Backtrace;
-use std::io;
+use std::{backtrace::Backtrace, io};
-use azalea_core::position::Vec3;
-use azalea_core::tick::GameTick;
-use azalea_entity::{Attributes, Jumping, metadata::Sprinting};
-use azalea_entity::{InLoadedChunk, LastSentPosition, LookDirection, Physics, Position};
+use azalea_core::{position::Vec3, tick::GameTick};
+use azalea_entity::{
+ Attributes, InLoadedChunk, Jumping, LastSentPosition, LookDirection, Physics, Position,
+ metadata::Sprinting,
+};
use azalea_physics::{PhysicsSet, ai_step};
-use azalea_protocol::packets::game::{ServerboundPlayerCommand, ServerboundPlayerInput};
use azalea_protocol::packets::{
Packet,
game::{
+ ServerboundPlayerCommand, ServerboundPlayerInput,
s_move_player_pos::ServerboundMovePlayerPos,
s_move_player_pos_rot::ServerboundMovePlayerPosRot,
s_move_player_rot::ServerboundMovePlayerRot,
@@ -21,8 +21,7 @@ use bevy_app::{App, Plugin, Update};
use bevy_ecs::prelude::*;
use thiserror::Error;
-use crate::client::Client;
-use crate::packet::game::SendPacketEvent;
+use crate::{client::Client, packet::game::SendPacketEvent};
#[derive(Error, Debug)]
pub enum MovePlayerError {
diff --git a/azalea-client/src/plugins/packet/config/mod.rs b/azalea-client/src/plugins/packet/config/mod.rs
index 861289b7..9c05705f 100644
--- a/azalea-client/src/plugins/packet/config/mod.rs
+++ b/azalea-client/src/plugins/packet/config/mod.rs
@@ -3,21 +3,23 @@ mod events;
use std::io::Cursor;
use azalea_entity::LocalEntity;
-use azalea_protocol::packets::ConnectionProtocol;
-use azalea_protocol::packets::config::*;
-use azalea_protocol::read::ReadPacketError;
-use azalea_protocol::read::deserialize_packet;
+use azalea_protocol::{
+ packets::{ConnectionProtocol, config::*},
+ read::{ReadPacketError, deserialize_packet},
+};
use bevy_ecs::prelude::*;
pub use events::*;
use tracing::{debug, warn};
use super::as_system;
-use crate::client::InConfigState;
-use crate::connection::RawConnection;
-use crate::disconnect::DisconnectEvent;
-use crate::packet::game::KeepAliveEvent;
-use crate::packet::game::ResourcePackEvent;
-use crate::{InstanceHolder, declare_packet_handlers};
+use crate::{
+ InstanceHolder,
+ client::InConfigState,
+ connection::RawConnection,
+ declare_packet_handlers,
+ disconnect::DisconnectEvent,
+ packet::game::{KeepAliveEvent, ResourcePackEvent},
+};
pub fn process_raw_packet(
ecs: &mut World,
diff --git a/azalea-client/src/test_simulation.rs b/azalea-client/src/test_simulation.rs
index e154a9d9..c9f28e01 100644
--- a/azalea-client/src/test_simulation.rs
+++ b/azalea-client/src/test_simulation.rs
@@ -2,34 +2,38 @@ use std::{fmt::Debug, sync::Arc};
use azalea_auth::game_profile::GameProfile;
use azalea_buf::AzaleaWrite;
-use azalea_core::delta::PositionDelta8;
-use azalea_core::game_type::{GameMode, OptionalGameType};
-use azalea_core::position::{ChunkPos, Vec3};
-use azalea_core::resource_location::ResourceLocation;
-use azalea_core::tick::GameTick;
+use azalea_core::{
+ delta::PositionDelta8,
+ game_type::{GameMode, OptionalGameType},
+ position::{ChunkPos, Vec3},
+ resource_location::ResourceLocation,
+ tick::GameTick,
+};
use azalea_entity::metadata::PlayerMetadataBundle;
-use azalea_protocol::packets::common::CommonPlayerSpawnInfo;
-use azalea_protocol::packets::config::{ClientboundFinishConfiguration, ClientboundRegistryData};
-use azalea_protocol::packets::game::c_level_chunk_with_light::ClientboundLevelChunkPacketData;
-use azalea_protocol::packets::game::c_light_update::ClientboundLightUpdatePacketData;
-use azalea_protocol::packets::game::{
- ClientboundAddEntity, ClientboundLevelChunkWithLight, ClientboundLogin, ClientboundRespawn,
+use azalea_protocol::packets::{
+ ConnectionProtocol, Packet, ProtocolPacket,
+ common::CommonPlayerSpawnInfo,
+ config::{ClientboundFinishConfiguration, ClientboundRegistryData},
+ game::{
+ ClientboundAddEntity, ClientboundLevelChunkWithLight, ClientboundLogin, ClientboundRespawn,
+ c_level_chunk_with_light::ClientboundLevelChunkPacketData,
+ c_light_update::ClientboundLightUpdatePacketData,
+ },
};
-use azalea_protocol::packets::{ConnectionProtocol, Packet, ProtocolPacket};
use azalea_registry::{DimensionType, EntityKind};
-use azalea_world::palette::{PalettedContainer, PalettedContainerKind};
-use azalea_world::{Chunk, Instance, MinecraftEntityId, Section};
+use azalea_world::{
+ Chunk, Instance, MinecraftEntityId, Section,
+ palette::{PalettedContainer, PalettedContainerKind},
+};
use bevy_app::App;
-use bevy_ecs::component::Mutable;
-use bevy_ecs::{prelude::*, schedule::ExecutorKind};
+use bevy_ecs::{component::Mutable, prelude::*, schedule::ExecutorKind};
use parking_lot::RwLock;
use simdnbt::owned::{NbtCompound, NbtTag};
use uuid::Uuid;
-use crate::connection::RawConnection;
-use crate::disconnect::DisconnectEvent;
use crate::{
ClientInformation, GameProfileComponent, InConfigState, InstanceHolder, LocalPlayerBundle,
+ connection::RawConnection, disconnect::DisconnectEvent,
};
/// A way to simulate a client in a server, used for some internal tests.
diff --git a/azalea-core/src/position.rs b/azalea-core/src/position.rs
index ea3df79b..e090b3f9 100644
--- a/azalea-core/src/position.rs
+++ b/azalea-core/src/position.rs
@@ -3,21 +3,18 @@
//! The most common ones are [`Vec3`] and [`BlockPos`], which are usually used
//! for entity positions and block positions, respectively.
-use std::hash::Hasher;
-use std::io;
-use std::str::FromStr;
use std::{
fmt,
- hash::Hash,
+ hash::{Hash, Hasher},
+ io,
io::{Cursor, Write},
ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Rem, Sub},
+ str::FromStr,
};
use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError};
-use crate::direction::Direction;
-use crate::math;
-use crate::resource_location::ResourceLocation;
+use crate::{direction::Direction, math, resource_location::ResourceLocation};
macro_rules! vec3_impl {
($name:ident, $type:ty) => {
diff --git a/azalea-crypto/src/lib.rs b/azalea-crypto/src/lib.rs
index b087c426..4f780431 100644
--- a/azalea-crypto/src/lib.rs
+++ b/azalea-crypto/src/lib.rs
@@ -2,10 +2,9 @@
mod signing;
-use aes::cipher::inout::InOutBuf;
use aes::{
Aes128,
- cipher::{BlockDecryptMut, BlockEncryptMut, KeyIvInit},
+ cipher::{BlockDecryptMut, BlockEncryptMut, KeyIvInit, inout::InOutBuf},
};
use rand::{RngCore, rngs::OsRng};
use sha1::{Digest, Sha1};
diff --git a/azalea-protocol/examples/handshake_proxy.rs b/azalea-protocol/examples/handshake_proxy.rs
index 0161258a..cfe4af52 100644
--- a/azalea-protocol/examples/handshake_proxy.rs
+++ b/azalea-protocol/examples/handshake_proxy.rs
@@ -25,8 +25,7 @@ use tokio::{
io::{self, AsyncWriteExt},
net::{TcpListener, TcpStream},
};
-use tracing::Level;
-use tracing::{error, info, warn};
+use tracing::{Level, error, info, warn};
const LISTEN_ADDR: &str = "127.0.0.1:25566";
const PROXY_ADDR: &str = "127.0.0.1:25565";
diff --git a/azalea-protocol/src/connect.rs b/azalea-protocol/src/connect.rs
index bd8cf115..5268554d 100644
--- a/azalea-protocol/src/connect.rs
+++ b/azalea-protocol/src/connect.rs
@@ -1,29 +1,40 @@
//! Connect to remote servers/clients.
-use std::fmt::{self, Debug, Display};
-use std::io::{self, Cursor};
-use std::marker::PhantomData;
-use std::net::SocketAddr;
-
-use azalea_auth::game_profile::GameProfile;
-use azalea_auth::sessionserver::{ClientSessionServerError, ServerSessionServerError};
+use std::{
+ fmt::{self, Debug, Display},
+ io::{self, Cursor},
+ marker::PhantomData,
+ net::SocketAddr,
+};
+
+use azalea_auth::{
+ game_profile::GameProfile,
+ sessionserver::{ClientSessionServerError, ServerSessionServerError},
+};
use azalea_crypto::{Aes128CfbDec, Aes128CfbEnc};
use thiserror::Error;
-use tokio::io::{AsyncWriteExt, BufStream};
-use tokio::net::TcpStream;
-use tokio::net::tcp::{OwnedReadHalf, OwnedWriteHalf, ReuniteError};
+use tokio::{
+ io::{AsyncWriteExt, BufStream},
+ net::{
+ TcpStream,
+ tcp::{OwnedReadHalf, OwnedWriteHalf, ReuniteError},
+ },
+};
use tracing::{error, info};
use uuid::Uuid;
-use crate::packets::ProtocolPacket;
-use crate::packets::config::{ClientboundConfigPacket, ServerboundConfigPacket};
-use crate::packets::game::{ClientboundGamePacket, ServerboundGamePacket};
-use crate::packets::handshake::{ClientboundHandshakePacket, ServerboundHandshakePacket};
-use crate::packets::login::c_hello::ClientboundHello;
-use crate::packets::login::{ClientboundLoginPacket, ServerboundLoginPacket};
-use crate::packets::status::{ClientboundStatusPacket, ServerboundStatusPacket};
-use crate::read::{ReadPacketError, deserialize_packet, read_raw_packet, try_read_raw_packet};
-use crate::write::{serialize_packet, write_raw_packet};
+use crate::{
+ packets::{
+ ProtocolPacket,
+ config::{ClientboundConfigPacket, ServerboundConfigPacket},
+ game::{ClientboundGamePacket, ServerboundGamePacket},
+ handshake::{ClientboundHandshakePacket, ServerboundHandshakePacket},
+ login::{ClientboundLoginPacket, ServerboundLoginPacket, c_hello::ClientboundHello},
+ status::{ClientboundStatusPacket, ServerboundStatusPacket},
+ },
+ read::{ReadPacketError, deserialize_packet, read_raw_packet, try_read_raw_packet},
+ write::{serialize_packet, write_raw_packet},
+};
pub struct RawReadConnection {
pub read_stream: OwnedReadHalf,
diff --git a/azalea-protocol/src/read.rs b/azalea-protocol/src/read.rs
index 422d7f7a..433a2718 100644
--- a/azalea-protocol/src/read.rs
+++ b/azalea-protocol/src/read.rs
@@ -1,23 +1,25 @@
//! Read packets from a stream.
-use std::backtrace::Backtrace;
-use std::sync::LazyLock;
-use std::{env, io};
use std::{
+ backtrace::Backtrace,
+ env,
fmt::Debug,
+ io,
io::{Cursor, Read},
+ sync::LazyLock,
};
-use azalea_buf::AzaleaReadVar;
-use azalea_buf::BufReadError;
+use azalea_buf::{AzaleaReadVar, BufReadError};
use azalea_crypto::Aes128CfbDec;
use flate2::read::ZlibDecoder;
use futures::StreamExt;
use futures_lite::future;
use thiserror::Error;
use tokio::io::AsyncRead;
-use tokio_util::bytes::Buf;
-use tokio_util::codec::{BytesCodec, FramedRead};
+use tokio_util::{
+ bytes::Buf,
+ codec::{BytesCodec, FramedRead},
+};
use tracing::trace;
use crate::packets::ProtocolPacket;
diff --git a/azalea-registry/src/lib.rs b/azalea-registry/src/lib.rs
index 4f0623f6..56e20028 100644
--- a/azalea-registry/src/lib.rs
+++ b/azalea-registry/src/lib.rs
@@ -9,8 +9,10 @@ mod data;
mod extra;
pub mod tags;
-use std::fmt::{self, Debug};
-use std::io::{self, Cursor, Write};
+use std::{
+ fmt::{self, Debug},
+ io::{self, Cursor, Write},
+};
use azalea_buf::{AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError};
use azalea_registry_macros::registry;
diff --git a/azalea-world/src/chunk_storage.rs b/azalea-world/src/chunk_storage.rs
index b3ccbe3a..b65c86b1 100644
--- a/azalea-world/src/chunk_storage.rs
+++ b/azalea-world/src/chunk_storage.rs
@@ -1,24 +1,26 @@
-use std::collections::hash_map::Entry;
use std::{
- collections::HashMap,
+ collections::{HashMap, hash_map::Entry},
+ fmt,
fmt::Debug,
+ io,
io::{Cursor, Write},
sync::{Arc, Weak},
};
-use std::{fmt, io};
-use azalea_block::block_state::{BlockState, BlockStateIntegerRepr};
-use azalea_block::fluid_state::FluidState;
+use azalea_block::{
+ block_state::{BlockState, BlockStateIntegerRepr},
+ fluid_state::FluidState,
+};
use azalea_buf::{AzaleaRead, AzaleaWrite, BufReadError};
use azalea_core::position::{BlockPos, ChunkBlockPos, ChunkPos, ChunkSectionBlockPos};
use nohash_hasher::IntMap;
use parking_lot::RwLock;
use tracing::{debug, trace, warn};
-use crate::heightmap::Heightmap;
-use crate::heightmap::HeightmapKind;
-use crate::palette::PalettedContainer;
-use crate::palette::PalettedContainerKind;
+use crate::{
+ heightmap::{Heightmap, HeightmapKind},
+ palette::{PalettedContainer, PalettedContainerKind},
+};
const SECTION_HEIGHT: u32 = 16;
diff --git a/azalea-world/src/world.rs b/azalea-world/src/world.rs
index 9a734ab1..183f59b5 100644
--- a/azalea-world/src/world.rs
+++ b/azalea-world/src/world.rs
@@ -1,16 +1,16 @@
use std::{
collections::{HashMap, HashSet},
- fmt::Debug,
- fmt::{self, Display},
+ fmt::{self, Debug, Display},
hash::{Hash, Hasher},
io::{self, Cursor},
};
-use azalea_block::BlockState;
-use azalea_block::fluid_state::FluidState;
+use azalea_block::{BlockState, fluid_state::FluidState};
use azalea_buf::{AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError};
-use azalea_core::position::{BlockPos, ChunkPos};
-use azalea_core::registry_holder::RegistryHolder;
+use azalea_core::{
+ position::{BlockPos, ChunkPos},
+ registry_holder::RegistryHolder,
+};
use bevy_ecs::{component::Component, entity::Entity};
use derive_more::{Deref, DerefMut};
use nohash_hasher::IntMap;
diff --git a/azalea/build.rs b/azalea/build.rs
index cd0a16b2..faed1365 100644
--- a/azalea/build.rs
+++ b/azalea/build.rs
@@ -1,5 +1,4 @@
-use std::env;
-use std::process::Command;
+use std::{env, process::Command};
fn main() {
// If using `rustup`, check the toolchain via `RUSTUP_TOOLCHAIN`
diff --git a/azalea/examples/nearest_entity.rs b/azalea/examples/nearest_entity.rs
index 1fb6bdd1..2e6973cf 100644
--- a/azalea/examples/nearest_entity.rs
+++ b/azalea/examples/nearest_entity.rs
@@ -1,10 +1,10 @@
-use azalea::ClientBuilder;
-use azalea::nearest_entity::EntityFinder;
-use azalea::{Bot, LookAtEvent};
+use azalea::{Bot, ClientBuilder, LookAtEvent, nearest_entity::EntityFinder};
use azalea_client::Account;
use azalea_core::tick::GameTick;
-use azalea_entity::metadata::{ItemItem, Player};
-use azalea_entity::{EyeHeight, LocalEntity, Position};
+use azalea_entity::{
+ EyeHeight, LocalEntity, Position,
+ metadata::{ItemItem, Player},
+};
use bevy_app::Plugin;
use bevy_ecs::{
prelude::{Entity, EventWriter},
diff --git a/azalea/examples/steal.rs b/azalea/examples/steal.rs
index 028c1b5a..899c2568 100644
--- a/azalea/examples/steal.rs
+++ b/azalea/examples/steal.rs
@@ -2,10 +2,8 @@
use std::sync::Arc;
-use azalea::pathfinder::goals::RadiusGoal;
-use azalea::{BlockPos, prelude::*};
-use azalea_inventory::ItemStack;
-use azalea_inventory::operations::QuickMoveClick;
+use azalea::{BlockPos, pathfinder::goals::RadiusGoal, prelude::*};
+use azalea_inventory::{ItemStack, operations::QuickMoveClick};
use parking_lot::Mutex;
#[tokio::main]
diff --git a/azalea/examples/testbot/commands.rs b/azalea/examples/testbot/commands.rs
index 4e261e17..da6b7cc2 100644
--- a/azalea/examples/testbot/commands.rs
+++ b/azalea/examples/testbot/commands.rs
@@ -2,12 +2,10 @@ 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, GameProfileComponent, brigadier::prelude::*, chat::ChatPacket, ecs::prelude::*,
+ entity::metadata::Player,
+};
use parking_lot::Mutex;
use crate::State;
diff --git a/azalea/examples/testbot/main.rs b/azalea/examples/testbot/main.rs
index 1aa9485d..8a35a281 100644
--- a/azalea/examples/testbot/main.rs
+++ b/azalea/examples/testbot/main.rs
@@ -25,16 +25,12 @@
mod commands;
pub mod killaura;
-use std::time::Duration;
-use std::{env, process};
-use std::{sync::Arc, thread};
+use std::{env, process, sync::Arc, thread, time::Duration};
-use azalea::ClientInformation;
-use azalea::brigadier::command_dispatcher::CommandDispatcher;
-use azalea::ecs::prelude::*;
-use azalea::pathfinder::debug::PathfinderDebugParticles;
-use azalea::prelude::*;
-use azalea::swarm::prelude::*;
+use azalea::{
+ ClientInformation, brigadier::command_dispatcher::CommandDispatcher, ecs::prelude::*,
+ pathfinder::debug::PathfinderDebugParticles, prelude::*, swarm::prelude::*,
+};
use commands::{CommandSource, register_commands};
use parking_lot::Mutex;
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,
};
diff --git a/rustfmt.toml b/rustfmt.toml
index 35672d06..e5106793 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -1,2 +1,3 @@
wrap_comments = true
group_imports = "StdExternalCrate"
+imports_granularity = "Crate"