From a4312599f7c04709a92b7be238dcf577bafbb14f Mon Sep 17 00:00:00 2001 From: mat Date: Wed, 12 Nov 2025 04:26:02 +0330 Subject: cleanup - remove deprecated code - add `[lints] workspace=true` to every Cargo.toml, to make modifying clippy lints easier for later - remove some unnecessary #[allow]s - use Vec3i in some parts of the collision code --- Cargo.toml | 2 + azalea-auth/Cargo.toml | 3 + azalea-auth/src/auth.rs | 4 - azalea-block/Cargo.toml | 3 + azalea-block/azalea-block-macros/Cargo.toml | 3 + azalea-brigadier/Cargo.toml | 3 + azalea-brigadier/src/tree/mod.rs | 4 +- azalea-buf/Cargo.toml | 3 + azalea-buf/azalea-buf-macros/Cargo.toml | 3 + azalea-chat/Cargo.toml | 3 + azalea-client/Cargo.toml | 3 + azalea-core/Cargo.toml | 3 + azalea-core/src/delta.rs | 11 -- azalea-core/src/direction.rs | 10 +- azalea-core/src/position.rs | 16 ++- azalea-crypto/Cargo.toml | 3 + azalea-entity/Cargo.toml | 3 + azalea-inventory/Cargo.toml | 3 + .../azalea-inventory-macros/Cargo.toml | 3 + azalea-language/Cargo.toml | 3 + azalea-physics/Cargo.toml | 3 + .../src/collision/discrete_voxel_shape.rs | 137 ++++++++++----------- azalea-physics/src/collision/mod.rs | 1 - azalea-physics/src/collision/shape.rs | 36 +++--- azalea-protocol/Cargo.toml | 3 + azalea-protocol/azalea-protocol-macros/Cargo.toml | 3 + azalea-registry/Cargo.toml | 3 + azalea-world/Cargo.toml | 3 + azalea/Cargo.toml | 3 + azalea/src/swarm/mod.rs | 48 +------- 30 files changed, 165 insertions(+), 164 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 958c471e..e39de075 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -107,6 +107,8 @@ azalea-registry-macros = { path = "azalea-registry/azalea-registry-macros", vers azalea-registry = { path = "azalea-registry", version = "0.14.0" } azalea-world = { path = "azalea-world", version = "0.14.0" } +[workspace.lints.clippy] + # --- Profile Settings --- [profile.release] diff --git a/azalea-auth/Cargo.toml b/azalea-auth/Cargo.toml index db6837df..c33945df 100644 --- a/azalea-auth/Cargo.toml +++ b/azalea-auth/Cargo.toml @@ -31,3 +31,6 @@ uuid = { workspace = true, features = ["serde", "v3"] } [dev-dependencies] env_logger.workspace = true tokio = { workspace = true, features = ["full"] } + +[lints] +workspace = true diff --git a/azalea-auth/src/auth.rs b/azalea-auth/src/auth.rs index f299ba74..a4176d6c 100644 --- a/azalea-auth/src/auth.rs +++ b/azalea-auth/src/auth.rs @@ -224,7 +224,6 @@ pub struct DeviceCodeResponse { pub interval: u64, } -#[allow(unused)] #[derive(Debug, Deserialize, Serialize, Clone)] pub struct AccessTokenResponse { pub token_type: String, @@ -235,7 +234,6 @@ pub struct AccessTokenResponse { pub user_id: String, } -#[allow(unused)] #[derive(Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct XboxLiveAuthResponse { @@ -252,7 +250,6 @@ pub struct XboxLiveAuth { pub user_hash: String, } -#[allow(unused)] #[derive(Debug, Deserialize, Serialize)] pub struct MinecraftAuthResponse { pub username: String, @@ -270,7 +267,6 @@ pub struct GameOwnershipResponse { pub key_id: String, } -#[allow(unused)] #[derive(Debug, Deserialize)] pub struct GameOwnershipItem { pub name: String, diff --git a/azalea-block/Cargo.toml b/azalea-block/Cargo.toml index a4800bbf..0175264b 100644 --- a/azalea-block/Cargo.toml +++ b/azalea-block/Cargo.toml @@ -10,3 +10,6 @@ repository.workspace = true azalea-block-macros.workspace = true azalea-buf.workspace = true azalea-registry.workspace = true + +[lints] +workspace = true diff --git a/azalea-block/azalea-block-macros/Cargo.toml b/azalea-block/azalea-block-macros/Cargo.toml index bf268eb6..8b8d552c 100644 --- a/azalea-block/azalea-block-macros/Cargo.toml +++ b/azalea-block/azalea-block-macros/Cargo.toml @@ -13,3 +13,6 @@ proc-macro = true proc-macro2.workspace = true quote.workspace = true syn.workspace = true + +[lints] +workspace = true diff --git a/azalea-brigadier/Cargo.toml b/azalea-brigadier/Cargo.toml index 3016af79..6a7c9d4f 100644 --- a/azalea-brigadier/Cargo.toml +++ b/azalea-brigadier/Cargo.toml @@ -17,3 +17,6 @@ parking_lot.workspace = true [features] azalea-buf = ["dep:azalea-buf", "dep:azalea-chat", "azalea-chat/azalea-buf"] + +[lints] +workspace = true diff --git a/azalea-brigadier/src/tree/mod.rs b/azalea-brigadier/src/tree/mod.rs index 12a5a50c..a8c12117 100644 --- a/azalea-brigadier/src/tree/mod.rs +++ b/azalea-brigadier/src/tree/mod.rs @@ -305,9 +305,7 @@ impl PartialEq for CommandNode { Some(selfexecutes) => { // idk how to do this better since we can't compare `dyn Fn`s match &other.command { - Some(otherexecutes) => - { - #[allow(ambiguous_wide_pointer_comparisons)] + Some(otherexecutes) => { if !Arc::ptr_eq(selfexecutes, otherexecutes) { return false; } diff --git a/azalea-buf/Cargo.toml b/azalea-buf/Cargo.toml index 2e0a7a59..9706c1c5 100644 --- a/azalea-buf/Cargo.toml +++ b/azalea-buf/Cargo.toml @@ -18,3 +18,6 @@ uuid.workspace = true [features] serde_json = ["dep:serde_json"] + +[lints] +workspace = true diff --git a/azalea-buf/azalea-buf-macros/Cargo.toml b/azalea-buf/azalea-buf-macros/Cargo.toml index 2ed935c4..f4b15e9d 100644 --- a/azalea-buf/azalea-buf-macros/Cargo.toml +++ b/azalea-buf/azalea-buf-macros/Cargo.toml @@ -13,3 +13,6 @@ proc-macro = true proc-macro2.workspace = true quote.workspace = true syn = { workspace = true, features = ["extra-traits"] } + +[lints] +workspace = true diff --git a/azalea-chat/Cargo.toml b/azalea-chat/Cargo.toml index 69d1acf0..184593d3 100644 --- a/azalea-chat/Cargo.toml +++ b/azalea-chat/Cargo.toml @@ -20,3 +20,6 @@ serde = { workspace = true, features = ["derive"] } serde_json.workspace = true simdnbt = { workspace = true, optional = true } tracing.workspace = true + +[lints] +workspace = true diff --git a/azalea-client/Cargo.toml b/azalea-client/Cargo.toml index 5512fb60..1dba73c1 100644 --- a/azalea-client/Cargo.toml +++ b/azalea-client/Cargo.toml @@ -47,3 +47,6 @@ default = ["log", "packet-event"] # enables bevy_log::LogPlugin by default log = ["bevy_log"] packet-event = [] + +[lints] +workspace = true diff --git a/azalea-core/Cargo.toml b/azalea-core/Cargo.toml index d36ac038..fa299cc7 100644 --- a/azalea-core/Cargo.toml +++ b/azalea-core/Cargo.toml @@ -24,3 +24,6 @@ uuid.workspace = true [features] bevy_ecs = ["dep:bevy_ecs"] strict_registry = [] + +[lints] +workspace = true diff --git a/azalea-core/src/delta.rs b/azalea-core/src/delta.rs index 50fdeafa..c193649a 100644 --- a/azalea-core/src/delta.rs +++ b/azalea-core/src/delta.rs @@ -19,17 +19,6 @@ pub struct PositionDelta8 { pub za: i16, } -impl PositionDelta8 { - #[deprecated = "Use Self::x, y, z instead"] - pub fn float(&self) -> (f64, f64, f64) { - ( - (self.xa as f64) / 4096.0, - (self.ya as f64) / 4096.0, - (self.za as f64) / 4096.0, - ) - } -} - impl PositionDeltaTrait for PositionDelta8 { fn x(&self) -> f64 { (self.xa as f64) / 4096.0 diff --git a/azalea-core/src/direction.rs b/azalea-core/src/direction.rs index c794c79a..fbd7f98b 100644 --- a/azalea-core/src/direction.rs +++ b/azalea-core/src/direction.rs @@ -1,6 +1,6 @@ use azalea_buf::AzBuf; -use crate::position::{BlockPos, Vec3}; +use crate::position::{BlockPos, Vec3, Vec3i}; #[derive( Clone, Copy, Debug, AzBuf, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize, @@ -220,11 +220,11 @@ impl AxisCycle { Self::Backward => Axis::from_ordinal(i32::rem_euclid(axis as i32 - 1, 3) as u32), } } - pub fn cycle_xyz(self, x: i32, y: i32, z: i32, axis: Axis) -> i32 { + pub fn cycle_xyz(self, pos: Vec3i, axis: Axis) -> i32 { match self { - Self::None => axis.choose(x, y, z), - Self::Forward => axis.choose(z, x, y), - Self::Backward => axis.choose(y, z, x), + Self::None => axis.choose(pos.x, pos.y, pos.z), + Self::Forward => axis.choose(pos.z, pos.x, pos.y), + Self::Backward => axis.choose(pos.y, pos.z, pos.x), } } } diff --git a/azalea-core/src/position.rs b/azalea-core/src/position.rs index 7feb24d2..1686a7ad 100644 --- a/azalea-core/src/position.rs +++ b/azalea-core/src/position.rs @@ -23,6 +23,13 @@ use crate::{ macro_rules! vec3_impl { ($name:ident, $type:ty) => { impl $name { + /// The position where x, y, and z are all 0. + pub const ZERO: Self = Self { + x: 0 as $type, + y: 0 as $type, + z: 0 as $type, + }; + #[inline] pub const fn new(x: $type, y: $type, z: $type) -> Self { Self { x, y, z } @@ -308,8 +315,6 @@ pub struct Vec3 { vec3_impl!(Vec3, f64); impl Vec3 { - pub const ZERO: Vec3 = Vec3::new(0.0, 0.0, 0.0); - /// Get the distance of this vector to the origin by doing /// `sqrt(x^2 + y^2 + z^2)`. pub fn length(&self) -> f64 { @@ -472,8 +477,10 @@ impl<'de> serde::Deserialize<'de> for BlockPos { } } -/// Similar to [`BlockPos`] but it's serialized as 3 varints instead of one -/// 64-bit integer, so it can represent a bigger range of numbers. +/// An arbitrary position that's represented as 32-bit integers. +/// +/// This is similar to [`BlockPos`], but isn't limited to representing block +/// positions and can represent a larger range of numbers. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, AzBuf)] pub struct Vec3i { #[var] @@ -483,6 +490,7 @@ pub struct Vec3i { #[var] pub z: i32, } +vec3_impl!(Vec3i, i32); /// Chunk coordinates are used to represent where a chunk is in the world. /// diff --git a/azalea-crypto/Cargo.toml b/azalea-crypto/Cargo.toml index 13a5a13b..a6f12ad3 100644 --- a/azalea-crypto/Cargo.toml +++ b/azalea-crypto/Cargo.toml @@ -24,3 +24,6 @@ uuid.workspace = true [[bench]] harness = false name = "my_benchmark" + +[lints] +workspace = true diff --git a/azalea-entity/Cargo.toml b/azalea-entity/Cargo.toml index 3270598a..54960fa0 100644 --- a/azalea-entity/Cargo.toml +++ b/azalea-entity/Cargo.toml @@ -25,3 +25,6 @@ simdnbt.workspace = true thiserror.workspace = true tracing.workspace = true uuid.workspace = true + +[lints] +workspace = true diff --git a/azalea-inventory/Cargo.toml b/azalea-inventory/Cargo.toml index 8fb1d625..c5c5e314 100644 --- a/azalea-inventory/Cargo.toml +++ b/azalea-inventory/Cargo.toml @@ -18,3 +18,6 @@ serde.workspace = true simdnbt.workspace = true tracing.workspace = true uuid.workspace = true + +[lints] +workspace = true diff --git a/azalea-inventory/azalea-inventory-macros/Cargo.toml b/azalea-inventory/azalea-inventory-macros/Cargo.toml index 97d61dd8..415c99a3 100644 --- a/azalea-inventory/azalea-inventory-macros/Cargo.toml +++ b/azalea-inventory/azalea-inventory-macros/Cargo.toml @@ -13,3 +13,6 @@ proc-macro = true proc-macro2.workspace = true quote.workspace = true syn.workspace = true + +[lints] +workspace = true diff --git a/azalea-language/Cargo.toml b/azalea-language/Cargo.toml index fa7f3f97..6d927fda 100644 --- a/azalea-language/Cargo.toml +++ b/azalea-language/Cargo.toml @@ -9,3 +9,6 @@ repository.workspace = true [dependencies] compact_str = { workspace = true, features = ["serde"] } serde_json.workspace = true + +[lints] +workspace = true diff --git a/azalea-physics/Cargo.toml b/azalea-physics/Cargo.toml index dd2b4a68..68c3fbe8 100644 --- a/azalea-physics/Cargo.toml +++ b/azalea-physics/Cargo.toml @@ -20,3 +20,6 @@ bevy_app.workspace = true bevy_ecs.workspace = true tracing.workspace = true parking_lot.workspace = true + +[lints] +workspace = true diff --git a/azalea-physics/src/collision/discrete_voxel_shape.rs b/azalea-physics/src/collision/discrete_voxel_shape.rs index 033d1225..1d8de4db 100644 --- a/azalea-physics/src/collision/discrete_voxel_shape.rs +++ b/azalea-physics/src/collision/discrete_voxel_shape.rs @@ -3,6 +3,7 @@ use std::cmp; use azalea_core::{ bitset::BitSet, direction::{Axis, AxisCycle}, + position::Vec3i, }; use super::mergers::IndexMerger; @@ -47,22 +48,22 @@ impl DiscreteVoxelShape { false } - pub fn is_full_wide(&self, x: i32, y: i32, z: i32) -> bool { - if x < 0 || y < 0 || z < 0 { + pub fn is_full_wide(&self, pos: Vec3i) -> bool { + if pos.x < 0 || pos.y < 0 || pos.z < 0 { return false; } - let (x, y, z) = (x as u32, y as u32, z as u32); + let (x, y, z) = (pos.x as u32, pos.y as u32, pos.z as u32); (x < self.size(Axis::X) && y < self.size(Axis::Y) && z < self.size(Axis::Z)) && (self.is_full(x, y, z)) } - pub fn is_full_wide_axis_cycle(&self, axis_cycle: AxisCycle, x: i32, y: i32, z: i32) -> bool { - self.is_full_wide( - axis_cycle.cycle_xyz(x, y, z, Axis::X), - axis_cycle.cycle_xyz(x, y, z, Axis::Y), - axis_cycle.cycle_xyz(x, y, z, Axis::Z), - ) + pub fn is_full_wide_axis_cycle(&self, axis_cycle: AxisCycle, pos: Vec3i) -> bool { + self.is_full_wide(Vec3i { + x: axis_cycle.cycle_xyz(pos, Axis::X), + y: axis_cycle.cycle_xyz(pos, Axis::Y), + z: axis_cycle.cycle_xyz(pos, Axis::Z), + }) } pub fn is_full(&self, x: u32, y: u32, z: u32) -> bool { @@ -83,12 +84,8 @@ pub struct BitSetDiscreteVoxelShape { z_size: u32, storage: BitSet, - x_min: i32, - y_min: i32, - z_min: i32, - x_max: i32, - y_max: i32, - z_max: i32, + min: Vec3i, + max: Vec3i, } impl BitSetDiscreteVoxelShape { @@ -99,12 +96,12 @@ impl BitSetDiscreteVoxelShape { z_size: z_min, storage: BitSet::new((x_min * y_min * z_min).try_into().unwrap()), - x_min: z_min.try_into().unwrap(), - y_min: z_min.try_into().unwrap(), - z_min: z_min.try_into().unwrap(), - x_max: 0, - y_max: 0, - z_max: 0, + min: Vec3i { + x: z_min.try_into().unwrap(), + y: z_min.try_into().unwrap(), + z: z_min.try_into().unwrap(), + }, + max: Vec3i::ZERO, } } @@ -114,24 +111,16 @@ impl BitSetDiscreteVoxelShape { x_size: u32, y_size: u32, z_size: u32, - x_min: i32, - y_min: i32, - z_min: i32, - x_max: i32, - y_max: i32, - z_max: i32, + min: Vec3i, + max: Vec3i, ) -> Self { let mut shape = BitSetDiscreteVoxelShape::new(x_size, y_size, z_size); - shape.x_min = x_min; - shape.y_min = y_min; - shape.z_min = z_min; - shape.x_max = x_max; - shape.y_max = y_max; - shape.z_max = z_max; - - for x in x_min..x_max { - for y in y_min..y_max { - for z in z_min..z_max { + shape.min = min; + shape.max = max; + + for x in min.x..max.x { + for y in min.y..max.y { + for z in min.z..max.z { shape.fill_update_bounds( x.try_into().unwrap(), y.try_into().unwrap(), @@ -148,12 +137,10 @@ impl BitSetDiscreteVoxelShape { fn fill_update_bounds(&mut self, x: u32, y: u32, z: u32, update: bool) { self.storage.set(self.get_index(x, y, z)); if update { - self.x_min = cmp::min(self.x_min, x as i32); - self.y_min = cmp::min(self.y_min, y as i32); - self.z_min = cmp::min(self.z_min, z as i32); - self.x_max = cmp::max(self.x_max, (x + 1) as i32); - self.y_max = cmp::max(self.y_max, (y + 1) as i32); - self.z_max = cmp::max(self.z_max, (z + 1) as i32); + let candidate_min = Vec3i::new(x as i32, y as i32, z as i32); + self.min = self.min.min(candidate_min); + let candidate_max = Vec3i::new((x + 1) as i32, (y + 1) as i32, (z + 1) as i32); + self.max = self.max.max(candidate_max); } } @@ -174,7 +161,7 @@ impl BitSetDiscreteVoxelShape { var2: &IndexMerger, var3: &IndexMerger, var4: &IndexMerger, - var5: impl Fn(bool, bool) -> bool, + op: impl Fn(bool, bool) -> bool, ) -> Self { let mut var6 = BitSetDiscreteVoxelShape::new( (var2.size() - 1) as u32, @@ -189,48 +176,48 @@ impl BitSetDiscreteVoxelShape { -2147483648, -2147483648, ]; - var2.for_merged_indexes(|var7x: i32, var8: i32, var9: i32| { + var2.for_merged_indexes(|x1: i32, x2: i32, x3: i32| { let mut var10 = [false]; - var3.for_merged_indexes(|var10x: i32, var11: i32, var12: i32| { + var3.for_merged_indexes(|y1: i32, y2: i32, y3: i32| { let mut var13 = [false]; - var4.for_merged_indexes(|var12x: i32, var13x: i32, var14: i32| { - if var5( - var0.is_full_wide(var7x, var10x, var12x), - var1.is_full_wide(var8, var11, var13x), + var4.for_merged_indexes(|z1: i32, z2: i32, z3: i32| { + if op( + var0.is_full_wide(Vec3i::new(x1, y1, z1)), + var1.is_full_wide(Vec3i::new(x2, y2, z2)), ) { var6.storage.set(var6.get_index( - var9.try_into().unwrap(), - var12.try_into().unwrap(), - var14.try_into().unwrap(), + x3.try_into().unwrap(), + y3.try_into().unwrap(), + z3.try_into().unwrap(), )); - var7[2] = cmp::min(var7[2], var14); - var7[5] = cmp::max(var7[5], var14); + var7[2] = cmp::min(var7[2], z3); + var7[5] = cmp::max(var7[5], z3); var13[0] = true; } true }); if var13[0] { - var7[1] = cmp::min(var7[1], var12); - var7[4] = cmp::max(var7[4], var12); + var7[1] = cmp::min(var7[1], y3); + var7[4] = cmp::max(var7[4], y3); var10[0] = true; } true }); if var10[0] { - var7[0] = cmp::min(var7[0], var9); - var7[3] = cmp::max(var7[3], var9); + var7[0] = cmp::min(var7[0], x3); + var7[3] = cmp::max(var7[3], x3); } true }); - var6.x_min = var7[0]; - var6.y_min = var7[1]; - var6.z_min = var7[2]; - var6.x_max = var7[3] + 1; - var6.y_max = var7[4] + 1; - var6.z_max = var7[5] + 1; + var6.min.x = var7[0]; + var6.min.y = var7[1]; + var6.min.z = var7[2]; + var6.max.x = var7[3] + 1; + var6.max.y = var7[4] + 1; + var6.max.z = var7[5] + 1; var6 } @@ -306,11 +293,11 @@ impl BitSetDiscreteVoxelShape { } fn first_full(&self, axis: Axis) -> i32 { - axis.choose(self.x_min, self.y_min, self.z_min) + axis.choose(self.min.x, self.min.y, self.min.z) } fn last_full(&self, axis: Axis) -> i32 { - axis.choose(self.x_max, self.y_max, self.z_max) + axis.choose(self.max.x, self.max.y, self.max.z) } fn is_full(&self, x: u32, y: u32, z: u32) -> bool { @@ -351,12 +338,16 @@ impl From<&DiscreteVoxelShape> for BitSetDiscreteVoxelShape { y_size, z_size, storage, - x_min: shape.first_full(Axis::X), - y_min: shape.first_full(Axis::Y), - z_min: shape.first_full(Axis::Z), - x_max: shape.last_full(Axis::X), - y_max: shape.last_full(Axis::Y), - z_max: shape.last_full(Axis::Z), + min: Vec3i { + x: shape.first_full(Axis::X), + y: shape.first_full(Axis::Y), + z: shape.first_full(Axis::Z), + }, + max: Vec3i { + x: shape.last_full(Axis::X), + y: shape.last_full(Axis::Y), + z: shape.last_full(Axis::Z), + }, } } } diff --git a/azalea-physics/src/collision/mod.rs b/azalea-physics/src/collision/mod.rs index 10b607f2..e6423fc4 100644 --- a/azalea-physics/src/collision/mod.rs +++ b/azalea-physics/src/collision/mod.rs @@ -129,7 +129,6 @@ pub struct MoveCtx<'world, 'state, 'a, 'b> { /// Move an entity by a given delta, checking for collisions. /// /// In Mojmap, this is `Entity.move`. -#[allow(clippy::too_many_arguments)] pub fn move_colliding(ctx: &mut MoveCtx, mut movement: Vec3) { // TODO: do all these diff --git a/azalea-physics/src/collision/shape.rs b/azalea-physics/src/collision/shape.rs index 96506922..fedc8a79 100644 --- a/azalea-physics/src/collision/shape.rs +++ b/azalea-physics/src/collision/shape.rs @@ -4,7 +4,7 @@ use azalea_core::{ direction::{Axis, AxisCycle, Direction}, hit_result::BlockHitResult, math::{EPSILON, binary_search}, - position::{BlockPos, Vec3}, + position::{BlockPos, Vec3, Vec3i}, }; use super::mergers::IndexMerger; @@ -56,12 +56,16 @@ pub fn box_shape( x_bits, y_bits, z_bits, - (min_x * x_bits as f64).round() as i32, - (min_y * y_bits as f64).round() as i32, - (min_z * z_bits as f64).round() as i32, - (max_x * x_bits as f64).round() as i32, - (max_y * y_bits as f64).round() as i32, - (max_z * z_bits as f64).round() as i32, + Vec3i { + x: (min_x * x_bits as f64).round() as i32, + y: (min_y * y_bits as f64).round() as i32, + z: (min_z * z_bits as f64).round() as i32, + }, + Vec3i { + x: (max_x * x_bits as f64).round() as i32, + y: (max_y * y_bits as f64).round() as i32, + z: (max_z * z_bits as f64).round() as i32, + }, ); VoxelShape::Cube(CubeVoxelShape::new(DiscreteVoxelShape::BitSet(shape))) } @@ -262,12 +266,12 @@ impl Shapes { shape2: DiscreteVoxelShape, op: impl Fn(bool, bool) -> bool, ) -> bool { - !merged_x.for_merged_indexes(|var5x, var6, _var7| { - merged_y.for_merged_indexes(|var6x, var7x, _var8| { - merged_z.for_merged_indexes(|var7, var8x, _var9| { + !merged_x.for_merged_indexes(|x, x2, _x3| { + merged_y.for_merged_indexes(|y, y2, _y3| { + merged_z.for_merged_indexes(|z, z2, _z3| { !op( - shape1.is_full_wide(var5x, var6x, var7), - shape2.is_full_wide(var6, var7x, var8x), + shape1.is_full_wide(Vec3i::new(x, y, z)), + shape2.is_full_wide(Vec3i::new(x2, y2, z2)), ) }) }) @@ -418,11 +422,11 @@ impl VoxelShape { } let right_after_start = from + (vector * 0.001); - if self.shape().is_full_wide( + if self.shape().is_full_wide(Vec3i::new( self.find_index(Axis::X, right_after_start.x - block_pos.x as f64), self.find_index(Axis::Y, right_after_start.y - block_pos.y as f64), self.find_index(Axis::Z, right_after_start.z - block_pos.z as f64), - ) { + )) { Some(BlockHitResult { block_pos, direction: Direction::nearest(vector).opposite(), @@ -483,7 +487,7 @@ impl VoxelShape { for z in z_min_index..z_max_index { if self .shape() - .is_full_wide_axis_cycle(inverse_axis_cycle, x, y, z) + .is_full_wide_axis_cycle(inverse_axis_cycle, Vec3i { x, y, z }) { let var23 = self.get(x_axis, x as usize) - max_x; if var23 >= -EPSILON { @@ -500,7 +504,7 @@ impl VoxelShape { for z in z_min_index..z_max_index { if self .shape() - .is_full_wide_axis_cycle(inverse_axis_cycle, x, y, z) + .is_full_wide_axis_cycle(inverse_axis_cycle, Vec3i { x, y, z }) { let var23 = self.get(x_axis, (x + 1) as usize) - min_x; if var23 <= EPSILON { diff --git a/azalea-protocol/Cargo.toml b/azalea-protocol/Cargo.toml index e2819d11..df3aa615 100644 --- a/azalea-protocol/Cargo.toml +++ b/azalea-protocol/Cargo.toml @@ -47,3 +47,6 @@ indexmap.workspace = true connecting = [] default = ["packets"] packets = ["connecting", "dep:azalea-core"] + +[lints] +workspace = true diff --git a/azalea-protocol/azalea-protocol-macros/Cargo.toml b/azalea-protocol/azalea-protocol-macros/Cargo.toml index 100c4817..88fdacf8 100644 --- a/azalea-protocol/azalea-protocol-macros/Cargo.toml +++ b/azalea-protocol/azalea-protocol-macros/Cargo.toml @@ -13,3 +13,6 @@ proc-macro = true proc-macro2.workspace = true quote.workspace = true syn.workspace = true + +[lints] +workspace = true diff --git a/azalea-registry/Cargo.toml b/azalea-registry/Cargo.toml index d85a378c..e2aa5c61 100644 --- a/azalea-registry/Cargo.toml +++ b/azalea-registry/Cargo.toml @@ -15,3 +15,6 @@ simdnbt.workspace = true [features] serde = ["azalea-registry-macros/serde", "dep:serde"] default = ["serde"] + +[lints] +workspace = true diff --git a/azalea-world/Cargo.toml b/azalea-world/Cargo.toml index 755aad29..6abe6184 100644 --- a/azalea-world/Cargo.toml +++ b/azalea-world/Cargo.toml @@ -30,3 +30,6 @@ serde = ["dep:serde"] [[bench]] name = "chunks" harness = false + +[lints] +workspace = true diff --git a/azalea/Cargo.toml b/azalea/Cargo.toml index ab6b83b2..b711d8a0 100644 --- a/azalea/Cargo.toml +++ b/azalea/Cargo.toml @@ -68,3 +68,6 @@ harness = false [[bench]] name = "checks" harness = false + +[lints] +workspace = true diff --git a/azalea/src/swarm/mod.rs b/azalea/src/swarm/mod.rs index 59bad419..34247453 100644 --- a/azalea/src/swarm/mod.rs +++ b/azalea/src/swarm/mod.rs @@ -32,7 +32,7 @@ use bevy_app::{App, AppExit, PluginGroup, PluginGroupBuilder, Plugins, SubApp}; use bevy_ecs::prelude::*; use futures::future::{BoxFuture, join_all}; use parking_lot::{Mutex, RwLock}; -use tokio::{sync::mpsc, time::sleep}; +use tokio::sync::mpsc; use tracing::{debug, error, warn}; use crate::{BoxHandleFn, DefaultBotPlugins, HandleFn, JoinOpts, NoState, StartError}; @@ -845,52 +845,6 @@ impl Swarm { ); } - /// Add a new account to the swarm, retrying if it couldn't join. - /// - /// This will run forever until the bot joins or the task is aborted. - /// - /// This does exponential backoff (though very limited), starting at 5 - /// seconds and doubling up to 15 seconds. - #[deprecated(note = "azalea has auto-reconnect functionality built-in now, use `add` instead")] - pub async fn add_and_retry_forever( - &self, - account: &Account, - state: S, - ) -> Client { - #[allow(deprecated)] - self.add_and_retry_forever_with_opts(account, state, &JoinOpts::default()) - .await - } - - /// Same as [`Self::add_and_retry_forever`], but allow passing custom join - /// options. - #[deprecated( - note = "azalea has auto-reconnect functionality built-in now, use `add_with_opts` instead" - )] - pub async fn add_and_retry_forever_with_opts( - &self, - account: &Account, - state: S, - opts: &JoinOpts, - ) -> Client { - let mut disconnects: u32 = 0; - loop { - match self.add_with_opts(account, state.clone(), opts).await { - Ok(bot) => return bot, - Err(e) => { - disconnects += 1; - let delay = (Duration::from_secs(5) * 2u32.pow(disconnects.min(16))) - .min(Duration::from_secs(15)); - let username = account.username.clone(); - - error!("Error joining as {username}: {e}. Waiting {delay:?} and trying again."); - - sleep(delay).await; - } - } - } - } - /// Get an array of ECS [`Entity`]s for all [`LocalEntity`]s in our world. /// This will include clients that were disconnected without being removed /// from the ECS. -- cgit v1.2.3