aboutsummaryrefslogtreecommitdiff
path: root/azalea-physics/src/collision/mod.rs
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2022-11-12 23:54:05 -0600
committerGitHub <noreply@github.com>2022-11-12 23:54:05 -0600
commit6eee543a3367d38a6f0e9bffb457a2bd76a8f9cc (patch)
treea5e493ccd7ec24293b8d866242c3836146517122 /azalea-physics/src/collision/mod.rs
parentfa57d03627aa20b1df44caed7cb025b6db1d9b53 (diff)
downloadazalea-drasl-6eee543a3367d38a6f0e9bffb457a2bd76a8f9cc.tar.xz
Pathfinder (#25)
Pathfinding is very much not done, but it works enough and I want to get this merged. TODO: fast replanning, goals that aren't a single node, falling moves (it should be able to play the dropper), parkour moves
Diffstat (limited to 'azalea-physics/src/collision/mod.rs')
-rwxr-xr-x[-rw-r--r--]azalea-physics/src/collision/mod.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/azalea-physics/src/collision/mod.rs b/azalea-physics/src/collision/mod.rs
index f08e48e3..d5502f3d 100644..100755
--- a/azalea-physics/src/collision/mod.rs
+++ b/azalea-physics/src/collision/mod.rs
@@ -4,8 +4,10 @@ mod discrete_voxel_shape;
mod mergers;
mod shape;
-use azalea_core::{Axis, PositionXYZ, Vec3, AABB, EPSILON};
-use azalea_world::entity::{EntityData, EntityMut};
+use std::ops::DerefMut;
+
+use azalea_core::{Axis, Vec3, AABB, EPSILON};
+use azalea_world::entity::{Entity, EntityData};
use azalea_world::{Dimension, MoveEntityError};
pub use blocks::BlockWithShape;
use dimension_collisions::CollisionGetter;
@@ -81,7 +83,7 @@ impl HasCollision for Dimension {
}
}
-impl MovableEntity for EntityMut<'_> {
+impl<D: DerefMut<Target = Dimension>> MovableEntity for Entity<'_, D> {
/// Move an entity by a given delta, checking for collisions.
fn move_colliding(
&mut self,
@@ -158,6 +160,8 @@ impl MovableEntity for EntityMut<'_> {
if vertical_collision {
// blockBelow.updateEntityAfterFallOn(this.level, this);
+ // the default implementation of updateEntityAfterFallOn sets the y movement to 0
+ self.delta.y = 0.;
}
if on_ground {