@@ -53,7 +53,7 @@ pub struct Player {
5353 pub hunger : i32 ,
5454 pub saturation : f32 ,
5555 pub dead : bool ,
56- pub ignore_fall_for_ticks : i32 ,
56+ pub ignore_fall_for_ticks : u32 ,
5757
5858 pub shared_secret : Option < Vec < u8 > > ,
5959 pub textures : Option < String > ,
@@ -229,7 +229,9 @@ impl Player {
229229 send_sync_player_position ( & mut buffer, self ) . await ?;
230230 let _ = tx. send ( buffer) ;
231231
232- self . ignore_fall_for_ticks = 2 ;
232+ self . fall_distance = 0.0 ;
233+ self . server_vy = 0.0 ;
234+ self . ignore_fall_for_ticks = 100 ;
233235
234236 Ok ( ( ) )
235237 }
@@ -364,13 +366,13 @@ impl Player {
364366 self . vx = 0.0 ;
365367 self . vy = 0.0 ;
366368 self . vz = 0.0 ;
369+ self . server_vy = 0.0 ;
367370
368371 self . yaw = 0.0 ;
369372 self . pitch = 0.0 ;
370373
371374 self . dead = false ;
372375 self . chunks_loaded = false ;
373- self . ignore_fall_for_ticks = 5 ;
374376
375377 self . sync_player_health ( ) . await ?;
376378 self . sync_player_position ( ) . await ?;
@@ -379,7 +381,7 @@ impl Player {
379381 }
380382
381383 pub async fn tick ( & mut self ) -> anyhow:: Result < ( ) > {
382- if self . dead {
384+ if self . dead || ! self . initial_sync_done {
383385 return Ok ( ( ) ) ;
384386 }
385387
@@ -436,6 +438,8 @@ impl Player {
436438 self . y += self . vy ;
437439 self . z += self . vz ;
438440
441+ println ! ( "Server vy: {}, fall distance: {}, on_ground: {}, flying: {}, ignore_fall_for_ticks: {}" , self . server_vy, self . fall_distance, self . on_ground, self . flying, self . ignore_fall_for_ticks) ;
442+
439443 if !self . on_ground && !self . flying {
440444 if self . movement . jumping && !self . jump_applied {
441445 self . server_vy = 0.42 ;
@@ -472,6 +476,11 @@ impl Player {
472476
473477 self . ignore_fall_for_ticks = self . ignore_fall_for_ticks . saturating_sub ( 1 ) ;
474478
479+ if self . ignore_fall_for_ticks > 0 {
480+ self . fall_distance = 0.0 ;
481+ self . server_vy = 0.0 ;
482+ }
483+
475484 if !self . chunks_loaded {
476485 return Ok ( ( ) ) ;
477486 }
0 commit comments