1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 23:44:38 +00:00

formatting: merge imports

This commit is contained in:
mat 2025-05-30 14:44:48 -13:00
commit e37524899e
27 changed files with 222 additions and 190 deletions

View file

@ -1,13 +1,17 @@
//! Cache auth information //! Cache auth information
use std::io; use std::{
use std::path::Path; io,
use std::time::{SystemTime, UNIX_EPOCH}; path::Path,
time::{SystemTime, UNIX_EPOCH},
};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use thiserror::Error; use thiserror::Error;
use tokio::fs::{self, File}; use tokio::{
use tokio::io::{AsyncReadExt, AsyncWriteExt}; fs::{self, File},
io::{AsyncReadExt, AsyncWriteExt},
};
use tracing::{debug, trace}; use tracing::{debug, trace};
#[derive(Debug, Error)] #[derive(Debug, Error)]

View file

@ -2,8 +2,7 @@
mod utils; mod utils;
use std::collections::HashMap; use std::{collections::HashMap, fmt::Write};
use std::fmt::Write;
use proc_macro::TokenStream; use proc_macro::TokenStream;
use proc_macro2::TokenTree; use proc_macro2::TokenTree;

View file

@ -2,8 +2,10 @@
use std::sync::Arc; use std::sync::Arc;
use azalea_auth::AccessTokenResponse; use azalea_auth::{
use azalea_auth::certs::{Certificates, FetchCertificatesError}; AccessTokenResponse,
certs::{Certificates, FetchCertificatesError},
};
use bevy_ecs::component::Component; use bevy_ecs::component::Component;
use parking_lot::Mutex; use parking_lot::Mutex;
use thiserror::Error; use thiserror::Error;

View file

@ -3,8 +3,7 @@ use std::{any, sync::Arc};
use bevy_ecs::{ use bevy_ecs::{
component::Component, component::Component,
entity::Entity, entity::Entity,
query::QueryData, query::{QueryData, QueryFilter, ROQueryItem},
query::{QueryFilter, ROQueryItem},
world::World, world::World,
}; };
use parking_lot::Mutex; use parking_lot::Mutex;

View file

@ -1,15 +1,15 @@
use std::backtrace::Backtrace; use std::{backtrace::Backtrace, io};
use std::io;
use azalea_core::position::Vec3; use azalea_core::{position::Vec3, tick::GameTick};
use azalea_core::tick::GameTick; use azalea_entity::{
use azalea_entity::{Attributes, Jumping, metadata::Sprinting}; Attributes, InLoadedChunk, Jumping, LastSentPosition, LookDirection, Physics, Position,
use azalea_entity::{InLoadedChunk, LastSentPosition, LookDirection, Physics, Position}; metadata::Sprinting,
};
use azalea_physics::{PhysicsSet, ai_step}; use azalea_physics::{PhysicsSet, ai_step};
use azalea_protocol::packets::game::{ServerboundPlayerCommand, ServerboundPlayerInput};
use azalea_protocol::packets::{ use azalea_protocol::packets::{
Packet, Packet,
game::{ game::{
ServerboundPlayerCommand, ServerboundPlayerInput,
s_move_player_pos::ServerboundMovePlayerPos, s_move_player_pos::ServerboundMovePlayerPos,
s_move_player_pos_rot::ServerboundMovePlayerPosRot, s_move_player_pos_rot::ServerboundMovePlayerPosRot,
s_move_player_rot::ServerboundMovePlayerRot, s_move_player_rot::ServerboundMovePlayerRot,
@ -21,8 +21,7 @@ use bevy_app::{App, Plugin, Update};
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use thiserror::Error; use thiserror::Error;
use crate::client::Client; use crate::{client::Client, packet::game::SendPacketEvent};
use crate::packet::game::SendPacketEvent;
#[derive(Error, Debug)] #[derive(Error, Debug)]
pub enum MovePlayerError { pub enum MovePlayerError {

View file

@ -3,21 +3,23 @@ mod events;
use std::io::Cursor; use std::io::Cursor;
use azalea_entity::LocalEntity; use azalea_entity::LocalEntity;
use azalea_protocol::packets::ConnectionProtocol; use azalea_protocol::{
use azalea_protocol::packets::config::*; packets::{ConnectionProtocol, config::*},
use azalea_protocol::read::ReadPacketError; read::{ReadPacketError, deserialize_packet},
use azalea_protocol::read::deserialize_packet; };
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
pub use events::*; pub use events::*;
use tracing::{debug, warn}; use tracing::{debug, warn};
use super::as_system; use super::as_system;
use crate::client::InConfigState; use crate::{
use crate::connection::RawConnection; InstanceHolder,
use crate::disconnect::DisconnectEvent; client::InConfigState,
use crate::packet::game::KeepAliveEvent; connection::RawConnection,
use crate::packet::game::ResourcePackEvent; declare_packet_handlers,
use crate::{InstanceHolder, declare_packet_handlers}; disconnect::DisconnectEvent,
packet::game::{KeepAliveEvent, ResourcePackEvent},
};
pub fn process_raw_packet( pub fn process_raw_packet(
ecs: &mut World, ecs: &mut World,

View file

@ -2,34 +2,38 @@ use std::{fmt::Debug, sync::Arc};
use azalea_auth::game_profile::GameProfile; use azalea_auth::game_profile::GameProfile;
use azalea_buf::AzaleaWrite; use azalea_buf::AzaleaWrite;
use azalea_core::delta::PositionDelta8; use azalea_core::{
use azalea_core::game_type::{GameMode, OptionalGameType}; delta::PositionDelta8,
use azalea_core::position::{ChunkPos, Vec3}; game_type::{GameMode, OptionalGameType},
use azalea_core::resource_location::ResourceLocation; position::{ChunkPos, Vec3},
use azalea_core::tick::GameTick; resource_location::ResourceLocation,
use azalea_entity::metadata::PlayerMetadataBundle; tick::GameTick,
use azalea_protocol::packets::common::CommonPlayerSpawnInfo; };
use azalea_protocol::packets::config::{ClientboundFinishConfiguration, ClientboundRegistryData}; use azalea_entity::metadata::PlayerMetadataBundle;
use azalea_protocol::packets::game::c_level_chunk_with_light::ClientboundLevelChunkPacketData; use azalea_protocol::packets::{
use azalea_protocol::packets::game::c_light_update::ClientboundLightUpdatePacketData; ConnectionProtocol, Packet, ProtocolPacket,
use azalea_protocol::packets::game::{ common::CommonPlayerSpawnInfo,
ClientboundAddEntity, ClientboundLevelChunkWithLight, ClientboundLogin, ClientboundRespawn, config::{ClientboundFinishConfiguration, ClientboundRegistryData},
game::{
ClientboundAddEntity, ClientboundLevelChunkWithLight, ClientboundLogin, ClientboundRespawn,
c_level_chunk_with_light::ClientboundLevelChunkPacketData,
c_light_update::ClientboundLightUpdatePacketData,
},
}; };
use azalea_protocol::packets::{ConnectionProtocol, Packet, ProtocolPacket};
use azalea_registry::{DimensionType, EntityKind}; use azalea_registry::{DimensionType, EntityKind};
use azalea_world::palette::{PalettedContainer, PalettedContainerKind}; use azalea_world::{
use azalea_world::{Chunk, Instance, MinecraftEntityId, Section}; Chunk, Instance, MinecraftEntityId, Section,
palette::{PalettedContainer, PalettedContainerKind},
};
use bevy_app::App; use bevy_app::App;
use bevy_ecs::component::Mutable; use bevy_ecs::{component::Mutable, prelude::*, schedule::ExecutorKind};
use bevy_ecs::{prelude::*, schedule::ExecutorKind};
use parking_lot::RwLock; use parking_lot::RwLock;
use simdnbt::owned::{NbtCompound, NbtTag}; use simdnbt::owned::{NbtCompound, NbtTag};
use uuid::Uuid; use uuid::Uuid;
use crate::connection::RawConnection;
use crate::disconnect::DisconnectEvent;
use crate::{ use crate::{
ClientInformation, GameProfileComponent, InConfigState, InstanceHolder, LocalPlayerBundle, ClientInformation, GameProfileComponent, InConfigState, InstanceHolder, LocalPlayerBundle,
connection::RawConnection, disconnect::DisconnectEvent,
}; };
/// A way to simulate a client in a server, used for some internal tests. /// A way to simulate a client in a server, used for some internal tests.

View file

@ -3,21 +3,18 @@
//! The most common ones are [`Vec3`] and [`BlockPos`], which are usually used //! The most common ones are [`Vec3`] and [`BlockPos`], which are usually used
//! for entity positions and block positions, respectively. //! for entity positions and block positions, respectively.
use std::hash::Hasher;
use std::io;
use std::str::FromStr;
use std::{ use std::{
fmt, fmt,
hash::Hash, hash::{Hash, Hasher},
io,
io::{Cursor, Write}, io::{Cursor, Write},
ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Rem, Sub}, ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Rem, Sub},
str::FromStr,
}; };
use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError}; use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError};
use crate::direction::Direction; use crate::{direction::Direction, math, resource_location::ResourceLocation};
use crate::math;
use crate::resource_location::ResourceLocation;
macro_rules! vec3_impl { macro_rules! vec3_impl {
($name:ident, $type:ty) => { ($name:ident, $type:ty) => {

View file

@ -2,10 +2,9 @@
mod signing; mod signing;
use aes::cipher::inout::InOutBuf;
use aes::{ use aes::{
Aes128, Aes128,
cipher::{BlockDecryptMut, BlockEncryptMut, KeyIvInit}, cipher::{BlockDecryptMut, BlockEncryptMut, KeyIvInit, inout::InOutBuf},
}; };
use rand::{RngCore, rngs::OsRng}; use rand::{RngCore, rngs::OsRng};
use sha1::{Digest, Sha1}; use sha1::{Digest, Sha1};

View file

@ -25,8 +25,7 @@ use tokio::{
io::{self, AsyncWriteExt}, io::{self, AsyncWriteExt},
net::{TcpListener, TcpStream}, net::{TcpListener, TcpStream},
}; };
use tracing::Level; use tracing::{Level, error, info, warn};
use tracing::{error, info, warn};
const LISTEN_ADDR: &str = "127.0.0.1:25566"; const LISTEN_ADDR: &str = "127.0.0.1:25566";
const PROXY_ADDR: &str = "127.0.0.1:25565"; const PROXY_ADDR: &str = "127.0.0.1:25565";

View file

@ -1,29 +1,40 @@
//! Connect to remote servers/clients. //! Connect to remote servers/clients.
use std::fmt::{self, Debug, Display}; use std::{
use std::io::{self, Cursor}; fmt::{self, Debug, Display},
use std::marker::PhantomData; io::{self, Cursor},
use std::net::SocketAddr; marker::PhantomData,
net::SocketAddr,
};
use azalea_auth::game_profile::GameProfile; use azalea_auth::{
use azalea_auth::sessionserver::{ClientSessionServerError, ServerSessionServerError}; game_profile::GameProfile,
sessionserver::{ClientSessionServerError, ServerSessionServerError},
};
use azalea_crypto::{Aes128CfbDec, Aes128CfbEnc}; use azalea_crypto::{Aes128CfbDec, Aes128CfbEnc};
use thiserror::Error; use thiserror::Error;
use tokio::io::{AsyncWriteExt, BufStream}; use tokio::{
use tokio::net::TcpStream; io::{AsyncWriteExt, BufStream},
use tokio::net::tcp::{OwnedReadHalf, OwnedWriteHalf, ReuniteError}; net::{
TcpStream,
tcp::{OwnedReadHalf, OwnedWriteHalf, ReuniteError},
},
};
use tracing::{error, info}; use tracing::{error, info};
use uuid::Uuid; use uuid::Uuid;
use crate::packets::ProtocolPacket; use crate::{
use crate::packets::config::{ClientboundConfigPacket, ServerboundConfigPacket}; packets::{
use crate::packets::game::{ClientboundGamePacket, ServerboundGamePacket}; ProtocolPacket,
use crate::packets::handshake::{ClientboundHandshakePacket, ServerboundHandshakePacket}; config::{ClientboundConfigPacket, ServerboundConfigPacket},
use crate::packets::login::c_hello::ClientboundHello; game::{ClientboundGamePacket, ServerboundGamePacket},
use crate::packets::login::{ClientboundLoginPacket, ServerboundLoginPacket}; handshake::{ClientboundHandshakePacket, ServerboundHandshakePacket},
use crate::packets::status::{ClientboundStatusPacket, ServerboundStatusPacket}; login::{ClientboundLoginPacket, ServerboundLoginPacket, c_hello::ClientboundHello},
use crate::read::{ReadPacketError, deserialize_packet, read_raw_packet, try_read_raw_packet}; status::{ClientboundStatusPacket, ServerboundStatusPacket},
use crate::write::{serialize_packet, write_raw_packet}; },
read::{ReadPacketError, deserialize_packet, read_raw_packet, try_read_raw_packet},
write::{serialize_packet, write_raw_packet},
};
pub struct RawReadConnection { pub struct RawReadConnection {
pub read_stream: OwnedReadHalf, pub read_stream: OwnedReadHalf,

View file

@ -1,23 +1,25 @@
//! Read packets from a stream. //! Read packets from a stream.
use std::backtrace::Backtrace;
use std::sync::LazyLock;
use std::{env, io};
use std::{ use std::{
backtrace::Backtrace,
env,
fmt::Debug, fmt::Debug,
io,
io::{Cursor, Read}, io::{Cursor, Read},
sync::LazyLock,
}; };
use azalea_buf::AzaleaReadVar; use azalea_buf::{AzaleaReadVar, BufReadError};
use azalea_buf::BufReadError;
use azalea_crypto::Aes128CfbDec; use azalea_crypto::Aes128CfbDec;
use flate2::read::ZlibDecoder; use flate2::read::ZlibDecoder;
use futures::StreamExt; use futures::StreamExt;
use futures_lite::future; use futures_lite::future;
use thiserror::Error; use thiserror::Error;
use tokio::io::AsyncRead; use tokio::io::AsyncRead;
use tokio_util::bytes::Buf; use tokio_util::{
use tokio_util::codec::{BytesCodec, FramedRead}; bytes::Buf,
codec::{BytesCodec, FramedRead},
};
use tracing::trace; use tracing::trace;
use crate::packets::ProtocolPacket; use crate::packets::ProtocolPacket;

View file

@ -9,8 +9,10 @@ mod data;
mod extra; mod extra;
pub mod tags; pub mod tags;
use std::fmt::{self, Debug}; use std::{
use std::io::{self, Cursor, Write}; fmt::{self, Debug},
io::{self, Cursor, Write},
};
use azalea_buf::{AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; use azalea_buf::{AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError};
use azalea_registry_macros::registry; use azalea_registry_macros::registry;

View file

@ -1,24 +1,26 @@
use std::collections::hash_map::Entry;
use std::{ use std::{
collections::HashMap, collections::{HashMap, hash_map::Entry},
fmt,
fmt::Debug, fmt::Debug,
io,
io::{Cursor, Write}, io::{Cursor, Write},
sync::{Arc, Weak}, sync::{Arc, Weak},
}; };
use std::{fmt, io};
use azalea_block::block_state::{BlockState, BlockStateIntegerRepr}; use azalea_block::{
use azalea_block::fluid_state::FluidState; block_state::{BlockState, BlockStateIntegerRepr},
fluid_state::FluidState,
};
use azalea_buf::{AzaleaRead, AzaleaWrite, BufReadError}; use azalea_buf::{AzaleaRead, AzaleaWrite, BufReadError};
use azalea_core::position::{BlockPos, ChunkBlockPos, ChunkPos, ChunkSectionBlockPos}; use azalea_core::position::{BlockPos, ChunkBlockPos, ChunkPos, ChunkSectionBlockPos};
use nohash_hasher::IntMap; use nohash_hasher::IntMap;
use parking_lot::RwLock; use parking_lot::RwLock;
use tracing::{debug, trace, warn}; use tracing::{debug, trace, warn};
use crate::heightmap::Heightmap; use crate::{
use crate::heightmap::HeightmapKind; heightmap::{Heightmap, HeightmapKind},
use crate::palette::PalettedContainer; palette::{PalettedContainer, PalettedContainerKind},
use crate::palette::PalettedContainerKind; };
const SECTION_HEIGHT: u32 = 16; const SECTION_HEIGHT: u32 = 16;

View file

@ -1,16 +1,16 @@
use std::{ use std::{
collections::{HashMap, HashSet}, collections::{HashMap, HashSet},
fmt::Debug, fmt::{self, Debug, Display},
fmt::{self, Display},
hash::{Hash, Hasher}, hash::{Hash, Hasher},
io::{self, Cursor}, io::{self, Cursor},
}; };
use azalea_block::BlockState; use azalea_block::{BlockState, fluid_state::FluidState};
use azalea_block::fluid_state::FluidState;
use azalea_buf::{AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; use azalea_buf::{AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError};
use azalea_core::position::{BlockPos, ChunkPos}; use azalea_core::{
use azalea_core::registry_holder::RegistryHolder; position::{BlockPos, ChunkPos},
registry_holder::RegistryHolder,
};
use bevy_ecs::{component::Component, entity::Entity}; use bevy_ecs::{component::Component, entity::Entity};
use derive_more::{Deref, DerefMut}; use derive_more::{Deref, DerefMut};
use nohash_hasher::IntMap; use nohash_hasher::IntMap;

View file

@ -1,5 +1,4 @@
use std::env; use std::{env, process::Command};
use std::process::Command;
fn main() { fn main() {
// If using `rustup`, check the toolchain via `RUSTUP_TOOLCHAIN` // If using `rustup`, check the toolchain via `RUSTUP_TOOLCHAIN`

View file

@ -1,10 +1,10 @@
use azalea::ClientBuilder; use azalea::{Bot, ClientBuilder, LookAtEvent, nearest_entity::EntityFinder};
use azalea::nearest_entity::EntityFinder;
use azalea::{Bot, LookAtEvent};
use azalea_client::Account; use azalea_client::Account;
use azalea_core::tick::GameTick; use azalea_core::tick::GameTick;
use azalea_entity::metadata::{ItemItem, Player}; use azalea_entity::{
use azalea_entity::{EyeHeight, LocalEntity, Position}; EyeHeight, LocalEntity, Position,
metadata::{ItemItem, Player},
};
use bevy_app::Plugin; use bevy_app::Plugin;
use bevy_ecs::{ use bevy_ecs::{
prelude::{Entity, EventWriter}, prelude::{Entity, EventWriter},

View file

@ -2,10 +2,8 @@
use std::sync::Arc; use std::sync::Arc;
use azalea::pathfinder::goals::RadiusGoal; use azalea::{BlockPos, pathfinder::goals::RadiusGoal, prelude::*};
use azalea::{BlockPos, prelude::*}; use azalea_inventory::{ItemStack, operations::QuickMoveClick};
use azalea_inventory::ItemStack;
use azalea_inventory::operations::QuickMoveClick;
use parking_lot::Mutex; use parking_lot::Mutex;
#[tokio::main] #[tokio::main]

View file

@ -2,12 +2,10 @@ pub mod combat;
pub mod debug; pub mod debug;
pub mod movement; pub mod movement;
use azalea::Client; use azalea::{
use azalea::GameProfileComponent; Client, GameProfileComponent, brigadier::prelude::*, chat::ChatPacket, ecs::prelude::*,
use azalea::brigadier::prelude::*; entity::metadata::Player,
use azalea::chat::ChatPacket; };
use azalea::ecs::prelude::*;
use azalea::entity::metadata::Player;
use parking_lot::Mutex; use parking_lot::Mutex;
use crate::State; use crate::State;

View file

@ -25,16 +25,12 @@
mod commands; mod commands;
pub mod killaura; pub mod killaura;
use std::time::Duration; use std::{env, process, sync::Arc, thread, time::Duration};
use std::{env, process};
use std::{sync::Arc, thread};
use azalea::ClientInformation; use azalea::{
use azalea::brigadier::command_dispatcher::CommandDispatcher; ClientInformation, brigadier::command_dispatcher::CommandDispatcher, ecs::prelude::*,
use azalea::ecs::prelude::*; pathfinder::debug::PathfinderDebugParticles, prelude::*, swarm::prelude::*,
use azalea::pathfinder::debug::PathfinderDebugParticles; };
use azalea::prelude::*;
use azalea::swarm::prelude::*;
use commands::{CommandSource, register_commands}; use commands::{CommandSource, register_commands};
use parking_lot::Mutex; use parking_lot::Mutex;

View file

@ -1,12 +1,18 @@
use azalea_client::InConfigState; use azalea_client::{
use azalea_client::chunks::handle_chunk_batch_finished_event; InConfigState,
use azalea_client::inventory::InventorySet; chunks::handle_chunk_batch_finished_event,
use azalea_client::packet::config::SendConfigPacketEvent; inventory::InventorySet,
use azalea_client::packet::game::SendPacketEvent; packet::{
use azalea_client::packet::{death_event_on_0_health, game::ResourcePackEvent}; config::SendConfigPacketEvent,
use azalea_client::respawn::perform_respawn; death_event_on_0_health,
use azalea_protocol::packets::config; game::{ResourcePackEvent, SendPacketEvent},
use azalea_protocol::packets::game::s_resource_pack::{self, ServerboundResourcePack}; },
respawn::perform_respawn,
};
use azalea_protocol::packets::{
config,
game::s_resource_pack::{self, ServerboundResourcePack},
};
use bevy_app::Update; use bevy_app::Update;
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;

View file

@ -1,9 +1,13 @@
use std::f64::consts::PI; use std::f64::consts::PI;
use azalea_client::mining::Mining; use azalea_client::{
use azalea_client::tick_broadcast::{TickBroadcast, UpdateBroadcast}; mining::Mining,
use azalea_core::position::{BlockPos, Vec3}; tick_broadcast::{TickBroadcast, UpdateBroadcast},
use azalea_core::tick::GameTick; };
use azalea_core::{
position::{BlockPos, Vec3},
tick::GameTick,
};
use azalea_entity::{ use azalea_entity::{
EyeHeight, Jumping, LocalEntity, LookDirection, Position, clamp_look_direction, EyeHeight, Jumping, LocalEntity, LookDirection, Position, clamp_look_direction,
metadata::Player, metadata::Player,
@ -14,18 +18,20 @@ use bevy_ecs::prelude::*;
use futures_lite::Future; use futures_lite::Future;
use tracing::trace; use tracing::trace;
use crate::accept_resource_packs::AcceptResourcePacksPlugin; use crate::{
use crate::app::{App, Plugin, PluginGroup, PluginGroupBuilder}; accept_resource_packs::AcceptResourcePacksPlugin,
use crate::auto_respawn::AutoRespawnPlugin; app::{App, Plugin, PluginGroup, PluginGroupBuilder},
use crate::container::ContainerPlugin; auto_respawn::AutoRespawnPlugin,
use crate::ecs::{ container::ContainerPlugin,
ecs::{
component::Component, component::Component,
entity::Entity, entity::Entity,
event::EventReader, event::EventReader,
query::{With, Without}, query::{With, Without},
system::{Commands, Query}, system::{Commands, Query},
},
pathfinder::PathfinderPlugin,
}; };
use crate::pathfinder::PathfinderPlugin;
#[derive(Clone, Default)] #[derive(Clone, Default)]
pub struct BotPlugin; pub struct BotPlugin;

View file

@ -1,10 +1,9 @@
use std::fmt; use std::{fmt, fmt::Debug};
use std::fmt::Debug;
use azalea_client::packet::game::ReceiveGamePacketEvent;
use azalea_client::{ use azalea_client::{
Client, Client,
inventory::{CloseContainerEvent, ContainerClickEvent, Inventory}, inventory::{CloseContainerEvent, ContainerClickEvent, Inventory},
packet::game::ReceiveGamePacketEvent,
}; };
use azalea_core::position::BlockPos; use azalea_core::position::BlockPos;
use azalea_inventory::{ItemStack, Menu, operations::ClickOperation}; use azalea_inventory::{ItemStack, Menu, operations::ClickOperation};

View file

@ -13,8 +13,7 @@ pub mod pathfinder;
pub mod prelude; pub mod prelude;
pub mod swarm; pub mod swarm;
use std::net::SocketAddr; use std::{net::SocketAddr, time::Duration};
use std::time::Duration;
use app::Plugins; use app::Plugins;
pub use azalea_auth as auth; pub use azalea_auth as auth;
@ -39,8 +38,7 @@ pub use bevy_ecs as ecs;
pub use bot::*; pub use bot::*;
use ecs::component::Component; use ecs::component::Component;
use futures::{Future, future::BoxFuture}; use futures::{Future, future::BoxFuture};
use protocol::connect::Proxy; use protocol::{ServerAddress, connect::Proxy, resolver::ResolverError};
use protocol::{ServerAddress, resolver::ResolverError};
use swarm::SwarmBuilder; use swarm::SwarmBuilder;
use thiserror::Error; use thiserror::Error;

View file

@ -12,23 +12,27 @@ pub mod rel_block_pos;
pub mod simulation; pub mod simulation;
pub mod world; pub mod world;
use std::collections::VecDeque; use std::{
use std::ops::RangeInclusive; cmp,
use std::sync::Arc; collections::VecDeque,
use std::sync::atomic::{self, AtomicUsize}; ops::RangeInclusive,
use std::time::{Duration, Instant}; sync::{
use std::{cmp, thread}; Arc,
atomic::{self, AtomicUsize},
},
thread,
time::{Duration, Instant},
};
use astar::{Edge, PathfinderTimeout}; use astar::{Edge, PathfinderTimeout};
use azalea_client::inventory::{Inventory, InventorySet, SetSelectedHotbarSlotEvent}; use azalea_client::{
use azalea_client::mining::{Mining, StartMiningBlockEvent}; InstanceHolder, StartSprintEvent, StartWalkEvent,
use azalea_client::movement::MoveEventsSet; inventory::{Inventory, InventorySet, SetSelectedHotbarSlotEvent},
use azalea_client::{InstanceHolder, StartSprintEvent, StartWalkEvent}; mining::{Mining, StartMiningBlockEvent},
use azalea_core::position::BlockPos; movement::MoveEventsSet,
use azalea_core::tick::GameTick; };
use azalea_entity::LocalEntity; use azalea_core::{position::BlockPos, tick::GameTick};
use azalea_entity::metadata::Player; use azalea_entity::{LocalEntity, Physics, Position, metadata::Player};
use azalea_entity::{Physics, Position};
use azalea_physics::PhysicsSet; use azalea_physics::PhysicsSet;
use azalea_world::{InstanceContainer, InstanceName}; use azalea_world::{InstanceContainer, InstanceName};
use bevy_app::{PreUpdate, Update}; use bevy_app::{PreUpdate, Update};
@ -41,21 +45,25 @@ use rel_block_pos::RelBlockPos;
use tokio::sync::broadcast::error::RecvError; use tokio::sync::broadcast::error::RecvError;
use tracing::{debug, error, info, trace, warn}; use tracing::{debug, error, info, trace, warn};
use self::debug::debug_render_path_with_particles; use self::{
use self::goals::Goal; debug::debug_render_path_with_particles,
use self::mining::MiningCache; goals::Goal,
use self::moves::{ExecuteCtx, IsReachedCtx, SuccessorsFn}; mining::MiningCache,
use crate::app::{App, Plugin}; moves::{ExecuteCtx, IsReachedCtx, SuccessorsFn},
use crate::bot::{JumpEvent, LookAtEvent}; };
use crate::ecs::{ use crate::{
BotClientExt, WalkDirection,
app::{App, Plugin},
bot::{JumpEvent, LookAtEvent},
ecs::{
component::Component, component::Component,
entity::Entity, entity::Entity,
event::{EventReader, EventWriter}, event::{EventReader, EventWriter},
query::{With, Without}, query::{With, Without},
system::{Commands, Query, Res}, system::{Commands, Query, Res},
},
pathfinder::{astar::a_star, moves::PathfinderCtx, world::CachedWorld},
}; };
use crate::pathfinder::{astar::a_star, moves::PathfinderCtx, world::CachedWorld};
use crate::{BotClientExt, WalkDirection};
#[derive(Clone, Default)] #[derive(Clone, Default)]
pub struct PathfinderPlugin; pub struct PathfinderPlugin;

View file

@ -6,8 +6,10 @@ pub use azalea_core::tick::GameTick;
// this is necessary to make the macros that reference bevy_ecs work // this is necessary to make the macros that reference bevy_ecs work
pub use crate::ecs as bevy_ecs; pub use crate::ecs as bevy_ecs;
pub use crate::ecs::{component::Component, resource::Resource};
pub use crate::{ pub use crate::{
ClientBuilder, bot::BotClientExt, container::ContainerClientExt, ClientBuilder,
bot::BotClientExt,
container::ContainerClientExt,
ecs::{component::Component, resource::Resource},
pathfinder::PathfinderClientExt, pathfinder::PathfinderClientExt,
}; };

View file

@ -1,2 +1,3 @@
wrap_comments = true wrap_comments = true
group_imports = "StdExternalCrate" group_imports = "StdExternalCrate"
imports_granularity = "Crate"