diff options
| author | mat <git@matdoes.dev> | 2025-02-22 23:01:54 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-02-22 23:01:54 +0000 |
| commit | 34f53baf85fb5c7163ec5d71a8ab9d45d3f271b6 (patch) | |
| tree | 7920fec1203e8e96463a142f5f6da6164e76e684 /azalea-physics/src/collision | |
| parent | bdd2fc91e11e2896d8e1c7046df247e1075bd40d (diff) | |
| download | azalea-drasl-34f53baf85fb5c7163ec5d71a8ab9d45d3f271b6.tar.xz | |
update to rust edition 2024
Diffstat (limited to 'azalea-physics/src/collision')
| -rwxr-xr-x | azalea-physics/src/collision/mergers.rs | 2 | ||||
| -rw-r--r-- | azalea-physics/src/collision/mod.rs | 2 | ||||
| -rwxr-xr-x | azalea-physics/src/collision/shape.rs | 4 | ||||
| -rw-r--r-- | azalea-physics/src/collision/world_collisions.rs | 13 |
4 files changed, 10 insertions, 11 deletions
diff --git a/azalea-physics/src/collision/mergers.rs b/azalea-physics/src/collision/mergers.rs index 85fd2826..dbe9c1e8 100755 --- a/azalea-physics/src/collision/mergers.rs +++ b/azalea-physics/src/collision/mergers.rs @@ -1,6 +1,6 @@ use std::cmp::{self, Ordering}; -use azalea_core::math::{gcd, lcm, EPSILON}; +use azalea_core::math::{EPSILON, gcd, lcm}; use super::CubePointRange; diff --git a/azalea-physics/src/collision/mod.rs b/azalea-physics/src/collision/mod.rs index 530aa47f..540cf7d4 100644 --- a/azalea-physics/src/collision/mod.rs +++ b/azalea-physics/src/collision/mod.rs @@ -6,7 +6,7 @@ mod world_collisions; use std::{ops::Add, sync::LazyLock}; -use azalea_block::{fluid_state::FluidState, BlockState}; +use azalea_block::{BlockState, fluid_state::FluidState}; use azalea_core::{ aabb::AABB, direction::Axis, diff --git a/azalea-physics/src/collision/shape.rs b/azalea-physics/src/collision/shape.rs index b0dceabb..726e62ad 100755 --- a/azalea-physics/src/collision/shape.rs +++ b/azalea-physics/src/collision/shape.rs @@ -3,12 +3,12 @@ use std::{cmp, num::NonZeroU32, sync::LazyLock}; use azalea_core::{ block_hit_result::BlockHitResult, direction::{Axis, AxisCycle, Direction}, - math::{binary_search, EPSILON}, + math::{EPSILON, binary_search}, position::{BlockPos, Vec3}, }; use super::mergers::IndexMerger; -use crate::collision::{BitSetDiscreteVoxelShape, DiscreteVoxelShape, AABB}; +use crate::collision::{AABB, BitSetDiscreteVoxelShape, DiscreteVoxelShape}; pub struct Shapes; diff --git a/azalea-physics/src/collision/world_collisions.rs b/azalea-physics/src/collision/world_collisions.rs index f0b41986..3aede743 100644 --- a/azalea-physics/src/collision/world_collisions.rs +++ b/azalea-physics/src/collision/world_collisions.rs @@ -9,8 +9,8 @@ use azalea_core::{ use azalea_world::{Chunk, Instance}; use parking_lot::RwLock; -use super::{Shapes, BLOCK_SHAPE}; -use crate::collision::{BlockWithShape, VoxelShape, AABB}; +use super::{BLOCK_SHAPE, Shapes}; +use crate::collision::{AABB, BlockWithShape, VoxelShape}; pub fn get_block_collisions(world: &Instance, aabb: AABB) -> Vec<VoxelShape> { let mut state = BlockCollisionsState::new(world, aabb); @@ -27,12 +27,11 @@ pub fn get_block_collisions(world: &Instance, aabb: AABB) -> Vec<VoxelShape> { let item_chunk_pos = ChunkPos::from(item.pos); let block_state: BlockState = if item_chunk_pos == initial_chunk_pos { - if let Some(initial_chunk) = &initial_chunk { - initial_chunk + match &initial_chunk { + Some(initial_chunk) => initial_chunk .get(&ChunkBlockPos::from(item.pos), state.world.chunks.min_y) - .unwrap_or(BlockState::AIR) - } else { - BlockState::AIR + .unwrap_or(BlockState::AIR), + _ => BlockState::AIR, } } else { state.get_block_state(item.pos) |
