aboutsummaryrefslogtreecommitdiff
path: root/azalea-physics/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-08-29 21:10:15 -0500
committermat <github@matdoes.dev>2022-08-29 21:10:15 -0500
commitc1af5d15e3754bbf2d71d704fb089d760061e3c7 (patch)
tree55bdb92cbcb924bfefbcb78284f8417c6d05e8cf /azalea-physics/src
parentd9d7b87d6170a4a087f1919d6efa390db6932083 (diff)
downloadazalea-drasl-c1af5d15e3754bbf2d71d704fb089d760061e3c7.tar.xz
physics stuff
Diffstat (limited to 'azalea-physics/src')
-rw-r--r--azalea-physics/src/lib.rs11
1 files changed, 7 insertions, 4 deletions
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<dyn Block> = 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,
)
}