aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xazalea-auth/src/auth.rs10
-rwxr-xr-xazalea-auth/src/cache.rs3
-rwxr-xr-xazalea-auth/src/game_profile.rs3
-rwxr-xr-xazalea-block/azalea-block-macros/src/lib.rs5
-rwxr-xr-xazalea-block/src/generated.rs6
-rwxr-xr-xazalea-block/src/lib.rs10
-rw-r--r--azalea-brigadier/src/arguments/bool_argument_type.rs3
-rw-r--r--azalea-brigadier/src/arguments/double_argument_type.rs3
-rw-r--r--azalea-brigadier/src/arguments/float_argument_type.rs3
-rw-r--r--azalea-brigadier/src/arguments/integer_argument_type.rs3
-rw-r--r--azalea-brigadier/src/arguments/long_argument_type.rs3
-rw-r--r--azalea-brigadier/src/arguments/string_argument_type.rs3
-rwxr-xr-xazalea-brigadier/src/builder/argument_builder.rs6
-rwxr-xr-xazalea-brigadier/src/builder/required_argument_builder.rs3
-rwxr-xr-xazalea-brigadier/src/command_dispatcher.rs15
-rwxr-xr-xazalea-brigadier/src/context/command_context.rs3
-rwxr-xr-xazalea-brigadier/src/context/command_context_builder.rs3
-rwxr-xr-xazalea-brigadier/src/context/parsed_argument.rs3
-rwxr-xr-xazalea-brigadier/src/context/parsed_command_node.rs3
-rwxr-xr-xazalea-brigadier/src/exceptions/builtin_exceptions.rs3
-rwxr-xr-xazalea-brigadier/src/exceptions/command_syntax_exception.rs3
-rwxr-xr-xazalea-brigadier/src/parse_results.rs3
-rwxr-xr-xazalea-brigadier/src/string_reader.rs3
-rwxr-xr-xazalea-brigadier/src/suggestion/mod.rs12
-rwxr-xr-xazalea-brigadier/src/suggestion/suggestions.rs12
-rwxr-xr-xazalea-brigadier/src/suggestion/suggestions_builder.rs3
-rwxr-xr-xazalea-brigadier/src/tree/mod.rs15
-rwxr-xr-xazalea-buf/src/lib.rs3
-rwxr-xr-xazalea-buf/src/read.rs6
-rwxr-xr-xazalea-buf/src/serializable_uuid.rs4
-rwxr-xr-xazalea-buf/src/write.rs6
-rwxr-xr-xazalea-chat/src/base_component.rs3
-rwxr-xr-xazalea-chat/src/component.rs16
-rwxr-xr-xazalea-chat/src/style.rs3
-rwxr-xr-xazalea-chat/src/text_component.rs9
-rwxr-xr-xazalea-chat/src/translatable_component.rs7
-rwxr-xr-xazalea-client/src/chat.rs9
-rw-r--r--azalea-client/src/client.rs67
-rw-r--r--azalea-client/src/movement.rs8
-rw-r--r--azalea-client/src/packet_handling/mod.rs3
-rwxr-xr-xazalea-client/src/ping.rs3
-rwxr-xr-xazalea-core/src/delta.rs3
-rw-r--r--azalea-core/src/game_type.rs3
-rwxr-xr-xazalea-core/src/position.rs10
-rw-r--r--azalea-core/src/registry_holder.rs3
-rwxr-xr-xazalea-core/src/resource_location.rs4
-rwxr-xr-xazalea-entity/src/data.rs3
-rw-r--r--azalea-entity/src/lib.rs11
-rw-r--r--azalea-entity/src/metadata.rs12
-rw-r--r--azalea-entity/src/plugin/indexing.rs6
-rw-r--r--azalea-entity/src/plugin/mod.rs5
-rw-r--r--azalea-inventory/azalea-inventory-macros/src/location_enum.rs3
-rw-r--r--azalea-inventory/azalea-inventory-macros/src/menu_enum.rs3
-rw-r--r--azalea-inventory/azalea-inventory-macros/src/menu_impl.rs7
-rw-r--r--azalea-inventory/src/slot.rs5
-rwxr-xr-xazalea-language/src/lib.rs3
-rw-r--r--azalea-physics/src/collision/blocks.rs5
-rwxr-xr-xazalea-physics/src/collision/mergers.rs3
-rwxr-xr-xazalea-physics/src/collision/shape.rs8
-rw-r--r--azalea-physics/src/collision/world_collisions.rs8
-rw-r--r--azalea-physics/src/lib.rs3
-rw-r--r--azalea-protocol/examples/handshake_proxy.rs3
-rwxr-xr-xazalea-protocol/src/connect.rs30
-rw-r--r--azalea-protocol/src/lib.rs5
-rw-r--r--azalea-protocol/src/packets/configuration/clientbound_update_tags_packet.rs7
-rw-r--r--azalea-protocol/src/packets/configuration/serverbound_client_information_packet.rs3
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_award_stats_packet.rs3
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_boss_event_packet.rs5
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_command_suggestions_packet.rs6
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_commands_packet.rs3
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_delete_chat_packet.rs3
-rw-r--r--azalea-protocol/src/packets/game/clientbound_disguised_chat_packet.rs3
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_login_packet.rs4
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_open_book_packet.rs3
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_player_abilities_packet.rs3
-rw-r--r--azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs3
-rw-r--r--azalea-protocol/src/packets/game/clientbound_player_info_update_packet.rs9
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs3
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_set_player_team_packet.rs3
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_stop_sound_packet.rs3
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs8
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_update_tags_packet.rs7
-rwxr-xr-xazalea-protocol/src/packets/game/serverbound_chat_command_signed_packet.rs3
-rwxr-xr-xazalea-protocol/src/packets/game/serverbound_container_click_packet.rs3
-rwxr-xr-xazalea-protocol/src/packets/game/serverbound_interact_packet.rs6
-rwxr-xr-xazalea-protocol/src/packets/game/serverbound_player_abilities_packet.rs6
-rwxr-xr-xazalea-protocol/src/packets/game/serverbound_seen_advancements_packet.rs6
-rwxr-xr-xazalea-protocol/src/packets/game/serverbound_set_command_block_packet.rs6
-rwxr-xr-xazalea-protocol/src/packets/game/serverbound_set_jigsaw_block_packet.rs10
-rwxr-xr-xazalea-protocol/src/packets/game/serverbound_set_structure_block_packet.rs6
-rwxr-xr-xazalea-protocol/src/packets/game/serverbound_swing_packet.rs3
-rwxr-xr-xazalea-protocol/src/packets/game/serverbound_use_item_on_packet.rs6
-rwxr-xr-xazalea-protocol/src/packets/game/serverbound_use_item_packet.rs3
-rwxr-xr-xazalea-protocol/src/packets/handshaking/client_intention_packet.rs6
-rwxr-xr-xazalea-protocol/src/packets/login/clientbound_custom_query_packet.rs3
-rwxr-xr-xazalea-protocol/src/packets/login/clientbound_login_compression_packet.rs3
-rw-r--r--azalea-protocol/src/packets/login/serverbound_custom_query_answer_packet.rs3
-rwxr-xr-xazalea-protocol/src/packets/login/serverbound_hello_packet.rs3
-rwxr-xr-xazalea-protocol/src/packets/mod.rs6
-rwxr-xr-xazalea-protocol/src/packets/status/clientbound_status_response_packet.rs3
-rwxr-xr-xazalea-protocol/src/read.rs14
-rwxr-xr-xazalea-protocol/src/resolver.rs6
-rwxr-xr-xazalea-protocol/src/write.rs6
-rw-r--r--azalea-registry/src/extra.rs3
-rwxr-xr-xazalea-registry/src/lib.rs1
-rwxr-xr-xazalea-world/src/chunk_storage.rs22
-rw-r--r--azalea-world/src/container.rs9
-rw-r--r--azalea-world/src/find_blocks.rs3
-rwxr-xr-xazalea-world/src/palette.rs3
-rw-r--r--azalea-world/src/world.rs14
-rw-r--r--azalea/examples/steal.rs3
-rw-r--r--azalea/examples/testbot/commands/movement.rs3
-rw-r--r--azalea/examples/testbot/main.rs11
-rw-r--r--azalea/src/accept_resource_packs.rs3
-rw-r--r--azalea/src/auto_respawn.rs3
-rw-r--r--azalea/src/bot.rs25
-rw-r--r--azalea/src/container.rs2
-rw-r--r--azalea/src/lib.rs5
-rw-r--r--azalea/src/pathfinder/mining.rs3
-rw-r--r--azalea/src/pathfinder/mod.rs34
-rw-r--r--azalea/src/pathfinder/moves/basic.rs3
-rw-r--r--azalea/src/pathfinder/moves/mod.rs14
-rw-r--r--azalea/src/pathfinder/moves/parkour.rs3
-rw-r--r--azalea/src/pathfinder/world.rs3
-rw-r--r--azalea/src/prelude.rs11
-rw-r--r--azalea/src/swarm/chat.rs13
-rw-r--r--azalea/src/swarm/mod.rs3
-rw-r--r--rustfmt.toml1
128 files changed, 469 insertions, 357 deletions
diff --git a/azalea-auth/src/auth.rs b/azalea-auth/src/auth.rs
index 667c9062..e70be27d 100755
--- a/azalea-auth/src/auth.rs
+++ b/azalea-auth/src/auth.rs
@@ -1,18 +1,20 @@
//! Handle Minecraft (Xbox) authentication.
-use crate::cache::{self, CachedAccount, ExpiringValue};
-use chrono::{DateTime, Utc};
-use serde::{Deserialize, Serialize};
-use serde_json::json;
use std::{
collections::HashMap,
path::PathBuf,
time::{Instant, SystemTime, UNIX_EPOCH},
};
+
+use chrono::{DateTime, Utc};
+use serde::{Deserialize, Serialize};
+use serde_json::json;
use thiserror::Error;
use tracing::{error, trace};
use uuid::Uuid;
+use crate::cache::{self, CachedAccount, ExpiringValue};
+
#[derive(Default)]
pub struct AuthOpts<'a> {
/// Whether we should check if the user actually owns the game. This will
diff --git a/azalea-auth/src/cache.rs b/azalea-auth/src/cache.rs
index 210dbab6..ca32958f 100755
--- a/azalea-auth/src/cache.rs
+++ b/azalea-auth/src/cache.rs
@@ -1,8 +1,9 @@
//! Cache auth information
-use serde::{Deserialize, Serialize};
use std::path::Path;
use std::time::{SystemTime, UNIX_EPOCH};
+
+use serde::{Deserialize, Serialize};
use thiserror::Error;
use tokio::fs::File;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
diff --git a/azalea-auth/src/game_profile.rs b/azalea-auth/src/game_profile.rs
index 6a34a87b..31650754 100755
--- a/azalea-auth/src/game_profile.rs
+++ b/azalea-auth/src/game_profile.rs
@@ -1,6 +1,7 @@
+use std::collections::HashMap;
+
use azalea_buf::McBuf;
use serde::{Deserialize, Serialize};
-use std::collections::HashMap;
use uuid::Uuid;
#[derive(McBuf, Debug, Clone, Default, Eq, PartialEq)]
diff --git a/azalea-block/azalea-block-macros/src/lib.rs b/azalea-block/azalea-block-macros/src/lib.rs
index 54b99479..742d1fc9 100755
--- a/azalea-block/azalea-block-macros/src/lib.rs
+++ b/azalea-block/azalea-block-macros/src/lib.rs
@@ -2,11 +2,12 @@
mod utils;
+use std::collections::HashMap;
+use std::fmt::Write;
+
use proc_macro::TokenStream;
use proc_macro2::TokenTree;
use quote::quote;
-use std::collections::HashMap;
-use std::fmt::Write;
use syn::{
braced,
ext::IdentExt,
diff --git a/azalea-block/src/generated.rs b/azalea-block/src/generated.rs
index 76dfb2dc..18ee93fc 100755
--- a/azalea-block/src/generated.rs
+++ b/azalea-block/src/generated.rs
@@ -1,7 +1,9 @@
-use crate::{Block, BlockBehavior, BlockState, BlockStates, Property};
-use azalea_block_macros::make_block_states;
use std::fmt::Debug;
+use azalea_block_macros::make_block_states;
+
+use crate::{Block, BlockBehavior, BlockState, BlockStates, Property};
+
make_block_states! {
Properties => {
"snowy" => Snowy(bool),
diff --git a/azalea-block/src/lib.rs b/azalea-block/src/lib.rs
index 2a46fd01..7e6ccfaf 100755
--- a/azalea-block/src/lib.rs
+++ b/azalea-block/src/lib.rs
@@ -5,17 +5,17 @@ mod behavior;
mod generated;
mod range;
-pub use generated::{blocks, properties};
-
-use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
-pub use behavior::BlockBehavior;
use core::fmt::Debug;
-pub use range::BlockStates;
use std::{
any::Any,
io::{Cursor, Write},
};
+use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
+pub use behavior::BlockBehavior;
+pub use generated::{blocks, properties};
+pub use range::BlockStates;
+
pub trait Block: Debug + Any {
fn behavior(&self) -> BlockBehavior;
/// Get the Minecraft ID for this block. For example `stone` or
diff --git a/azalea-brigadier/src/arguments/bool_argument_type.rs b/azalea-brigadier/src/arguments/bool_argument_type.rs
index a73a9da5..efb86509 100644
--- a/azalea-brigadier/src/arguments/bool_argument_type.rs
+++ b/azalea-brigadier/src/arguments/bool_argument_type.rs
@@ -1,5 +1,6 @@
use std::{any::Any, sync::Arc};
+use super::ArgumentType;
use crate::{
context::CommandContext,
exceptions::CommandSyntaxException,
@@ -7,8 +8,6 @@ use crate::{
suggestion::{Suggestions, SuggestionsBuilder},
};
-use super::ArgumentType;
-
#[derive(Default)]
struct Boolean;
diff --git a/azalea-brigadier/src/arguments/double_argument_type.rs b/azalea-brigadier/src/arguments/double_argument_type.rs
index ea99f1cf..559d1cf5 100644
--- a/azalea-brigadier/src/arguments/double_argument_type.rs
+++ b/azalea-brigadier/src/arguments/double_argument_type.rs
@@ -1,13 +1,12 @@
use std::{any::Any, sync::Arc};
+use super::ArgumentType;
use crate::{
context::CommandContext,
exceptions::{BuiltInExceptions, CommandSyntaxException},
string_reader::StringReader,
};
-use super::ArgumentType;
-
#[derive(Default)]
struct Double {
pub minimum: Option<f64>,
diff --git a/azalea-brigadier/src/arguments/float_argument_type.rs b/azalea-brigadier/src/arguments/float_argument_type.rs
index 2333499a..83e298ff 100644
--- a/azalea-brigadier/src/arguments/float_argument_type.rs
+++ b/azalea-brigadier/src/arguments/float_argument_type.rs
@@ -1,13 +1,12 @@
use std::{any::Any, sync::Arc};
+use super::ArgumentType;
use crate::{
context::CommandContext,
exceptions::{BuiltInExceptions, CommandSyntaxException},
string_reader::StringReader,
};
-use super::ArgumentType;
-
#[derive(Default)]
struct Float {
pub minimum: Option<f32>,
diff --git a/azalea-brigadier/src/arguments/integer_argument_type.rs b/azalea-brigadier/src/arguments/integer_argument_type.rs
index cc4755ee..47d25e27 100644
--- a/azalea-brigadier/src/arguments/integer_argument_type.rs
+++ b/azalea-brigadier/src/arguments/integer_argument_type.rs
@@ -1,13 +1,12 @@
use std::{any::Any, sync::Arc};
+use super::ArgumentType;
use crate::{
context::CommandContext,
exceptions::{BuiltInExceptions, CommandSyntaxException},
string_reader::StringReader,
};
-use super::ArgumentType;
-
#[derive(Default)]
struct Integer {
pub minimum: Option<i32>,
diff --git a/azalea-brigadier/src/arguments/long_argument_type.rs b/azalea-brigadier/src/arguments/long_argument_type.rs
index 4e36abee..ba65479c 100644
--- a/azalea-brigadier/src/arguments/long_argument_type.rs
+++ b/azalea-brigadier/src/arguments/long_argument_type.rs
@@ -1,13 +1,12 @@
use std::{any::Any, sync::Arc};
+use super::ArgumentType;
use crate::{
context::CommandContext,
exceptions::{BuiltInExceptions, CommandSyntaxException},
string_reader::StringReader,
};
-use super::ArgumentType;
-
#[derive(Default)]
struct Long {
pub minimum: Option<i64>,
diff --git a/azalea-brigadier/src/arguments/string_argument_type.rs b/azalea-brigadier/src/arguments/string_argument_type.rs
index d38fbc79..96b9c998 100644
--- a/azalea-brigadier/src/arguments/string_argument_type.rs
+++ b/azalea-brigadier/src/arguments/string_argument_type.rs
@@ -1,11 +1,10 @@
use std::{any::Any, sync::Arc};
+use super::ArgumentType;
use crate::{
context::CommandContext, exceptions::CommandSyntaxException, string_reader::StringReader,
};
-use super::ArgumentType;
-
pub enum StringArgument {
/// Match up until the next space.
SingleWord,
diff --git a/azalea-brigadier/src/builder/argument_builder.rs b/azalea-brigadier/src/builder/argument_builder.rs
index 9d3e8cad..9ebe6400 100755
--- a/azalea-brigadier/src/builder/argument_builder.rs
+++ b/azalea-brigadier/src/builder/argument_builder.rs
@@ -1,14 +1,14 @@
+use std::{fmt::Debug, sync::Arc};
+
use parking_lot::RwLock;
+use super::{literal_argument_builder::Literal, required_argument_builder::Argument};
use crate::{
context::CommandContext,
modifier::RedirectModifier,
tree::{Command, CommandNode},
};
-use super::{literal_argument_builder::Literal, required_argument_builder::Argument};
-use std::{fmt::Debug, sync::Arc};
-
#[derive(Debug, Clone)]
pub enum ArgumentBuilderType {
Literal(Literal),
diff --git a/azalea-brigadier/src/builder/required_argument_builder.rs b/azalea-brigadier/src/builder/required_argument_builder.rs
index 1c79f619..51f0acec 100755
--- a/azalea-brigadier/src/builder/required_argument_builder.rs
+++ b/azalea-brigadier/src/builder/required_argument_builder.rs
@@ -1,3 +1,5 @@
+use std::{any::Any, fmt::Debug, sync::Arc};
+
use super::argument_builder::{ArgumentBuilder, ArgumentBuilderType};
use crate::{
arguments::ArgumentType,
@@ -5,7 +7,6 @@ use crate::{
string_reader::StringReader,
suggestion::{Suggestions, SuggestionsBuilder},
};
-use std::{any::Any, fmt::Debug, sync::Arc};
/// An argument node type. The `T` type parameter is the type of the argument,
/// which can be anything.
diff --git a/azalea-brigadier/src/command_dispatcher.rs b/azalea-brigadier/src/command_dispatcher.rs
index 2f4d6ebd..619131e2 100755
--- a/azalea-brigadier/src/command_dispatcher.rs
+++ b/azalea-brigadier/src/command_dispatcher.rs
@@ -1,3 +1,11 @@
+use std::{
+ cmp::Ordering,
+ collections::{HashMap, HashSet},
+ mem,
+ rc::Rc,
+ sync::Arc,
+};
+
use parking_lot::RwLock;
use crate::{
@@ -9,13 +17,6 @@ use crate::{
suggestion::{Suggestions, SuggestionsBuilder},
tree::CommandNode,
};
-use std::{
- cmp::Ordering,
- collections::{HashMap, HashSet},
- mem,
- rc::Rc,
- sync::Arc,
-};
/// The root of the command tree. You need to make this to register commands.
///
diff --git a/azalea-brigadier/src/context/command_context.rs b/azalea-brigadier/src/context/command_context.rs
index 4d93006e..3d401f96 100755
--- a/azalea-brigadier/src/context/command_context.rs
+++ b/azalea-brigadier/src/context/command_context.rs
@@ -1,3 +1,5 @@
+use std::{any::Any, collections::HashMap, fmt::Debug, rc::Rc, sync::Arc};
+
use parking_lot::RwLock;
use super::{parsed_command_node::ParsedCommandNode, string_range::StringRange, ParsedArgument};
@@ -5,7 +7,6 @@ use crate::{
modifier::RedirectModifier,
tree::{Command, CommandNode},
};
-use std::{any::Any, collections::HashMap, fmt::Debug, rc::Rc, sync::Arc};
/// A built `CommandContextBuilder`.
pub struct CommandContext<S> {
diff --git a/azalea-brigadier/src/context/command_context_builder.rs b/azalea-brigadier/src/context/command_context_builder.rs
index 95e1b5d8..3fb8ec70 100755
--- a/azalea-brigadier/src/context/command_context_builder.rs
+++ b/azalea-brigadier/src/context/command_context_builder.rs
@@ -1,3 +1,5 @@
+use std::{collections::HashMap, fmt::Debug, rc::Rc, sync::Arc};
+
use parking_lot::RwLock;
use super::{
@@ -9,7 +11,6 @@ use crate::{
modifier::RedirectModifier,
tree::{Command, CommandNode},
};
-use std::{collections::HashMap, fmt::Debug, rc::Rc, sync::Arc};
pub struct CommandContextBuilder<'a, S> {
pub arguments: HashMap<String, ParsedArgument>,
diff --git a/azalea-brigadier/src/context/parsed_argument.rs b/azalea-brigadier/src/context/parsed_argument.rs
index 428851a8..ef559694 100755
--- a/azalea-brigadier/src/context/parsed_argument.rs
+++ b/azalea-brigadier/src/context/parsed_argument.rs
@@ -1,6 +1,7 @@
-use super::string_range::StringRange;
use std::{any::Any, sync::Arc};
+use super::string_range::StringRange;
+
#[derive(Clone)]
pub struct ParsedArgument {
pub range: StringRange,
diff --git a/azalea-brigadier/src/context/parsed_command_node.rs b/azalea-brigadier/src/context/parsed_command_node.rs
index 2d69c72e..62da13d8 100755
--- a/azalea-brigadier/src/context/parsed_command_node.rs
+++ b/azalea-brigadier/src/context/parsed_command_node.rs
@@ -1,8 +1,9 @@
+use std::sync::Arc;
+
use parking_lot::RwLock;
use super::string_range::StringRange;
use crate::tree::CommandNode;
-use std::sync::Arc;
#[derive(Debug)]
pub struct ParsedCommandNode<S> {
diff --git a/azalea-brigadier/src/exceptions/builtin_exceptions.rs b/azalea-brigadier/src/exceptions/builtin_exceptions.rs
index e60c697c..bf2072c1 100755
--- a/azalea-brigadier/src/exceptions/builtin_exceptions.rs
+++ b/azalea-brigadier/src/exceptions/builtin_exceptions.rs
@@ -1,8 +1,7 @@
use std::fmt;
-use crate::string_reader::StringReader;
-
use super::command_syntax_exception::CommandSyntaxException;
+use crate::string_reader::StringReader;
#[derive(Clone, PartialEq)]
pub enum BuiltInExceptions {
diff --git a/azalea-brigadier/src/exceptions/command_syntax_exception.rs b/azalea-brigadier/src/exceptions/command_syntax_exception.rs
index 0254820d..657649b0 100755
--- a/azalea-brigadier/src/exceptions/command_syntax_exception.rs
+++ b/azalea-brigadier/src/exceptions/command_syntax_exception.rs
@@ -1,9 +1,10 @@
-use super::builtin_exceptions::BuiltInExceptions;
use std::{
cmp,
fmt::{self, Write},
};
+use super::builtin_exceptions::BuiltInExceptions;
+
#[derive(Clone, PartialEq)]
pub struct CommandSyntaxException {
pub type_: BuiltInExceptions,
diff --git a/azalea-brigadier/src/parse_results.rs b/azalea-brigadier/src/parse_results.rs
index aa7d79ea..a2cefcf7 100755
--- a/azalea-brigadier/src/parse_results.rs
+++ b/azalea-brigadier/src/parse_results.rs
@@ -1,8 +1,9 @@
+use std::{collections::HashMap, fmt::Debug, rc::Rc};
+
use crate::{
context::CommandContextBuilder, exceptions::CommandSyntaxException,
string_reader::StringReader, tree::CommandNode,
};
-use std::{collections::HashMap, fmt::Debug, rc::Rc};
pub struct ParseResults<'a, S> {
pub context: CommandContextBuilder<'a, S>,
diff --git a/azalea-brigadier/src/string_reader.rs b/azalea-brigadier/src/string_reader.rs
index 03e105dd..963a2244 100755
--- a/azalea-brigadier/src/string_reader.rs
+++ b/azalea-brigadier/src/string_reader.rs
@@ -1,6 +1,7 @@
-use crate::exceptions::{BuiltInExceptions, CommandSyntaxException};
use std::str::FromStr;
+use crate::exceptions::{BuiltInExceptions, CommandSyntaxException};
+
#[derive(Clone)]
pub struct StringReader {
string: String,
diff --git a/azalea-brigadier/src/suggestion/mod.rs b/azalea-brigadier/src/suggestion/mod.rs
index fbebfe8a..753b1bc8 100755
--- a/azalea-brigadier/src/suggestion/mod.rs
+++ b/azalea-brigadier/src/suggestion/mod.rs
@@ -1,20 +1,22 @@
mod suggestions;
mod suggestions_builder;
-use crate::context::StringRange;
-#[cfg(feature = "azalea-buf")]
-use azalea_buf::McBufWritable;
-#[cfg(feature = "azalea-buf")]
-use azalea_chat::FormattedText;
#[cfg(feature = "azalea-buf")]
use std::io::Write;
use std::{
fmt::{self, Display},
hash::Hash,
};
+
+#[cfg(feature = "azalea-buf")]
+use azalea_buf::McBufWritable;
+#[cfg(feature = "azalea-buf")]
+use azalea_chat::FormattedText;
pub use suggestions::Suggestions;
pub use suggestions_builder::SuggestionsBuilder;
+use crate::context::StringRange;
+
/// A suggestion given to the user for what they might want to type next.
///
/// The `M` generic is the type of the tooltip, so for example a `String` or
diff --git a/azalea-brigadier/src/suggestion/suggestions.rs b/azalea-brigadier/src/suggestion/suggestions.rs
index 487e4233..5941aa7d 100755
--- a/azalea-brigadier/src/suggestion/suggestions.rs
+++ b/azalea-brigadier/src/suggestion/suggestions.rs
@@ -1,16 +1,18 @@
-use super::Suggestion;
-use crate::context::StringRange;
#[cfg(feature = "azalea-buf")]
-use crate::suggestion::SuggestionValue;
+use std::io::{Cursor, Write};
+use std::{collections::HashSet, hash::Hash};
+
#[cfg(feature = "azalea-buf")]
use azalea_buf::{
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
};
#[cfg(feature = "azalea-buf")]
use azalea_chat::FormattedText;
+
+use super::Suggestion;
+use crate::context::StringRange;
#[cfg(feature = "azalea-buf")]
-use std::io::{Cursor, Write};
-use std::{collections::HashSet, hash::Hash};
+use crate::suggestion::SuggestionValue;
#[derive(Debug, Clone, Eq, PartialEq, Hash, Default)]
pub struct Suggestions {
diff --git a/azalea-brigadier/src/suggestion/suggestions_builder.rs b/azalea-brigadier/src/suggestion/suggestions_builder.rs
index 4e6296dd..85c8f4d8 100755
--- a/azalea-brigadier/src/suggestion/suggestions_builder.rs
+++ b/azalea-brigadier/src/suggestion/suggestions_builder.rs
@@ -1,8 +1,7 @@
use std::collections::HashSet;
-use crate::context::StringRange;
-
use super::{Suggestion, SuggestionValue, Suggestions};
+use crate::context::StringRange;
#[derive(PartialEq, Debug)]
pub struct SuggestionsBuilder {
diff --git a/azalea-brigadier/src/tree/mod.rs b/azalea-brigadier/src/tree/mod.rs
index a982e82b..dfa3b375 100755
--- a/azalea-brigadier/src/tree/mod.rs
+++ b/azalea-brigadier/src/tree/mod.rs
@@ -1,3 +1,11 @@
+use std::{
+ collections::{BTreeMap, HashMap},
+ fmt::Debug,
+ hash::Hash,
+ ptr,
+ sync::Arc,
+};
+
use parking_lot::RwLock;
use crate::{
@@ -11,13 +19,6 @@ use crate::{
string_reader::StringReader,
suggestion::{Suggestions, SuggestionsBuilder},
};
-use std::{
- collections::{BTreeMap, HashMap},
- fmt::Debug,
- hash::Hash,
- ptr,
- sync::Arc,
-};
pub type Command<S> = Option<Arc<dyn Fn(&CommandContext<S>) -> i32 + Send + Sync>>;
diff --git a/azalea-buf/src/lib.rs b/azalea-buf/src/lib.rs
index fbde3684..e1d1281f 100755
--- a/azalea-buf/src/lib.rs
+++ b/azalea-buf/src/lib.rs
@@ -20,9 +20,10 @@ const MAX_STRING_LENGTH: u16 = 32767;
#[cfg(test)]
mod tests {
- use super::*;
use std::{collections::HashMap, io::Cursor};
+ use super::*;
+
#[test]
fn test_write_varint() {
let mut buf = Vec::new();
diff --git a/azalea-buf/src/read.rs b/azalea-buf/src/read.rs
index 882e2bce..8e406acb 100755
--- a/azalea-buf/src/read.rs
+++ b/azalea-buf/src/read.rs
@@ -1,14 +1,16 @@
-use super::{UnsizedByteArray, MAX_STRING_LENGTH};
-use byteorder::{ReadBytesExt, BE};
use std::{
backtrace::Backtrace,
collections::HashMap,
hash::Hash,
io::{Cursor, Read},
};
+
+use byteorder::{ReadBytesExt, BE};
use thiserror::Error;
use tracing::warn;
+use super::{UnsizedByteArray, MAX_STRING_LENGTH};
+
#[derive(Error, Debug)]
pub enum BufReadError {
#[error("Invalid VarInt")]
diff --git a/azalea-buf/src/serializable_uuid.rs b/azalea-buf/src/serializable_uuid.rs
index f42eed86..d4ec0315 100755
--- a/azalea-buf/src/serializable_uuid.rs
+++ b/azalea-buf/src/serializable_uuid.rs
@@ -1,7 +1,9 @@
-use crate::{read::BufReadError, McBufReadable, McBufWritable};
use std::io::{Cursor, Write};
+
use uuid::Uuid;
+use crate::{read::BufReadError, McBufReadable, McBufWritable};
+
pub trait SerializableUuid {
fn to_int_array(&self) -> [u32; 4];
fn from_int_array(array: [u32; 4]) -> Self;
diff --git a/azalea-buf/src/write.rs b/azalea-buf/src/write.rs
index 61dedfd8..49215a5a 100755
--- a/azalea-buf/src/write.rs
+++ b/azalea-buf/src/write.rs
@@ -1,7 +1,9 @@
-use super::{UnsizedByteArray, MAX_STRING_LENGTH};
-use byteorder::{BigEndian, WriteBytesExt};
use std::{collections::HashMap, io::Write};
+use byteorder::{BigEndian, WriteBytesExt};
+
+use super::{UnsizedByteArray, MAX_STRING_LENGTH};
+
fn write_utf_with_len(
buf: &mut impl Write,
string: &str,
diff --git a/azalea-chat/src/base_component.rs b/azalea-chat/src/base_component.rs
index 8f70ecb7..b01f2eb3 100755
--- a/azalea-chat/src/base_component.rs
+++ b/azalea-chat/src/base_component.rs
@@ -1,6 +1,7 @@
-use crate::{style::Style, FormattedText};
use serde::Serialize;
+use crate::{style::Style, FormattedText};
+
#[derive(Clone, Debug, PartialEq, Serialize, Eq, Hash)]
pub struct BaseComponent {
// implements mutablecomponent
diff --git a/azalea-chat/src/component.rs b/azalea-chat/src/component.rs
index dff4d91d..84b5ed17 100755
--- a/azalea-chat/src/component.rs
+++ b/azalea-chat/src/component.rs
@@ -1,18 +1,20 @@
-use crate::{
- base_component::BaseComponent,
- style::{ChatFormatting, Style},
- text_component::TextComponent,
- translatable_component::{StringOrComponent, TranslatableComponent},
-};
+use std::fmt::Display;
+
#[cfg(feature = "azalea-buf")]
use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
use once_cell::sync::Lazy;
use serde::{de, Deserialize, Deserializer, Serialize};
#[cfg(feature = "simdnbt")]
use simdnbt::{Deserialize as _, FromNbtTag as _, Serialize as _};
-use std::fmt::Display;
use tracing::{debug, trace, warn};
+use crate::{
+ base_component::BaseComponent,
+ style::{ChatFormatting, Style},
+ text_component::TextComponent,
+ translatable_component::{StringOrComponent, TranslatableComponent},
+};
+
/// A chat component, basically anything you can see in chat.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Hash)]
#[serde(untagged)]
diff --git a/azalea-chat/src/style.rs b/azalea-chat/src/style.rs
index a8cf5935..a27f3d2a 100755
--- a/azalea-chat/src/style.rs
+++ b/azalea-chat/src/style.rs
@@ -605,9 +605,8 @@ impl simdnbt::Deserialize for Style {
#[cfg(test)]
mod tests {
- use crate::component::DEFAULT_STYLE;
-
use super::*;
+ use crate::component::DEFAULT_STYLE;
#[test]
fn text_color_named_colors() {
diff --git a/azalea-chat/src/text_component.rs b/azalea-chat/src/text_component.rs
index 6f95840d..d3418ad8 100755
--- a/azalea-chat/src/text_component.rs
+++ b/azalea-chat/src/text_component.rs
@@ -1,7 +1,9 @@
-use crate::{base_component::BaseComponent, style::ChatFormatting, FormattedText};
-use serde::{ser::SerializeMap, Serialize, Serializer, __private::ser::FlatMapSerializer};
use std::fmt::Display;
+use serde::{ser::SerializeMap, Serialize, Serializer, __private::ser::FlatMapSerializer};
+
+use crate::{base_component::BaseComponent, style::ChatFormatting, FormattedText};
+
/// A component that contains text that's the same in all locales.
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
pub struct TextComponent {
@@ -140,9 +142,8 @@ impl Display for TextComponent {
#[cfg(test)]
mod tests {
- use crate::style::Ansi;
-
use super::*;
+ use crate::style::Ansi;
#[test]
fn test_hypixel_motd() {
diff --git a/azalea-chat/src/translatable_component.rs b/azalea-chat/src/translatable_component.rs
index 82c84d85..ecd238a5 100755
--- a/azalea-chat/src/translatable_component.rs
+++ b/azalea-chat/src/translatable_component.rs
@@ -1,12 +1,13 @@
use std::fmt::{self, Display, Formatter};
-use crate::{
- base_component::BaseComponent, style::Style, text_component::TextComponent, FormattedText,
-};
use serde::{ser::SerializeMap, Serialize, Serializer, __private::ser::FlatMapSerializer};
#[cfg(feature = "simdnbt")]
use simdnbt::Serialize as _;
+use crate::{
+ base_component::BaseComponent, style::Style, text_component::TextComponent, FormattedText,
+};
+
#[derive(Clone, Debug, PartialEq, Serialize, Eq, Hash)]
#[serde(untagged)]
pub enum StringOrComponent {
diff --git a/azalea-client/src/chat.rs b/azalea-client/src/chat.rs
index 1b4b7228..751893b7 100755
--- a/azalea-client/src/chat.rs
+++ b/azalea-client/src/chat.rs
@@ -1,5 +1,10 @@
//! Implementations of chat-related features.
+use std::{
+ sync::Arc,
+ time::{SystemTime, UNIX_EPOCH},
+};
+
use azalea_chat::FormattedText;
use azalea_protocol::packets::game::{
clientbound_disguised_chat_packet::ClientboundDisguisedChatPacket,
@@ -15,10 +20,6 @@ use bevy_ecs::{
prelude::Event,
schedule::IntoSystemConfigs,
};
-use std::{
- sync::Arc,
- time::{SystemTime, UNIX_EPOCH},
-};
use uuid::Uuid;
use crate::{
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs
index 7551aa9f..caeca7fe 100644
--- a/azalea-client/src/client.rs
+++ b/azalea-client/src/client.rs
@@ -1,27 +1,11 @@
-use crate::{
- attack::{self, AttackPlugin},
- chat::ChatPlugin,
- chunks::{ChunkBatchInfo, ChunkPlugin},
- configuration::ConfigurationPlugin,
- disconnect::{DisconnectEvent, DisconnectPlugin},
- events::{Event, EventPlugin, LocalPlayerEvents},
- interact::{CurrentSequenceNumber, InteractPlugin},
- inventory::{Inventory, InventoryPlugin},
- local_player::{
- death_event, GameProfileComponent, Hunger, InstanceHolder, PermissionLevel,
- PlayerAbilities, TabList,
- },
- mining::{self, MinePlugin},
- movement::{LastSentLookDirection, PhysicsState, PlayerMovePlugin},
- packet_handling::{
- login::{self, LoginSendPacketQueue},
- PacketHandlerPlugin,
- },
- player::retroactively_add_game_profile_component,
- raw_connection::RawConnection,
- respawn::RespawnPlugin,
- task_pool::TaskPoolPlugin,
- Account, PlayerInfo,
+use std::{
+ collections::HashMap,
+ fmt::Debug,
+ io,
+ net::SocketAddr,
+ ops::Deref,
+ sync::Arc,
+ time::{Duration, Instant},
};
use azalea_auth::{game_profile::GameProfile, sessionserver::ClientSessionServerError};
@@ -68,15 +52,6 @@ use bevy_ecs::{
use bevy_time::TimePlugin;
use derive_more::Deref;
use parking_lot::{Mutex, RwLock};
-use std::{
- collections::HashMap,
- fmt::Debug,
- io,
- net::SocketAddr,
- ops::Deref,
- sync::Arc,
- time::{Duration, Instant},
-};
use thiserror::Error;
use tokio::{
sync::{broadcast, mpsc},
@@ -85,6 +60,32 @@ use tokio::{
use tracing::{debug, error};
use uuid::Uuid;
+use crate::{
+ attack::{self, AttackPlugin},
+ chat::ChatPlugin,
+ chunks::{ChunkBatchInfo, ChunkPlugin},
+ configuration::ConfigurationPlugin,
+ disconnect::{DisconnectEvent, DisconnectPlugin},
+ events::{Event, EventPlugin, LocalPlayerEvents},
+ interact::{CurrentSequenceNumber, InteractPlugin},
+ inventory::{Inventory, InventoryPlugin},
+ local_player::{
+ death_event, GameProfileComponent, Hunger, InstanceHolder, PermissionLevel,
+ PlayerAbilities, TabList,
+ },
+ mining::{self, MinePlugin},
+ movement::{LastSentLookDirection, PhysicsState, PlayerMovePlugin},
+ packet_handling::{
+ login::{self, LoginSendPacketQueue},
+ PacketHandlerPlugin,
+ },
+ player::retroactively_add_game_profile_component,
+ raw_connection::RawConnection,
+ respawn::RespawnPlugin,
+ task_pool::TaskPoolPlugin,
+ Account, PlayerInfo,
+};
+
/// `Client` has the things that a user interacting with the library will want.
///
/// To make a new client, use either [`azalea::ClientBuilder`] or
diff --git a/azalea-client/src/movement.rs b/azalea-client/src/movement.rs
index 8905d0ef..806f8734 100644
--- a/azalea-client/src/movement.rs
+++ b/azalea-client/src/movement.rs
@@ -1,5 +1,5 @@
-use crate::client::Client;
-use crate::packet_handling::game::SendPacketEvent;
+use std::backtrace::Backtrace;
+
use azalea_core::position::Vec3;
use azalea_core::tick::GameTick;
use azalea_entity::{metadata::Sprinting, Attributes, Jumping};
@@ -20,9 +20,11 @@ use bevy_ecs::{
component::Component, entity::Entity, event::EventReader, query::With,
schedule::IntoSystemConfigs, system::Query,
};
-use std::backtrace::Backtrace;
use thiserror::Error;
+use crate::client::Client;
+use crate::packet_handling::game::SendPacketEvent;
+
#[derive(Error, Debug)]
pub enum MovePlayerError {
#[error("Player is not in world")]
diff --git a/azalea-client/src/packet_handling/mod.rs b/azalea-client/src/packet_handling/mod.rs
index 19de27eb..eb8f1d47 100644
--- a/azalea-client/src/packet_handling/mod.rs
+++ b/azalea-client/src/packet_handling/mod.rs
@@ -2,8 +2,6 @@ use azalea_entity::{metadata::Health, EntityUpdateSet};
use bevy_app::{App, First, Plugin, PreUpdate, Update};
use bevy_ecs::prelude::*;
-use crate::{chat::ChatReceivedEvent, events::death_listener};
-
use self::{
game::{
AddPlayerEvent, DeathEvent, InstanceLoadedEvent, KeepAliveEvent, RemovePlayerEvent,
@@ -11,6 +9,7 @@ use self::{
},
login::{LoginPacketEvent, SendLoginPacketEvent},
};
+use crate::{chat::ChatReceivedEvent, events::death_listener};
pub mod configuration;
pub mod game;
diff --git a/azalea-client/src/ping.rs b/azalea-client/src/ping.rs
index d0612392..ded1b521 100755
--- a/azalea-client/src/ping.rs
+++ b/azalea-client/src/ping.rs
@@ -1,5 +1,7 @@
//! Ping Minecraft servers.
+use std::io;
+
use azalea_protocol::{
connect::{Connection, ConnectionError, Proxy},
packets::{
@@ -16,7 +18,6 @@ use azalea_protocol::{
},
resolver, ServerAddress,
};
-use std::io;
use thiserror::Error;
#[derive(Error, Debug)]
diff --git a/azalea-core/src/delta.rs b/azalea-core/src/delta.rs
index 646bcc95..2dd67005 100755
--- a/azalea-core/src/delta.rs
+++ b/azalea-core/src/delta.rs
@@ -1,6 +1,7 @@
-use crate::position::Vec3;
pub use azalea_buf::McBuf;
+use crate::position::Vec3;
+
pub trait PositionDeltaTrait {
fn x(&self) -> f64;
fn y(&self) -> f64;
diff --git a/azalea-core/src/game_type.rs b/azalea-core/src/game_type.rs
index 7c7a43a8..1e494035 100644
--- a/azalea-core/src/game_type.rs
+++ b/azalea-core/src/game_type.rs
@@ -1,5 +1,6 @@
-use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufWritable};
use std::io::{Cursor, Write};
+
+use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufWritable};
use tracing::debug;
/// A Minecraft gamemode, like survival or creative.
diff --git a/azalea-core/src/position.rs b/azalea-core/src/position.rs
index d87e21a7..de0276a3 100755
--- a/azalea-core/src/position.rs
+++ b/azalea-core/src/position.rs
@@ -3,10 +3,6 @@
//! The most common ones are [`Vec3`] and [`BlockPos`], which are usually used
//! for entity positions and block positions, respectively.
-use crate::resource_location::ResourceLocation;
-use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable};
-#[cfg(feature = "serde")]
-use serde::{Deserialize, Serialize};
use std::{
fmt,
hash::Hash,
@@ -15,6 +11,12 @@ use std::{
str::FromStr,
};
+use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable};
+#[cfg(feature = "serde")]
+use serde::{Deserialize, Serialize};
+
+use crate::resource_location::ResourceLocation;
+
macro_rules! vec3_impl {
($name:ident, $type:ty) => {
impl $name {
diff --git a/azalea-core/src/registry_holder.rs b/azalea-core/src/registry_holder.rs
index 119a1317..8b3dd4e6 100644
--- a/azalea-core/src/registry_holder.rs
+++ b/azalea-core/src/registry_holder.rs
@@ -5,11 +5,12 @@
//! the game, including the types of chat messages, dimensions, and
//! biomes.
+use std::{collections::HashMap, io::Cursor};
+
use simdnbt::{
owned::{NbtCompound, NbtTag},
Deserialize, FromNbtTag, Serialize, ToNbtTag,
};
-use std::{collections::HashMap, io::Cursor};
use tracing::error;
use crate::resource_location::ResourceLocation;
diff --git a/azalea-core/src/resource_location.rs b/azalea-core/src/resource_location.rs
index 2b0feb71..7e1e48fe 100755
--- a/azalea-core/src/resource_location.rs
+++ b/azalea-core/src/resource_location.rs
@@ -1,15 +1,15 @@
//! A resource, like minecraft:stone
-use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
-use simdnbt::{owned::NbtTag, FromNbtTag, ToNbtTag};
use std::{
fmt,
io::{Cursor, Write},
str::FromStr,
};
+use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
#[cfg(feature = "serde")]
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
+use simdnbt::{owned::NbtTag, FromNbtTag, ToNbtTag};
#[derive(Hash, Clone, PartialEq, Eq)]
pub struct ResourceLocation {
diff --git a/azalea-entity/src/data.rs b/azalea-entity/src/data.rs
index 45c761e7..533bb49a 100755
--- a/azalea-entity/src/data.rs
+++ b/azalea-entity/src/data.rs
@@ -1,5 +1,7 @@
//! Define some types needed for entity metadata.
+use std::io::{Cursor, Write};
+
use azalea_buf::{
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
};
@@ -13,7 +15,6 @@ use bevy_ecs::component::Component;
use derive_more::Deref;
use enum_as_inner::EnumAsInner;
use nohash_hasher::IntSet;
-use std::io::{Cursor, Write};
use uuid::Uuid;
use crate::particle::Particle;
diff --git a/azalea-entity/src/lib.rs b/azalea-entity/src/lib.rs
index 8761fa24..c009198c 100644
--- a/azalea-entity/src/lib.rs
+++ b/azalea-entity/src/lib.rs
@@ -10,7 +10,11 @@ pub mod mining;
pub mod particle;
mod plugin;
-use self::attributes::AttributeInstance;
+use std::{
+ fmt::Debug,
+ hash::{Hash, Hasher},
+};
+
pub use attributes::Attributes;
use azalea_block::BlockState;
use azalea_core::{
@@ -25,12 +29,9 @@ pub use data::*;
use derive_more::{Deref, DerefMut};
pub use dimensions::EntityDimensions;
use plugin::indexing::EntityChunkPos;
-use std::{
- fmt::Debug,
- hash::{Hash, Hasher},
-};
use uuid::Uuid;
+use self::attributes::AttributeInstance;
pub use crate::plugin::*;
pub fn move_relative(
diff --git a/azalea-entity/src/metadata.rs b/azalea-entity/src/metadata.rs
index 74bc571d..2a6f996e 100644
--- a/azalea-entity/src/metadata.rs
+++ b/azalea-entity/src/metadata.rs
@@ -3,12 +3,6 @@
// This file is generated from codegen/lib/code/entity.py.
// Don't change it manually!
-use crate::particle::Particle;
-
-use super::{
- ArmadilloStateKind, EntityDataItem, EntityDataValue, OptionalUnsignedInt, Pose, Quaternion,
- Rotations, SnifferState, VillagerData,
-};
use azalea_chat::FormattedText;
use azalea_core::{
direction::Direction,
@@ -20,6 +14,12 @@ use derive_more::{Deref, DerefMut};
use thiserror::Error;
use uuid::Uuid;
+use super::{
+ ArmadilloStateKind, EntityDataItem, EntityDataValue, OptionalUnsignedInt, Pose, Quaternion,
+ Rotations, SnifferState, VillagerData,
+};
+use crate::particle::Particle;
+
#[derive(Error, Debug)]
pub enum UpdateMetadataError {
#[error("Wrong type ({0:?})")]
diff --git a/azalea-entity/src/plugin/indexing.rs b/azalea-entity/src/plugin/indexing.rs
index f04f5ef2..c4879c4f 100644
--- a/azalea-entity/src/plugin/indexing.rs
+++ b/azalea-entity/src/plugin/indexing.rs
@@ -1,5 +1,7 @@
//! Stuff related to entity indexes and keeping track of entities in the world.
+use std::{collections::HashMap, fmt::Debug};
+
use azalea_core::position::ChunkPos;
use azalea_world::{Instance, InstanceContainer, InstanceName, MinecraftEntityId};
use bevy_ecs::{
@@ -10,13 +12,11 @@ use bevy_ecs::{
};
use derive_more::{Deref, DerefMut};
use nohash_hasher::IntMap;
-use std::{collections::HashMap, fmt::Debug};
use tracing::{debug, warn};
use uuid::Uuid;
-use crate::{EntityUuid, Position};
-
use super::LoadedBy;
+use crate::{EntityUuid, Position};
#[derive(Resource, Default)]
pub struct EntityUuidIndex {
diff --git a/azalea-entity/src/plugin/mod.rs b/azalea-entity/src/plugin/mod.rs
index de18cbd3..67763484 100644
--- a/azalea-entity/src/plugin/mod.rs
+++ b/azalea-entity/src/plugin/mod.rs
@@ -9,6 +9,8 @@ use azalea_world::{InstanceContainer, InstanceName, MinecraftEntityId};
use bevy_app::{App, Plugin, PreUpdate, Update};
use bevy_ecs::prelude::*;
use derive_more::{Deref, DerefMut};
+use indexing::EntityUuidIndex;
+pub use relative_updates::RelativeEntityUpdate;
use tracing::debug;
use crate::{
@@ -16,9 +18,6 @@ use crate::{
Physics, Position,
};
-use indexing::EntityUuidIndex;
-pub use relative_updates::RelativeEntityUpdate;
-
/// A Bevy [`SystemSet`] for various types of entity updates.
#[derive(SystemSet, Debug, Hash, Eq, PartialEq, Clone)]
pub enum EntityUpdateSet {
diff --git a/azalea-inventory/azalea-inventory-macros/src/location_enum.rs b/azalea-inventory/azalea-inventory-macros/src/location_enum.rs
index 5f2086b7..615f07e5 100644
--- a/azalea-inventory/azalea-inventory-macros/src/location_enum.rs
+++ b/azalea-inventory/azalea-inventory-macros/src/location_enum.rs
@@ -1,8 +1,9 @@
-use crate::{parse_macro::DeclareMenus, utils::to_pascal_case};
use proc_macro2::TokenStream;
use quote::quote;
use syn::Ident;
+use crate::{parse_macro::DeclareMenus, utils::to_pascal_case};
+
pub fn generate(input: &DeclareMenus) -> TokenStream {
// pub enum MenuLocation {
// Player(PlayerMenuLocation),
diff --git a/azalea-inventory/azalea-inventory-macros/src/menu_enum.rs b/azalea-inventory/azalea-inventory-macros/src/menu_enum.rs
index a9e4f430..2b31f86c 100644
--- a/azalea-inventory/azalea-inventory-macros/src/menu_enum.rs
+++ b/azalea-inventory/azalea-inventory-macros/src/menu_enum.rs
@@ -1,10 +1,11 @@
//! Generate the `enum menu` and nothing else. Implementations are in
//! impl_menu.rs
-use crate::parse_macro::{DeclareMenus, Field, Menu};
use proc_macro2::TokenStream;
use quote::quote;
+use crate::parse_macro::{DeclareMenus, Field, Menu};
+
pub fn generate(input: &DeclareMenus) -> TokenStream {
let mut variants = quote! {};
let mut player_fields = None;
diff --git a/azalea-inventory/azalea-inventory-macros/src/menu_impl.rs b/azalea-inventory/azalea-inventory-macros/src/menu_impl.rs
index ef8f8641..f3cc5d5c 100644
--- a/azalea-inventory/azalea-inventory-macros/src/menu_impl.rs
+++ b/azalea-inventory/azalea-inventory-macros/src/menu_impl.rs
@@ -1,10 +1,11 @@
+use proc_macro2::TokenStream;
+use quote::quote;
+use syn::Ident;
+
use crate::{
parse_macro::{DeclareMenus, Menu},
utils::{to_pascal_case, to_snake_case},
};
-use proc_macro2::TokenStream;
-use quote::quote;
-use syn::Ident;
pub fn generate(input: &DeclareMenus) -> TokenStream {
let mut slot_mut_match_variants = quote! {};
diff --git a/azalea-inventory/src/slot.rs b/azalea-inventory/src/slot.rs
index 9aa33263..601c28e2 100644
--- a/azalea-inventory/src/slot.rs
+++ b/azalea-inventory/src/slot.rs
@@ -1,11 +1,12 @@
-use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
-use azalea_registry::DataComponentKind;
use std::{
collections::HashMap,
fmt,
io::{Cursor, Write},
};
+use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
+use azalea_registry::DataComponentKind;
+
use crate::components::{self};
/// Either an item in an inventory or nothing.
diff --git a/azalea-language/src/lib.rs b/azalea-language/src/lib.rs
index ad9da43a..7b6a6dec 100755
--- a/azalea-language/src/lib.rs
+++ b/azalea-language/src/lib.rs
@@ -1,8 +1,9 @@
#![doc = include_str!("../README.md")]
-use once_cell::sync::Lazy;
use std::collections::HashMap;
+use once_cell::sync::Lazy;
+
pub static STORAGE: Lazy<HashMap<String, String>> =
Lazy::new(|| serde_json::from_str(include_str!("en_us.json")).unwrap());
diff --git a/azalea-physics/src/collision/blocks.rs b/azalea-physics/src/collision/blocks.rs
index 9394bbc7..01784963 100644
--- a/azalea-physics/src/collision/blocks.rs
+++ b/azalea-physics/src/collision/blocks.rs
@@ -6,11 +6,12 @@
#![allow(clippy::explicit_auto_deref)]
#![allow(clippy::redundant_closure)]
-use super::VoxelShape;
-use crate::collision::{self, Shapes};
use azalea_block::*;
use once_cell::sync::Lazy;
+use super::VoxelShape;
+use crate::collision::{self, Shapes};
+
pub trait BlockWithShape {
fn shape(&self) -> &'static VoxelShape;
/// Tells you whether the block has an empty shape.
diff --git a/azalea-physics/src/collision/mergers.rs b/azalea-physics/src/collision/mergers.rs
index c43412d1..85fd2826 100755
--- a/azalea-physics/src/collision/mergers.rs
+++ b/azalea-physics/src/collision/mergers.rs
@@ -1,8 +1,9 @@
use std::cmp::{self, Ordering};
-use super::CubePointRange;
use azalea_core::math::{gcd, lcm, EPSILON};
+use super::CubePointRange;
+
#[derive(Debug)]
pub enum IndexMerger {
Identical {
diff --git a/azalea-physics/src/collision/shape.rs b/azalea-physics/src/collision/shape.rs
index edcfbf24..fab8d8dc 100755
--- a/azalea-physics/src/collision/shape.rs
+++ b/azalea-physics/src/collision/shape.rs
@@ -1,12 +1,14 @@
-use super::mergers::IndexMerger;
-use crate::collision::{BitSetDiscreteVoxelShape, DiscreteVoxelShape, AABB};
+use std::{cmp, num::NonZeroU32, sync::LazyLock};
+
use azalea_core::{
block_hit_result::BlockHitResult,
direction::{Axis, AxisCycle, Direction},
math::{binary_search, EPSILON},
position::{BlockPos, Vec3},
};
-use std::{cmp, num::NonZeroU32, sync::LazyLock};
+
+use super::mergers::IndexMerger;
+use crate::collision::{BitSetDiscreteVoxelShape, DiscreteVoxelShape, AABB};
pub struct Shapes;
diff --git a/azalea-physics/src/collision/world_collisions.rs b/azalea-physics/src/collision/world_collisions.rs
index 9d25e988..991721b2 100644
--- a/azalea-physics/src/collision/world_collisions.rs
+++ b/azalea-physics/src/collision/world_collisions.rs
@@ -1,5 +1,5 @@
-use super::{Shapes, BLOCK_SHAPE};
-use crate::collision::{BlockWithShape, VoxelShape, AABB};
+use std::sync::Arc;
+
use azalea_block::BlockState;
use azalea_core::{
cursor3d::{Cursor3d, CursorIterationType},
@@ -8,7 +8,9 @@ use azalea_core::{
};
use azalea_world::{Chunk, Instance};
use parking_lot::RwLock;
-use std::sync::Arc;
+
+use super::{Shapes, BLOCK_SHAPE};
+use crate::collision::{BlockWithShape, VoxelShape, AABB};
pub fn get_block_collisions(world: &Instance, aabb: AABB) -> Vec<VoxelShape> {
let mut state = BlockCollisionsState::new(world, aabb);
diff --git a/azalea-physics/src/lib.rs b/azalea-physics/src/lib.rs
index 35f7f1d0..70260396 100644
--- a/azalea-physics/src/lib.rs
+++ b/azalea-physics/src/lib.rs
@@ -422,12 +422,13 @@ fn jump_boost_power() -> f64 {
#[cfg(test)]
mod tests {
- use super::*;
use azalea_core::{position::ChunkPos, resource_location::ResourceLocation};
use azalea_entity::{EntityBundle, EntityPlugin};
use azalea_world::{Chunk, MinecraftEntityId, PartialInstance};
use uuid::Uuid;
+ use super::*;
+
/// You need an app to spawn entities in the world and do updates.
fn make_test_app() -> App {
let mut app = App::new();
diff --git a/azalea-protocol/examples/handshake_proxy.rs b/azalea-protocol/examples/handshake_proxy.rs
index 442db386..8e675c58 100644
--- a/azalea-protocol/examples/handshake_proxy.rs
+++ b/azalea-protocol/examples/handshake_proxy.rs
@@ -1,6 +1,8 @@
//! A "simple" server that gets login information and proxies connections.
//! After login all connections are encrypted and Azalea cannot read them.
+use std::error::Error;
+
use azalea_protocol::{
connect::Connection,
packets::{
@@ -22,7 +24,6 @@ use azalea_protocol::{
};
use futures::FutureExt;
use once_cell::sync::Lazy;
-use std::error::Error;
use tokio::{
io::{self, AsyncWriteExt},
net::{TcpListener, TcpStream},
diff --git a/azalea-protocol/src/connect.rs b/azalea-protocol/src/connect.rs
index 20a6f403..0a449bfd 100755
--- a/azalea-protocol/src/connect.rs
+++ b/azalea-protocol/src/connect.rs
@@ -1,5 +1,21 @@
//! Connect to remote servers/clients.
+use std::fmt::Debug;
+use std::io::Cursor;
+use std::marker::PhantomData;
+use std::net::SocketAddr;
+
+use azalea_auth::game_profile::GameProfile;
+use azalea_auth::sessionserver::{ClientSessionServerError, ServerSessionServerError};
+use azalea_crypto::{Aes128CfbDec, Aes128CfbEnc};
+use bytes::BytesMut;
+use thiserror::Error;
+use tokio::io::{AsyncWriteExt, BufStream};
+use tokio::net::tcp::{OwnedReadHalf, OwnedWriteHalf, ReuniteError};
+use tokio::net::TcpStream;
+use tracing::{error, info};
+use uuid::Uuid;
+
use crate::packets::configuration::{
ClientboundConfigurationPacket, ServerboundConfigurationPacket,
};
@@ -11,20 +27,6 @@ use crate::packets::status::{ClientboundStatusPacket, ServerboundStatusPacket};
use crate::packets::ProtocolPacket;
use crate::read::{deserialize_packet, read_raw_packet, try_read_raw_packet, ReadPacketError};
use crate::write::{serialize_packet, write_raw_packet};
-use azalea_auth::game_profile::GameProfile;
-use azalea_auth::sessionserver::{ClientSessionServerError, ServerSessionServerError};
-use azalea_crypto::{Aes128CfbDec, Aes128CfbEnc};
-use bytes::BytesMut;
-use std::fmt::Debug;
-use std::io::Cursor;
-use std::marker::PhantomData;
-use std::net::SocketAddr;
-use thiserror::Error;
-use tokio::io::{AsyncWriteExt, BufStream};
-use tokio::net::tcp::{OwnedReadHalf, OwnedWriteHalf, ReuniteError};
-use tokio::net::TcpStream;
-use tracing::{error, info};
-use uuid::Uuid;
pub struct RawReadConnection {
pub read_stream: OwnedReadHalf,
diff --git a/azalea-protocol/src/lib.rs b/azalea-protocol/src/lib.rs
index 8683233e..0b2db1cf 100644
--- a/azalea-protocol/src/lib.rs
+++ b/azalea-protocol/src/lib.rs
@@ -103,6 +103,9 @@ impl serde::Serialize for ServerAddress {
mod tests {
use std::io::Cursor;
+ use bytes::BytesMut;
+ use uuid::Uuid;
+
use crate::{
packets::{
game::serverbound_chat_packet::{LastSeenMessagesUpdate, ServerboundChatPacket},
@@ -111,8 +114,6 @@ mod tests {
read::{compression_decoder, read_packet},
write::{compression_encoder, serialize_packet, write_packet},
};
- use bytes::BytesMut;
- use uuid::Uuid;
#[tokio::test]
async fn test_hello_packet() {
diff --git a/azalea-protocol/src/packets/configuration/clientbound_update_tags_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_update_tags_packet.rs
index 8ef42a76..10f66e23 100644
--- a/azalea-protocol/src/packets/configuration/clientbound_update_tags_packet.rs
+++ b/azalea-protocol/src/packets/configuration/clientbound_update_tags_packet.rs
@@ -1,10 +1,11 @@
+use std::io::Cursor;
+use std::ops::Deref;
+use std::{collections::HashMap, io::Write};
+
use azalea_buf::{BufReadError, McBuf, McBufVarReadable, McBufVarWritable};
use azalea_buf::{McBufReadable, McBufWritable};
use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ClientboundConfigurationPacket;
-use std::io::Cursor;
-use std::ops::Deref;
-use std::{collections::HashMap, io::Write};
#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)]
pub struct ClientboundUpdateTagsPacket {
diff --git a/azalea-protocol/src/packets/configuration/serverbound_client_information_packet.rs b/azalea-protocol/src/packets/configuration/serverbound_client_information_packet.rs
index d00c30ec..b5fd6a35 100644
--- a/azalea-protocol/src/packets/configuration/serverbound_client_information_packet.rs
+++ b/azalea-protocol/src/packets/configuration/serverbound_client_information_packet.rs
@@ -146,9 +146,10 @@ impl McBufWritable for ModelCustomization {
#[cfg(test)]
mod tests {
- use super::*;
use std::io::Cursor;
+ use super::*;
+
#[test]
fn test_client_information_packet() {
{
diff --git a/azalea-protocol/src/packets/game/clientbound_award_stats_packet.rs b/azalea-protocol/src/packets/game/clientbound_award_stats_packet.rs
index aaec1849..32e2c8aa 100755
--- a/azalea-protocol/src/packets/game/clientbound_award_stats_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_award_stats_packet.rs
@@ -1,6 +1,7 @@
+use std::collections::HashMap;
+
use azalea_buf::McBuf;
use azalea_protocol_macros::ClientboundGamePacket;
-use std::collections::HashMap;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundAwardStatsPacket {
diff --git a/azalea-protocol/src/packets/game/clientbound_boss_event_packet.rs b/azalea-protocol/src/packets/game/clientbound_boss_event_packet.rs
index 16fb6f61..65240edf 100755
--- a/azalea-protocol/src/packets/game/clientbound_boss_event_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_boss_event_packet.rs
@@ -1,11 +1,12 @@
+use std::io::Cursor;
+use std::io::Write;
+
use azalea_buf::{
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
};
use azalea_chat::FormattedText;
use azalea_core::bitset::FixedBitSet;
use azalea_protocol_macros::ClientboundGamePacket;
-use std::io::Cursor;
-use std::io::Write;
use uuid::Uuid;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
diff --git a/azalea-protocol/src/packets/game/clientbound_command_suggestions_packet.rs b/azalea-protocol/src/packets/game/clientbound_command_suggestions_packet.rs
index 13887331..c9752ee9 100755
--- a/azalea-protocol/src/packets/game/clientbound_command_suggestions_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_command_suggestions_packet.rs
@@ -11,10 +11,12 @@ pub struct ClientboundCommandSuggestionsPacket {
#[cfg(test)]
mod tests {
- use super::*;
+ use std::io::Cursor;
+
use azalea_brigadier::{context::StringRange, suggestion::Suggestion};
use azalea_buf::{McBufReadable, McBufWritable};
- use std::io::Cursor;
+
+ use super::*;
#[test]
fn test_suggestions() {
diff --git a/azalea-protocol/src/packets/game/clientbound_commands_packet.rs b/azalea-protocol/src/packets/game/clientbound_commands_packet.rs
index 822f62df..10055e37 100755
--- a/azalea-protocol/src/packets/game/clientbound_commands_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_commands_packet.rs
@@ -1,9 +1,10 @@
+use std::io::{Cursor, Write};
+
use azalea_buf::{
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
};
use azalea_core::{bitset::FixedBitSet, resource_location::ResourceLocation};
use azalea_protocol_macros::ClientboundGamePacket;
-use std::io::{Cursor, Write};
use tracing::warn;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
diff --git a/azalea-protocol/src/packets/game/clientbound_delete_chat_packet.rs b/azalea-protocol/src/packets/game/clientbound_delete_chat_packet.rs
index b8377afe..eef9b561 100755
--- a/azalea-protocol/src/packets/game/clientbound_delete_chat_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_delete_chat_packet.rs
@@ -1,7 +1,8 @@
-use super::clientbound_player_chat_packet::PackedMessageSignature;
use azalea_buf::McBuf;
use azalea_protocol_macros::ClientboundGamePacket;
+use super::clientbound_player_chat_packet::PackedMessageSignature;
+
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundDeleteChatPacket {
pub signature: PackedMessageSignature,
diff --git a/azalea-protocol/src/packets/game/clientbound_disguised_chat_packet.rs b/azalea-protocol/src/packets/game/clientbound_disguised_chat_packet.rs
index e1ccff7e..24e1a992 100644
--- a/azalea-protocol/src/packets/game/clientbound_disguised_chat_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_disguised_chat_packet.rs
@@ -1,4 +1,3 @@
-use super::clientbound_player_chat_packet::ChatTypeBound;
use azalea_buf::McBuf;
use azalea_chat::{
translatable_component::{StringOrComponent, TranslatableComponent},
@@ -6,6 +5,8 @@ use azalea_chat::{
};
use azalea_protocol_macros::ClientboundGamePacket;
+use super::clientbound_player_chat_packet::ChatTypeBound;
+
// A disguised chat packet is basically the same as a normal
// [`ClientboundPlayerChatPacket`], except that it doesn't have any of the chat
// signing things. Vanilla servers use this when messages are sent from the
diff --git a/azalea-protocol/src/packets/game/clientbound_login_packet.rs b/azalea-protocol/src/packets/game/clientbound_login_packet.rs
index 20ed30f0..234439d5 100755
--- a/azalea-protocol/src/packets/game/clientbound_login_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_login_packet.rs
@@ -1,9 +1,9 @@
-use crate::packets::common::CommonPlayerSpawnInfo;
-
use azalea_buf::McBuf;
use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ClientboundGamePacket;
+use crate::packets::common::CommonPlayerSpawnInfo;
+
/// The first packet sent by the server to the client after login.
///
/// This packet contains information about the state of the player, the
diff --git a/azalea-protocol/src/packets/game/clientbound_open_book_packet.rs b/azalea-protocol/src/packets/game/clientbound_open_book_packet.rs
index bf27d4e0..1b450b80 100755
--- a/azalea-protocol/src/packets/game/clientbound_open_book_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_open_book_packet.rs
@@ -1,7 +1,8 @@
-use super::serverbound_interact_packet::InteractionHand;
use azalea_buf::McBuf;
use azalea_protocol_macros::ClientboundGamePacket;
+use super::serverbound_interact_packet::InteractionHand;
+
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundOpenBookPacket {
pub hand: InteractionHand,
diff --git a/azalea-protocol/src/packets/game/clientbound_player_abilities_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_abilities_packet.rs
index edb5f949..48c8b41a 100755
--- a/azalea-protocol/src/packets/game/clientbound_player_abilities_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_player_abilities_packet.rs
@@ -1,8 +1,9 @@
+use std::io::{Cursor, Write};
+
use azalea_buf::{BufReadError, McBuf};
use azalea_buf::{McBufReadable, McBufWritable};
use azalea_core::bitset::FixedBitSet;
use azalea_protocol_macros::ClientboundGamePacket;
-use std::io::{Cursor, Write};
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundPlayerAbilitiesPacket {
diff --git a/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs
index 31f18dde..9cd20efc 100644
--- a/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs
@@ -1,3 +1,5 @@
+use std::io::{Cursor, Write};
+
use azalea_buf::{
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
};
@@ -8,7 +10,6 @@ use azalea_chat::{
use azalea_core::bitset::BitSet;
use azalea_crypto::MessageSignature;
use azalea_protocol_macros::ClientboundGamePacket;
-use std::io::{Cursor, Write};
use uuid::Uuid;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket, PartialEq)]
diff --git a/azalea-protocol/src/packets/game/clientbound_player_info_update_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_info_update_packet.rs
index 2024f082..2b286e64 100644
--- a/azalea-protocol/src/packets/game/clientbound_player_info_update_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_player_info_update_packet.rs
@@ -1,3 +1,8 @@
+use std::{
+ collections::HashMap,
+ io::{Cursor, Write},
+};
+
use azalea_auth::game_profile::{GameProfile, ProfilePropertyValue};
use azalea_buf::{
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
@@ -5,10 +10,6 @@ use azalea_buf::{
use azalea_chat::FormattedText;
use azalea_core::{bitset::FixedBitSet, game_type::GameMode};
use azalea_protocol_macros::ClientboundGamePacket;
-use std::{
- collections::HashMap,
- io::{Cursor, Write},
-};
use uuid::Uuid;
use super::serverbound_chat_session_update_packet::RemoteChatSessionData;
diff --git a/azalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs
index 00f3980a..165d05db 100755
--- a/azalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs
@@ -1,8 +1,9 @@
+use std::io::Cursor;
+
use azalea_buf::{BufReadError, McBuf};
use azalea_buf::{McBufReadable, McBufWritable};
use azalea_inventory::ItemSlot;
use azalea_protocol_macros::ClientboundGamePacket;
-use std::io::Cursor;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundSetEquipmentPacket {
diff --git a/azalea-protocol/src/packets/game/clientbound_set_player_team_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_player_team_packet.rs
index 1a09aeb5..724b86aa 100755
--- a/azalea-protocol/src/packets/game/clientbound_set_player_team_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_set_player_team_packet.rs
@@ -1,7 +1,8 @@
+use std::io::{Cursor, Write};
+
use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable};
use azalea_chat::{style::ChatFormatting, FormattedText};
use azalea_protocol_macros::ClientboundGamePacket;
-use std::io::{Cursor, Write};
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundSetPlayerTeamPacket {
diff --git a/azalea-protocol/src/packets/game/clientbound_stop_sound_packet.rs b/azalea-protocol/src/packets/game/clientbound_stop_sound_packet.rs
index dd601da9..48c80237 100755
--- a/azalea-protocol/src/packets/game/clientbound_stop_sound_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_stop_sound_packet.rs
@@ -1,7 +1,8 @@
+use std::io::{Cursor, Write};
+
use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
use azalea_core::{bitset::FixedBitSet, resource_location::ResourceLocation};
use azalea_protocol_macros::ClientboundGamePacket;
-use std::io::{Cursor, Write};
use super::clientbound_sound_packet::SoundSource;
diff --git a/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs
index 00a846e8..5934b443 100755
--- a/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs
@@ -1,10 +1,11 @@
+use std::collections::HashMap;
+use std::io::Cursor;
+
use azalea_buf::McBuf;
use azalea_chat::FormattedText;
use azalea_core::resource_location::ResourceLocation;
use azalea_inventory::ItemSlot;
use azalea_protocol_macros::ClientboundGamePacket;
-use std::collections::HashMap;
-use std::io::Cursor;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundUpdateAdvancementsPacket {
@@ -117,9 +118,10 @@ pub struct AdvancementHolder {
#[cfg(test)]
mod tests {
- use super::*;
use azalea_buf::{McBufReadable, McBufWritable};
+ use super::*;
+
#[test]
fn test() {
let packet = ClientboundUpdateAdvancementsPacket {
diff --git a/azalea-protocol/src/packets/game/clientbound_update_tags_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_tags_packet.rs
index e861e575..bcdef64a 100755
--- a/azalea-protocol/src/packets/game/clientbound_update_tags_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_update_tags_packet.rs
@@ -1,10 +1,11 @@
+use std::io::Cursor;
+use std::ops::Deref;
+use std::{collections::HashMap, io::Write};
+
use azalea_buf::{BufReadError, McBuf, McBufVarReadable, McBufVarWritable};
use azalea_buf::{McBufReadable, McBufWritable};
use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ClientboundGamePacket;
-use std::io::Cursor;
-use std::ops::Deref;
-use std::{collections::HashMap, io::Write};
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundUpdateTagsPacket {
diff --git a/azalea-protocol/src/packets/game/serverbound_chat_command_signed_packet.rs b/azalea-protocol/src/packets/game/serverbound_chat_command_signed_packet.rs
index bb814d55..f64b79cc 100755
--- a/azalea-protocol/src/packets/game/serverbound_chat_command_signed_packet.rs
+++ b/azalea-protocol/src/packets/game/serverbound_chat_command_signed_packet.rs
@@ -1,8 +1,9 @@
-use super::serverbound_chat_packet::LastSeenMessagesUpdate;
use azalea_buf::McBuf;
use azalea_crypto::MessageSignature;
use azalea_protocol_macros::ServerboundGamePacket;
+use super::serverbound_chat_packet::LastSeenMessagesUpdate;
+
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
pub struct ServerboundChatCommandSignedPacket {
pub command: String,
diff --git a/azalea-protocol/src/packets/game/serverbound_container_click_packet.rs b/azalea-protocol/src/packets/game/serverbound_container_click_packet.rs
index 119af220..e2954720 100755
--- a/azalea-protocol/src/packets/game/serverbound_container_click_packet.rs
+++ b/azalea-protocol/src/packets/game/serverbound_container_click_packet.rs
@@ -1,7 +1,8 @@
+use std::collections::HashMap;
+
use azalea_buf::McBuf;
use azalea_inventory::{operations::ClickType, ItemSlot};
use azalea_protocol_macros::ServerboundGamePacket;
-use std::collections::HashMap;
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
pub struct ServerboundContainerClickPacket {
diff --git a/azalea-protocol/src/packets/game/serverbound_interact_packet.rs b/azalea-protocol/src/packets/game/serverbound_interact_packet.rs
index 315134c9..e393920c 100755
--- a/azalea-protocol/src/packets/game/serverbound_interact_packet.rs
+++ b/azalea-protocol/src/packets/game/serverbound_interact_packet.rs
@@ -1,8 +1,10 @@
-use crate::packets::BufReadError;
+use std::io::{Cursor, Write};
+
use azalea_buf::{McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
use azalea_core::position::Vec3;
use azalea_protocol_macros::ServerboundGamePacket;
-use std::io::{Cursor, Write};
+
+use crate::packets::BufReadError;
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
pub struct ServerboundInteractPacket {
diff --git a/azalea-protocol/src/packets/game/serverbound_player_abilities_packet.rs b/azalea-protocol/src/packets/game/serverbound_player_abilities_packet.rs
index 384f7dcc..900d1824 100755
--- a/azalea-protocol/src/packets/game/serverbound_player_abilities_packet.rs
+++ b/azalea-protocol/src/packets/game/serverbound_player_abilities_packet.rs
@@ -1,8 +1,10 @@
-use crate::packets::BufReadError;
+use std::io::Cursor;
+
use azalea_buf::{McBufReadable, McBufWritable};
use azalea_core::bitset::FixedBitSet;
use azalea_protocol_macros::ServerboundGamePacket;
-use std::io::Cursor;
+
+use crate::packets::BufReadError;
#[derive(Clone, Debug, ServerboundGamePacket)]
pub struct ServerboundPlayerAbilitiesPacket {
diff --git a/azalea-protocol/src/packets/game/serverbound_seen_advancements_packet.rs b/azalea-protocol/src/packets/game/serverbound_seen_advancements_packet.rs
index fb15293b..54fd4cc9 100755
--- a/azalea-protocol/src/packets/game/serverbound_seen_advancements_packet.rs
+++ b/azalea-protocol/src/packets/game/serverbound_seen_advancements_packet.rs
@@ -1,8 +1,10 @@
-use crate::packets::BufReadError;
+use std::io::Cursor;
+
use azalea_buf::{McBuf, McBufReadable, McBufWritable};
use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ServerboundGamePacket;
-use std::io::Cursor;
+
+use crate::packets::BufReadError;
#[derive(Clone, Debug, ServerboundGamePacket)]
pub struct ServerboundSeenAdvancementsPacket {
diff --git a/azalea-protocol/src/packets/game/serverbound_set_command_block_packet.rs b/azalea-protocol/src/packets/game/serverbound_set_command_block_packet.rs
index c5feb213..db6557fd 100755
--- a/azalea-protocol/src/packets/game/serverbound_set_command_block_packet.rs
+++ b/azalea-protocol/src/packets/game/serverbound_set_command_block_packet.rs
@@ -1,8 +1,10 @@
-use crate::packets::McBufWritable;
+use std::io::Cursor;
+
use azalea_buf::{BufReadError, McBuf, McBufReadable};
use azalea_core::{bitset::FixedBitSet, position::BlockPos};
use azalea_protocol_macros::ServerboundGamePacket;
-use std::io::Cursor;
+
+use crate::packets::McBufWritable;
#[derive(Clone, Debug, ServerboundGamePacket)]
pub struct ServerboundSetCommandBlockPacket {
diff --git a/azalea-protocol/src/packets/game/serverbound_set_jigsaw_block_packet.rs b/azalea-protocol/src/packets/game/serverbound_set_jigsaw_block_packet.rs
index a4b6f726..33a82311 100755
--- a/azalea-protocol/src/packets/game/serverbound_set_jigsaw_block_packet.rs
+++ b/azalea-protocol/src/packets/game/serverbound_set_jigsaw_block_packet.rs
@@ -1,12 +1,14 @@
-use crate::packets::BufReadError;
-use crate::packets::McBufWritable;
+use std::io::Cursor;
+use std::io::Write;
+
use azalea_buf::McBuf;
use azalea_buf::McBufReadable;
use azalea_core::position::BlockPos;
use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ServerboundGamePacket;
-use std::io::Cursor;
-use std::io::Write;
+
+use crate::packets::BufReadError;
+use crate::packets::McBufWritable;
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
pub struct ServerboundSetJigsawBlockPacket {
diff --git a/azalea-protocol/src/packets/game/serverbound_set_structure_block_packet.rs b/azalea-protocol/src/packets/game/serverbound_set_structure_block_packet.rs
index c10966c9..c2872812 100755
--- a/azalea-protocol/src/packets/game/serverbound_set_structure_block_packet.rs
+++ b/azalea-protocol/src/packets/game/serverbound_set_structure_block_packet.rs
@@ -1,9 +1,11 @@
-use crate::packets::BufReadError;
+use std::io::{Cursor, Write};
+
use azalea_buf::McBuf;
use azalea_buf::{McBufReadable, McBufWritable};
use azalea_core::{bitset::FixedBitSet, position::BlockPos};
use azalea_protocol_macros::ServerboundGamePacket;
-use std::io::{Cursor, Write};
+
+use crate::packets::BufReadError;
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
pub struct ServerboundSetStructureBlockPacket {
diff --git a/azalea-protocol/src/packets/game/serverbound_swing_packet.rs b/azalea-protocol/src/packets/game/serverbound_swing_packet.rs
index a3190843..53b4a6c1 100755
--- a/azalea-protocol/src/packets/game/serverbound_swing_packet.rs
+++ b/azalea-protocol/src/packets/game/serverbound_swing_packet.rs
@@ -1,7 +1,8 @@
-use crate::packets::game::serverbound_interact_packet::InteractionHand;
use azalea_buf::McBuf;
use azalea_protocol_macros::ServerboundGamePacket;
+use crate::packets::game::serverbound_interact_packet::InteractionHand;
+
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
pub struct ServerboundSwingPacket {
pub hand: InteractionHand,
diff --git a/azalea-protocol/src/packets/game/serverbound_use_item_on_packet.rs b/azalea-protocol/src/packets/game/serverbound_use_item_on_packet.rs
index 2d471114..66048327 100755
--- a/azalea-protocol/src/packets/game/serverbound_use_item_on_packet.rs
+++ b/azalea-protocol/src/packets/game/serverbound_use_item_on_packet.rs
@@ -1,11 +1,13 @@
-use crate::packets::game::serverbound_interact_packet::InteractionHand;
+use std::io::{Cursor, Write};
+
use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable};
use azalea_core::{
direction::Direction,
position::{BlockPos, Vec3},
};
use azalea_protocol_macros::ServerboundGamePacket;
-use std::io::{Cursor, Write};
+
+use crate::packets::game::serverbound_interact_packet::InteractionHand;
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
pub struct ServerboundUseItemOnPacket {
diff --git a/azalea-protocol/src/packets/game/serverbound_use_item_packet.rs b/azalea-protocol/src/packets/game/serverbound_use_item_packet.rs
index 3129244a..b9f12f23 100755
--- a/azalea-protocol/src/packets/game/serverbound_use_item_packet.rs
+++ b/azalea-protocol/src/packets/game/serverbound_use_item_packet.rs
@@ -1,7 +1,8 @@
-use crate::packets::game::serverbound_interact_packet::InteractionHand;
use azalea_buf::McBuf;
use azalea_protocol_macros::ServerboundGamePacket;
+use crate::packets::game::serverbound_interact_packet::InteractionHand;
+
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
pub struct ServerboundUseItemPacket {
pub hand: InteractionHand,
diff --git a/azalea-protocol/src/packets/handshaking/client_intention_packet.rs b/azalea-protocol/src/packets/handshaking/client_intention_packet.rs
index 82be621a..c0b694c8 100755
--- a/azalea-protocol/src/packets/handshaking/client_intention_packet.rs
+++ b/azalea-protocol/src/packets/handshaking/client_intention_packet.rs
@@ -1,7 +1,9 @@
-use crate::packets::ClientIntention;
+use std::hash::Hash;
+
use azalea_buf::McBuf;
use azalea_protocol_macros::ServerboundHandshakePacket;
-use std::hash::Hash;
+
+use crate::packets::ClientIntention;
#[derive(Hash, Clone, Debug, McBuf, ServerboundHandshakePacket)]
pub struct ClientIntentionPacket {
diff --git a/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs b/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs
index 50d2e2d3..75993fd9 100755
--- a/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs
+++ b/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs
@@ -1,7 +1,8 @@
+use std::hash::Hash;
+
use azalea_buf::{McBuf, UnsizedByteArray};
use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ClientboundLoginPacket;
-use std::hash::Hash;
#[derive(Hash, Clone, Debug, McBuf, ClientboundLoginPacket)]
pub struct ClientboundCustomQueryPacket {
diff --git a/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs b/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs
index 6976298a..4b8fb0c8 100755
--- a/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs
+++ b/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs
@@ -1,6 +1,7 @@
+use std::hash::Hash;
+
use azalea_buf::McBuf;
use azalea_protocol_macros::ClientboundLoginPacket;
-use std::hash::Hash;
#[derive(Hash, Clone, Debug, ClientboundLoginPacket, McBuf)]
pub struct ClientboundLoginCompressionPacket {
diff --git a/azalea-protocol/src/packets/login/serverbound_custom_query_answer_packet.rs b/azalea-protocol/src/packets/login/serverbound_custom_query_answer_packet.rs
index 7eb8b28f..fe9460a2 100644
--- a/azalea-protocol/src/packets/login/serverbound_custom_query_answer_packet.rs
+++ b/azalea-protocol/src/packets/login/serverbound_custom_query_answer_packet.rs
@@ -1,6 +1,7 @@
+use std::hash::Hash;
+
use azalea_buf::{McBuf, UnsizedByteArray};
use azalea_protocol_macros::ServerboundLoginPacket;
-use std::hash::Hash;
#[derive(Hash, Clone, Debug, McBuf, ServerboundLoginPacket)]
pub struct ServerboundCustomQueryAnswerPacket {
diff --git a/azalea-protocol/src/packets/login/serverbound_hello_packet.rs b/azalea-protocol/src/packets/login/serverbound_hello_packet.rs
index d46fe308..51ff1830 100755
--- a/azalea-protocol/src/packets/login/serverbound_hello_packet.rs
+++ b/azalea-protocol/src/packets/login/serverbound_hello_packet.rs
@@ -12,9 +12,10 @@ pub struct ServerboundHelloPacket {
mod tests {
use std::io::Cursor;
- use super::*;
use azalea_buf::{McBufReadable, McBufWritable};
+ use super::*;
+
#[test]
fn test_read_write() {
let packet = ServerboundHelloPacket {
diff --git a/azalea-protocol/src/packets/mod.rs b/azalea-protocol/src/packets/mod.rs
index 6cec015f..1dabe175 100755
--- a/azalea-protocol/src/packets/mod.rs
+++ b/azalea-protocol/src/packets/mod.rs
@@ -5,10 +5,12 @@ pub mod handshaking;
pub mod login;
pub mod status;
-use crate::read::ReadPacketError;
-use azalea_buf::{BufReadError, McBufVarReadable, McBufVarWritable, McBufWritable};
use std::io::{Cursor, Write};
+use azalea_buf::{BufReadError, McBufVarReadable, McBufVarWritable, McBufWritable};
+
+use crate::read::ReadPacketError;
+
// TODO: rename the packet files to just like clientbound_add_entity instead of
// clientbound_add_entity_packet
diff --git a/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs b/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs
index 332bfdc4..1316894e 100755
--- a/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs
+++ b/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs
@@ -1,9 +1,10 @@
+use std::io::{Cursor, Write};
+
use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
use azalea_chat::FormattedText;
use azalea_protocol_macros::ClientboundStatusPacket;
use serde::{Deserialize, Serialize};
use serde_json::value::Serializer;
-use std::io::{Cursor, Write};
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Version {
diff --git a/azalea-protocol/src/read.rs b/azalea-protocol/src/read.rs
index 434cc74a..558e1072 100755
--- a/azalea-protocol/src/read.rs
+++ b/azalea-protocol/src/read.rs
@@ -1,6 +1,11 @@
//! Read packets from a stream.
-use crate::packets::ProtocolPacket;
+use std::backtrace::Backtrace;
+use std::{
+ fmt::Debug,
+ io::{Cursor, Read},
+};
+
use azalea_buf::BufReadError;
use azalea_buf::McBufVarReadable;
use azalea_crypto::Aes128CfbDec;
@@ -9,16 +14,13 @@ use bytes::BytesMut;
use flate2::read::ZlibDecoder;
use futures::StreamExt;
use futures_lite::future;
-use std::backtrace::Backtrace;
-use std::{
- fmt::Debug,
- io::{Cursor, Read},
-};
use thiserror::Error;
use tokio::io::AsyncRead;
use tokio_util::codec::{BytesCodec, FramedRead};
use tracing::trace;
+use crate::packets::ProtocolPacket;
+
#[derive(Error, Debug)]
pub enum ReadPacketError {
#[error("Error reading packet {packet_name} (id {packet_id}): {source}")]
diff --git a/azalea-protocol/src/resolver.rs b/azalea-protocol/src/resolver.rs
index af59be72..43f15dce 100755
--- a/azalea-protocol/src/resolver.rs
+++ b/azalea-protocol/src/resolver.rs
@@ -1,14 +1,16 @@
//! Resolve IPs from hostnames.
-use crate::ServerAddress;
-use async_recursion::async_recursion;
use std::net::{IpAddr, SocketAddr};
+
+use async_recursion::async_recursion;
use thiserror::Error;
use trust_dns_resolver::{
config::{ResolverConfig, ResolverOpts},
Name, TokioAsyncResolver,
};
+use crate::ServerAddress;
+
#[derive(Error, Debug)]
pub enum ResolverError {
#[error("No SRV record found")]
diff --git a/azalea-protocol/src/write.rs b/azalea-protocol/src/write.rs
index 532f4651..0ec4308b 100755
--- a/azalea-protocol/src/write.rs
+++ b/azalea-protocol/src/write.rs
@@ -1,14 +1,16 @@
//! Write packets to a stream.
-use crate::{packets::ProtocolPacket, read::MAXIMUM_UNCOMPRESSED_LENGTH};
+use std::{fmt::Debug, io::Read};
+
use azalea_buf::McBufVarWritable;
use azalea_crypto::Aes128CfbEnc;
use flate2::{bufread::ZlibEncoder, Compression};
-use std::{fmt::Debug, io::Read};
use thiserror::Error;
use tokio::io::{AsyncWrite, AsyncWriteExt};
use tracing::trace;
+use crate::{packets::ProtocolPacket, read::MAXIMUM_UNCOMPRESSED_LENGTH};
+
/// Prepend the length of the packet to it.
fn frame_prepender(mut data: Vec<u8>) -> Result<Vec<u8>, std::io::Error> {
let mut buf = Vec::new();
diff --git a/azalea-registry/src/extra.rs b/azalea-registry/src/extra.rs
index 79533652..d5816e3b 100644
--- a/azalea-registry/src/extra.rs
+++ b/azalea-registry/src/extra.rs
@@ -2,9 +2,10 @@
//! you should be relying on those if possible, but these are provided for your
//! convenience anyways.
-use crate::Registry;
use azalea_registry_macros::registry;
+use crate::Registry;
+
registry! {
enum WolfVariant {
Pale => "minecraft:wolf",
diff --git a/azalea-registry/src/lib.rs b/azalea-registry/src/lib.rs
index e66ccabc..e4287b1c 100755
--- a/azalea-registry/src/lib.rs
+++ b/azalea-registry/src/lib.rs
@@ -13,7 +13,6 @@ use std::io::{Cursor, Write};
use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
use azalea_registry_macros::registry;
-
pub use extra::*;
pub trait Registry: McBufReadable + McBufWritable
diff --git a/azalea-world/src/chunk_storage.rs b/azalea-world/src/chunk_storage.rs
index f1239f8a..5f8b8951 100755
--- a/azalea-world/src/chunk_storage.rs
+++ b/azalea-world/src/chunk_storage.rs
@@ -1,13 +1,3 @@
-use crate::heightmap::Heightmap;
-use crate::heightmap::HeightmapKind;
-use crate::palette::PalettedContainer;
-use crate::palette::PalettedContainerKind;
-use azalea_block::BlockState;
-use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
-use azalea_core::position::{BlockPos, ChunkBlockPos, ChunkPos, ChunkSectionBlockPos};
-use nohash_hasher::IntMap;
-use parking_lot::RwLock;
-use simdnbt::owned::NbtCompound;
use std::collections::hash_map::Entry;
use std::str::FromStr;
use std::{
@@ -16,8 +6,20 @@ use std::{
io::{Cursor, Write},
sync::{Arc, Weak},
};
+
+use azalea_block::BlockState;
+use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
+use azalea_core::position::{BlockPos, ChunkBlockPos, ChunkPos, ChunkSectionBlockPos};
+use nohash_hasher::IntMap;
+use parking_lot::RwLock;
+use simdnbt::owned::NbtCompound;
use tracing::{debug, trace, warn};
+use crate::heightmap::Heightmap;
+use crate::heightmap::HeightmapKind;
+use crate::palette::PalettedContainer;
+use crate::palette::PalettedContainerKind;
+
const SECTION_HEIGHT: u32 = 16;
/// An efficient storage of chunks for a client that has a limited render
diff --git a/azalea-world/src/container.rs b/azalea-world/src/container.rs
index 69b8f908..0b3a13fd 100644
--- a/azalea-world/src/container.rs
+++ b/azalea-world/src/container.rs
@@ -1,13 +1,14 @@
+use std::{
+ collections::HashMap,
+ sync::{Arc, Weak},
+};
+
use azalea_core::{registry_holder::RegistryHolder, resource_location::ResourceLocation};
use bevy_ecs::{component::Component, system::Resource};
use derive_more::{Deref, DerefMut};
use nohash_hasher::IntMap;
use parking_lot::RwLock;
use rustc_hash::FxHashMap;
-use std::{
- collections::HashMap,
- sync::{Arc, Weak},
-};
use tracing::error;
use crate::{ChunkStorage, Instance};
diff --git a/azalea-world/src/find_blocks.rs b/azalea-world/src/find_blocks.rs
index 2d2c6d7a..39f57eec 100644
--- a/azalea-world/src/find_blocks.rs
+++ b/azalea-world/src/find_blocks.rs
@@ -246,9 +246,8 @@ impl<'a> Iterator for FindBlocks<'a> {
mod tests {
use azalea_registry::Block;
- use crate::{Chunk, PartialChunkStorage};
-
use super::*;
+ use crate::{Chunk, PartialChunkStorage};
#[test]
fn find_block() {
diff --git a/azalea-world/src/palette.rs b/azalea-world/src/palette.rs
index 2b3cdc53..27e017c4 100755
--- a/azalea-world/src/palette.rs
+++ b/azalea-world/src/palette.rs
@@ -1,6 +1,7 @@
+use std::io::{Cursor, Write};
+
use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
use azalea_core::math;
-use std::io::{Cursor, Write};
use tracing::warn;
use crate::BitStorage;
diff --git a/azalea-world/src/world.rs b/azalea-world/src/world.rs
index 84a5857c..066981e5 100644
--- a/azalea-world/src/world.rs
+++ b/azalea-world/src/world.rs
@@ -1,15 +1,17 @@
-use crate::{ChunkStorage, PartialChunkStorage};
+use std::fmt::Formatter;
+use std::{
+ collections::{HashMap, HashSet},
+ fmt::Debug,
+};
+
use azalea_block::{BlockState, FluidState};
use azalea_core::position::{BlockPos, ChunkPos};
use azalea_core::registry_holder::RegistryHolder;
use bevy_ecs::{component::Component, entity::Entity};
use derive_more::{Deref, DerefMut};
use nohash_hasher::IntMap;
-use std::fmt::Formatter;
-use std::{
- collections::{HashMap, HashSet},
- fmt::Debug,
-};
+
+use crate::{ChunkStorage, PartialChunkStorage};
/// PartialInstances are usually owned by clients, and hold strong references to
/// chunks and entities in [`Instance`]s.
diff --git a/azalea/examples/steal.rs b/azalea/examples/steal.rs
index c6ab4639..b0586f19 100644
--- a/azalea/examples/steal.rs
+++ b/azalea/examples/steal.rs
@@ -1,10 +1,11 @@
//! Steal all the diamonds from all the nearby chests.
+use std::sync::Arc;
+
use azalea::{prelude::*, BlockPos};
use azalea_inventory::operations::QuickMoveClick;
use azalea_inventory::ItemSlot;
use parking_lot::Mutex;
-use std::sync::Arc;
#[tokio::main]
async fn main() {
diff --git a/azalea/examples/testbot/commands/movement.rs b/azalea/examples/testbot/commands/movement.rs
index 4957533f..3c66fefa 100644
--- a/azalea/examples/testbot/commands/movement.rs
+++ b/azalea/examples/testbot/commands/movement.rs
@@ -9,9 +9,8 @@ use azalea::{
};
use parking_lot::Mutex;
-use crate::BotTask;
-
use super::{CommandSource, Ctx};
+use crate::BotTask;
pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) {
commands.register(
diff --git a/azalea/examples/testbot/main.rs b/azalea/examples/testbot/main.rs
index 6795e6cf..e7d68d5e 100644
--- a/azalea/examples/testbot/main.rs
+++ b/azalea/examples/testbot/main.rs
@@ -14,17 +14,17 @@
mod commands;
pub mod killaura;
-use azalea::pathfinder::PathfinderDebugParticles;
-use azalea::ClientInformation;
+use std::sync::Arc;
+use std::time::Duration;
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 parking_lot::Mutex;
-use std::sync::Arc;
-use std::time::Duration;
const USERNAME: &str = "azalea";
const ADDRESS: &str = "localhost";
@@ -38,10 +38,11 @@ const PATHFINDER_DEBUG_PARTICLES: bool = false;
#[tokio::main]
async fn main() {
{
- use parking_lot::deadlock;
use std::thread;
use std::time::Duration;
+ use parking_lot::deadlock;
+
// Create a background thread which checks for deadlocks every 10s
thread::spawn(move || loop {
thread::sleep(Duration::from_secs(10));
diff --git a/azalea/src/accept_resource_packs.rs b/azalea/src/accept_resource_packs.rs
index 02953d9e..c9765c77 100644
--- a/azalea/src/accept_resource_packs.rs
+++ b/azalea/src/accept_resource_packs.rs
@@ -1,4 +1,3 @@
-use crate::app::{App, Plugin};
use azalea_client::chunks::handle_chunk_batch_finished_event;
use azalea_client::inventory::InventorySet;
use azalea_client::packet_handling::game::SendPacketEvent;
@@ -10,6 +9,8 @@ use azalea_protocol::packets::game::serverbound_resource_pack_packet::{
use bevy_app::Update;
use bevy_ecs::prelude::*;
+use crate::app::{App, Plugin};
+
/// A plugin that makes it so bots automatically accept resource packs.
#[derive(Clone, Default)]
pub struct AcceptResourcePacksPlugin;
diff --git a/azalea/src/auto_respawn.rs b/azalea/src/auto_respawn.rs
index 07b3e0f5..43ec4821 100644
--- a/azalea/src/auto_respawn.rs
+++ b/azalea/src/auto_respawn.rs
@@ -1,4 +1,3 @@
-use crate::app::{App, Plugin};
use azalea_client::{
packet_handling::{death_event_on_0_health, game::DeathEvent},
respawn::{perform_respawn, PerformRespawnEvent},
@@ -6,6 +5,8 @@ use azalea_client::{
use bevy_app::Update;
use bevy_ecs::prelude::*;
+use crate::app::{App, Plugin};
+
/// A plugin that makes [`DeathEvent`]s send [`PerformRespawnEvent`]s.
#[derive(Clone, Default)]
pub struct AutoRespawnPlugin;
diff --git a/azalea/src/bot.rs b/azalea/src/bot.rs
index 529bb251..eee0f880 100644
--- a/azalea/src/bot.rs
+++ b/azalea/src/bot.rs
@@ -1,14 +1,5 @@
-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 std::f64::consts::PI;
+
use azalea_client::interact::SwingArmEvent;
use azalea_client::mining::Mining;
use azalea_client::TickBroadcast;
@@ -23,9 +14,19 @@ use bevy_app::Update;
use bevy_ecs::prelude::Event;
use bevy_ecs::schedule::IntoSystemConfigs;
use futures_lite::Future;
-use std::f64::consts::PI;
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::pathfinder::PathfinderPlugin;
#[derive(Clone, Default)]
diff --git a/azalea/src/container.rs b/azalea/src/container.rs
index c9283b6b..980210ae 100644
--- a/azalea/src/container.rs
+++ b/azalea/src/container.rs
@@ -1,3 +1,4 @@
+use std::fmt::Debug;
use std::fmt::Formatter;
use azalea_client::{
@@ -11,7 +12,6 @@ use azalea_protocol::packets::game::ClientboundGamePacket;
use bevy_app::{App, Plugin, Update};
use bevy_ecs::{component::Component, prelude::EventReader, system::Commands};
use futures_lite::Future;
-use std::fmt::Debug;
use crate::bot::BotClientExt;
diff --git a/azalea/src/lib.rs b/azalea/src/lib.rs
index c78b6ef1..5e412f52 100644
--- a/azalea/src/lib.rs
+++ b/azalea/src/lib.rs
@@ -34,6 +34,8 @@ pub use azalea_physics as physics;
pub use azalea_protocol as protocol;
pub use azalea_registry as registry;
pub use azalea_world as world;
+pub use bevy_app as app;
+pub use bevy_ecs as ecs;
pub use bot::*;
use ecs::component::Component;
use futures::{future::BoxFuture, Future};
@@ -42,9 +44,6 @@ use protocol::{resolver::ResolverError, ServerAddress};
use swarm::SwarmBuilder;
use thiserror::Error;
-pub use bevy_app as app;
-pub use bevy_ecs as ecs;
-
pub type BoxHandleFn<S> =
Box<dyn Fn(Client, azalea_client::Event, S) -> BoxFuture<'static, Result<(), anyhow::Error>>>;
pub type HandleFn<S, Fut> = fn(Client, azalea_client::Event, S) -> Fut;
diff --git a/azalea/src/pathfinder/mining.rs b/azalea/src/pathfinder/mining.rs
index 1bc08c43..31b37b49 100644
--- a/azalea/src/pathfinder/mining.rs
+++ b/azalea/src/pathfinder/mining.rs
@@ -4,9 +4,8 @@ use azalea_block::{BlockState, BlockStates};
use azalea_inventory::Menu;
use nohash_hasher::IntMap;
-use crate::auto_tool::best_tool_in_hotbar_for_block;
-
use super::costs::BLOCK_BREAK_ADDITIONAL_PENALTY;
+use crate::auto_tool::best_tool_in_hotbar_for_block;
pub struct MiningCache {
block_state_id_costs: UnsafeCell<IntMap<u32, f32>>,
diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs
index cb6ba2bb..1f864526 100644
--- a/azalea/src/pathfinder/mod.rs
+++ b/azalea/src/pathfinder/mod.rs
@@ -11,20 +11,11 @@ pub mod moves;
pub mod simulation;
pub mod world;
-use crate::bot::{JumpEvent, LookAtEvent};
-use crate::pathfinder::astar::a_star;
-use crate::WalkDirection;
+use std::collections::VecDeque;
+use std::sync::atomic::{self, AtomicUsize};
+use std::sync::Arc;
+use std::time::{Duration, Instant};
-use crate::app::{App, Plugin};
-use crate::ecs::{
- component::Component,
- entity::Entity,
- event::{EventReader, EventWriter},
- query::{With, Without},
- system::{Commands, Query, Res},
-};
-use crate::pathfinder::moves::PathfinderCtx;
-use crate::pathfinder::world::CachedWorld;
use azalea_client::inventory::{Inventory, InventorySet, SetSelectedHotbarSlotEvent};
use azalea_client::mining::{Mining, StartMiningBlockEvent};
use azalea_client::movement::MoveEventsSet;
@@ -42,10 +33,6 @@ use bevy_ecs::query::Changed;
use bevy_ecs::schedule::IntoSystemConfigs;
use bevy_tasks::{AsyncComputeTaskPool, Task};
use futures_lite::future;
-use std::collections::VecDeque;
-use std::sync::atomic::{self, AtomicUsize};
-use std::sync::Arc;
-use std::time::{Duration, Instant};
use tracing::{debug, error, info, trace, warn};
use self::debug::debug_render_path_with_particles;
@@ -53,6 +40,19 @@ pub use self::debug::PathfinderDebugParticles;
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 crate::pathfinder::astar::a_star;
+use crate::pathfinder::moves::PathfinderCtx;
+use crate::pathfinder::world::CachedWorld;
+use crate::WalkDirection;
#[derive(Clone, Default)]
pub struct PathfinderPlugin;
diff --git a/azalea/src/pathfinder/moves/basic.rs b/azalea/src/pathfinder/moves/basic.rs
index 54a6dc6a..bb931caf 100644
--- a/azalea/src/pathfinder/moves/basic.rs
+++ b/azalea/src/pathfinder/moves/basic.rs
@@ -6,9 +6,8 @@ use azalea_core::{
position::{BlockPos, Vec3},
};
-use crate::pathfinder::{astar, costs::*};
-
use super::{default_is_reached, Edge, ExecuteCtx, IsReachedCtx, MoveData, PathfinderCtx};
+use crate::pathfinder::{astar, costs::*};
pub fn basic_move(ctx: &mut PathfinderCtx, node: BlockPos) {
forward_move(ctx, node);
diff --git a/azalea/src/pathfinder/moves/mod.rs b/azalea/src/pathfinder/moves/mod.rs
index bb10b192..28974132 100644
--- a/azalea/src/pathfinder/moves/mod.rs
+++ b/azalea/src/pathfinder/moves/mod.rs
@@ -3,13 +3,6 @@ pub mod parkour;
use std::{fmt::Debug, sync::Arc};
-use crate::{auto_tool::best_tool_in_hotbar_for_block, JumpEvent, LookAtEvent};
-
-use super::{
- astar,
- mining::MiningCache,
- world::{is_block_state_passable, CachedWorld},
-};
use azalea_client::{
inventory::SetSelectedHotbarSlotEvent, mining::StartMiningBlockEvent, SprintDirection,
StartSprintEvent, StartWalkEvent, WalkDirection,
@@ -20,6 +13,13 @@ use azalea_world::Instance;
use bevy_ecs::{entity::Entity, event::EventWriter};
use parking_lot::RwLock;
+use super::{
+ astar,
+ mining::MiningCache,
+ world::{is_block_state_passable, CachedWorld},
+};
+use crate::{auto_tool::best_tool_in_hotbar_for_block, JumpEvent, LookAtEvent};
+
type Edge = astar::Edge<BlockPos, MoveData>;
pub type SuccessorsFn = fn(&mut PathfinderCtx, BlockPos);
diff --git a/azalea/src/pathfinder/moves/parkour.rs b/azalea/src/pathfinder/moves/parkour.rs
index 66f02197..0f279dca 100644
--- a/azalea/src/pathfinder/moves/parkour.rs
+++ b/azalea/src/pathfinder/moves/parkour.rs
@@ -1,9 +1,8 @@
use azalea_client::{SprintDirection, WalkDirection};
use azalea_core::{direction::CardinalDirection, position::BlockPos};
-use crate::pathfinder::{astar, costs::*};
-
use super::{Edge, ExecuteCtx, IsReachedCtx, MoveData, PathfinderCtx};
+use crate::pathfinder::{astar, costs::*};
pub fn parkour_move(ctx: &mut PathfinderCtx, node: BlockPos) {
parkour_forward_1_move(ctx, node);
diff --git a/azalea/src/pathfinder/world.rs b/azalea/src/pathfinder/world.rs
index 2d859026..3a004f65 100644
--- a/azalea/src/pathfinder/world.rs
+++ b/azalea/src/pathfinder/world.rs
@@ -490,9 +490,10 @@ pub fn is_block_state_solid(block: BlockState) -> bool {
#[cfg(test)]
mod tests {
- use super::*;
use azalea_world::{Chunk, ChunkStorage, PartialInstance};
+ use super::*;
+
#[test]
fn test_is_passable() {
let mut partial_world = PartialInstance::default();
diff --git a/azalea/src/prelude.rs b/azalea/src/prelude.rs
index b4d66aaf..d1442b10 100644
--- a/azalea/src/prelude.rs
+++ b/azalea/src/prelude.rs
@@ -1,12 +1,13 @@
//! The Azalea prelude. Things that are necessary for a bare-bones bot are
//! re-exported here.
-pub use crate::{
- bot::BotClientExt, container::ContainerClientExt, pathfinder::PathfinderClientExt,
- ClientBuilder,
-};
pub use azalea_client::{Account, Client, Event};
+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, system::Resource};
-pub use azalea_core::tick::GameTick;
+pub use crate::{
+ bot::BotClientExt, container::ContainerClientExt, pathfinder::PathfinderClientExt,
+ ClientBuilder,
+};
diff --git a/azalea/src/swarm/chat.rs b/azalea/src/swarm/chat.rs
index 7425293b..cf01c60b 100644
--- a/azalea/src/swarm/chat.rs
+++ b/azalea/src/swarm/chat.rs
@@ -13,18 +13,19 @@
// in Swarm that's set to the smallest index of all the bots, and we remove all
// messages from the queue that are before that index.
+use std::collections::VecDeque;
+
+use azalea_client::chat::{ChatPacket, ChatReceivedEvent};
+use bevy_app::{App, Plugin, Update};
+use bevy_ecs::prelude::Event;
+
+use super::{Swarm, SwarmEvent};
use crate::ecs::{
component::Component,
event::{EventReader, EventWriter},
schedule::IntoSystemConfigs,
system::{Commands, Query, Res, ResMut, Resource},
};
-use azalea_client::chat::{ChatPacket, ChatReceivedEvent};
-use bevy_app::{App, Plugin, Update};
-use bevy_ecs::prelude::Event;
-use std::collections::VecDeque;
-
-use super::{Swarm, SwarmEvent};
#[derive(Clone)]
pub struct SwarmChatPlugin;
diff --git a/azalea/src/swarm/mod.rs b/azalea/src/swarm/mod.rs
index 451d887c..8c2d23f6 100644
--- a/azalea/src/swarm/mod.rs
+++ b/azalea/src/swarm/mod.rs
@@ -4,6 +4,8 @@ mod chat;
mod events;
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,
@@ -14,7 +16,6 @@ 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 parking_lot::{Mutex, RwLock};
-use std::{collections::HashMap, future::Future, net::SocketAddr, sync::Arc, time::Duration};
use tokio::sync::mpsc;
use tracing::error;
diff --git a/rustfmt.toml b/rustfmt.toml
index b2715b26..35672d06 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -1 +1,2 @@
wrap_comments = true
+group_imports = "StdExternalCrate"