aboutsummaryrefslogtreecommitdiff
path: root/azalea-physics/src/collision
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2023-09-18 23:25:18 -0500
committermat <git@matdoes.dev>2023-09-18 23:25:22 -0500
commit51963990bc0cbbbca388b2ed015fd64ff6492d7b (patch)
treea06f6b78f6f3954c230a9c57050467bb20ebe232 /azalea-physics/src/collision
parente6941b6a24deed617d09c6e08ba65278bb3bcf25 (diff)
downloadazalea-drasl-51963990bc0cbbbca388b2ed015fd64ff6492d7b.tar.xz
fix entities not always being despawned after merge
Diffstat (limited to 'azalea-physics/src/collision')
-rw-r--r--azalea-physics/src/collision/mod.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/azalea-physics/src/collision/mod.rs b/azalea-physics/src/collision/mod.rs
index de9439ca..1013b4fc 100644
--- a/azalea-physics/src/collision/mod.rs
+++ b/azalea-physics/src/collision/mod.rs
@@ -8,6 +8,7 @@ use std::ops::Add;
use azalea_core::{Axis, Vec3, AABB, EPSILON};
use azalea_world::{Instance, MoveEntityError};
+use bevy_ecs::world::Mut;
pub use blocks::BlockWithShape;
pub use discrete_voxel_shape::*;
pub use shape::*;
@@ -138,7 +139,7 @@ pub fn move_colliding(
_mover_type: &MoverType,
movement: &Vec3,
world: &Instance,
- position: &mut azalea_entity::Position,
+ mut position: Mut<azalea_entity::Position>,
physics: &mut azalea_entity::Physics,
) -> Result<(), MoveEntityError> {
// TODO: do all these
@@ -177,7 +178,9 @@ pub fn move_colliding(
}
};
- **position = new_pos;
+ if new_pos != **position {
+ **position = new_pos;
+ }
}
let x_collision = movement.x != collide_result.x;
@@ -189,7 +192,7 @@ pub fn move_colliding(
// TODO: minecraft checks for a "minor" horizontal collision here
- let _block_pos_below = azalea_entity::on_pos_legacy(&world.chunks, position);
+ let _block_pos_below = azalea_entity::on_pos_legacy(&world.chunks, &position);
// let _block_state_below = self
// .world
// .get_block_state(&block_pos_below)