diff options
Diffstat (limited to 'azalea-physics/src')
| -rw-r--r-- | azalea-physics/src/collision/blocks.rs | 5 | ||||
| -rwxr-xr-x | azalea-physics/src/collision/mergers.rs | 3 | ||||
| -rwxr-xr-x | azalea-physics/src/collision/shape.rs | 8 | ||||
| -rw-r--r-- | azalea-physics/src/collision/world_collisions.rs | 8 | ||||
| -rw-r--r-- | azalea-physics/src/lib.rs | 3 |
5 files changed, 17 insertions, 10 deletions
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(); |
