aboutsummaryrefslogtreecommitdiff
path: root/azalea-physics/src
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2024-12-11 19:51:12 -0600
committerGitHub <noreply@github.com>2024-12-11 19:51:12 -0600
commite9136c9cbbf9010b8352127e129c1cd290f377bd (patch)
treedb83316a273153106dd3b343c9d6d4fce234d132 /azalea-physics/src
parent23932003d98db0f5f976146aa9a11e5d04a74695 (diff)
downloadazalea-drasl-e9136c9cbbf9010b8352127e129c1cd290f377bd.tar.xz
Implement EntityPositionSync (#196)
* implement EntityPositionSync * fix EntityPositionSync setting the wrong vec_delta_codec and also move into a RelativeEntityUpdate
Diffstat (limited to 'azalea-physics/src')
-rw-r--r--azalea-physics/src/collision/mod.rs4
-rw-r--r--azalea-physics/src/lib.rs6
2 files changed, 5 insertions, 5 deletions
diff --git a/azalea-physics/src/collision/mod.rs b/azalea-physics/src/collision/mod.rs
index 7d7ddc5e..913cedac 100644
--- a/azalea-physics/src/collision/mod.rs
+++ b/azalea-physics/src/collision/mod.rs
@@ -73,7 +73,7 @@ fn collide(movement: &Vec3, world: &Instance, physics: &azalea_entity::Physics)
let y_collision = movement.y != collided_delta.y;
let z_collision = movement.z != collided_delta.z;
- let on_ground = physics.on_ground || y_collision && movement.y < 0.;
+ let on_ground = physics.on_ground() || y_collision && movement.y < 0.;
let max_up_step = 0.6;
if max_up_step > 0. && on_ground && (x_collision || z_collision) {
@@ -192,7 +192,7 @@ pub fn move_colliding(
physics.horizontal_collision = horizontal_collision;
physics.vertical_collision = vertical_collision;
- physics.on_ground = on_ground;
+ physics.set_on_ground(on_ground);
// TODO: minecraft checks for a "minor" horizontal collision here
diff --git a/azalea-physics/src/lib.rs b/azalea-physics/src/lib.rs
index c50095e4..2ca64b1f 100644
--- a/azalea-physics/src/lib.rs
+++ b/azalea-physics/src/lib.rs
@@ -100,7 +100,7 @@ fn travel(
let block_below: Box<dyn Block> = block_state_below.into();
let block_friction = block_below.behavior().friction;
- let inertia = if physics.on_ground {
+ let inertia = if physics.on_ground() {
block_friction * 0.91
} else {
0.91
@@ -178,7 +178,7 @@ pub fn ai_step(
if **jumping {
// TODO: jumping in liquids and jump delay
- if physics.on_ground {
+ if physics.on_ground() {
jump_from_ground(
&mut physics,
position,
@@ -358,7 +358,7 @@ fn get_friction_influenced_speed(
is_sprinting: bool,
) -> f32 {
// TODO: have speed & flying_speed fields in entity
- if physics.on_ground {
+ if physics.on_ground() {
let speed: f32 = attributes.speed.calculate() as f32;
speed * (0.216f32 / (friction * friction * friction))
} else {