From c1af5d15e3754bbf2d71d704fb089d760061e3c7 Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 29 Aug 2022 21:10:15 -0500 Subject: physics stuff --- azalea-physics/src/lib.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'azalea-physics/src') diff --git a/azalea-physics/src/lib.rs b/azalea-physics/src/lib.rs index 8842727b..642fa89e 100644 --- a/azalea-physics/src/lib.rs +++ b/azalea-physics/src/lib.rs @@ -34,7 +34,10 @@ impl HasPhysics for EntityMut<'_> { let block_below: Box = block_state_below.into(); block_below.behavior().friction } else { - unreachable!("Block below should be a real block.") + unreachable!( + "Block below at {:?} should be a real block.", + block_pos_below + ) }; let inertia = if self.on_ground { @@ -86,10 +89,10 @@ impl HasPhysics for EntityMut<'_> { fn get_block_pos_below_that_affects_movement(entity: &EntityData) -> BlockPos { BlockPos::new( - entity.pos().x as i32, + entity.pos().x.floor() as i32, // TODO: this uses bounding_box.min_y instead of position.y - (entity.pos().y - 0.5f64) as i32, - entity.pos().z as i32, + (entity.pos().y - 0.5f64).floor() as i32, + entity.pos().z.floor() as i32, ) } -- cgit v1.2.3