From 51963990bc0cbbbca388b2ed015fd64ff6492d7b Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 18 Sep 2023 23:25:18 -0500 Subject: fix entities not always being despawned after merge --- azalea-physics/src/collision/mod.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'azalea-physics/src/collision') 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, 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) -- cgit v1.2.3