aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2025-01-10 16:45:27 -0600
committerGitHub <noreply@github.com>2025-01-10 16:45:27 -0600
commit0d16f01571ec8315f3979eae46981e559ade1cf9 (patch)
treeea43c32a57b0e6a67579d75a134dfbc009d09781 /azalea-client/src
parent615d8f9d2ac56b3244d328587243301da253eafd (diff)
downloadazalea-drasl-0d16f01571ec8315f3979eae46981e559ade1cf9.tar.xz
Fluid physics (#199)
* start implementing fluid physics * Initial implementation of fluid pushing * different travel function in water * bubble columns * jumping in water * cleanup * change ultrawarm to be required * fix for clippy
Diffstat (limited to 'azalea-client/src')
-rw-r--r--azalea-client/src/mining.rs2
-rw-r--r--azalea-client/src/movement.rs7
-rw-r--r--azalea-client/src/packet_handling/game.rs7
3 files changed, 12 insertions, 4 deletions
diff --git a/azalea-client/src/mining.rs b/azalea-client/src/mining.rs
index bf5a48ca..ac4c9c0d 100644
--- a/azalea-client/src/mining.rs
+++ b/azalea-client/src/mining.rs
@@ -1,4 +1,4 @@
-use azalea_block::{Block, BlockState, FluidState};
+use azalea_block::{fluid_state::FluidState, Block, BlockState};
use azalea_core::{direction::Direction, game_type::GameMode, position::BlockPos, tick::GameTick};
use azalea_entity::{mining::get_mine_progress, FluidOnEyes, Physics};
use azalea_inventory::ItemStack;
diff --git a/azalea-client/src/movement.rs b/azalea-client/src/movement.rs
index 8801e2c6..ec5b751e 100644
--- a/azalea-client/src/movement.rs
+++ b/azalea-client/src/movement.rs
@@ -65,7 +65,8 @@ impl Plugin for PlayerMovePlugin {
(tick_controls, local_player_ai_step)
.chain()
.in_set(PhysicsSet)
- .before(ai_step),
+ .before(ai_step)
+ .before(azalea_physics::fluids::update_in_water_state_and_do_fluid_pushing),
send_sprinting_if_needed.after(azalea_entity::update_in_loaded_chunk),
send_position.after(PhysicsSet),
)
@@ -324,8 +325,8 @@ pub fn local_player_ai_step(
) {
for (physics_state, mut physics, mut sprinting, mut attributes) in query.iter_mut() {
// server ai step
- physics.xxa = physics_state.left_impulse;
- physics.zza = physics_state.forward_impulse;
+ physics.x_acceleration = physics_state.left_impulse;
+ physics.z_acceleration = physics_state.forward_impulse;
// TODO: food data and abilities
// let has_enough_food_to_sprint = self.food_data().food_level ||
diff --git a/azalea-client/src/packet_handling/game.rs b/azalea-client/src/packet_handling/game.rs
index d92f2464..0d5a6afe 100644
--- a/azalea-client/src/packet_handling/game.rs
+++ b/azalea-client/src/packet_handling/game.rs
@@ -500,6 +500,9 @@ pub fn process_packet_events(ecs: &mut World) {
**position = new_pos;
}
+ // old_pos is set to the current position when we're teleported
+ physics.set_old_pos(&position);
+
// send the relevant packets
send_packet_events.send(SendPacketEvent::new(
@@ -853,10 +856,14 @@ pub fn process_packet_events(ecs: &mut World) {
if new_pos != **position {
**position = new_pos;
}
+ let position = *position;
let mut look_direction = entity.get_mut::<LookDirection>().unwrap();
if new_look_direction != *look_direction {
*look_direction = new_look_direction;
}
+ // old_pos is set to the current position when we're teleported
+ let mut physics = entity.get_mut::<Physics>().unwrap();
+ physics.set_old_pos(&position);
}),
});