Skip to content

Commit

Permalink
fix: knockback
Browse files Browse the repository at this point in the history
  • Loading branch information
Snowiiii committed Oct 20, 2024
1 parent b7ac8ad commit 8ede38d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pumpkin/src/client/player_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,21 +422,21 @@ impl Player {
if config.knockback {
let yaw = entity.yaw.load();
let strength = 1.0;
let victem_velocity = victem_entity.velocity.load();
let saved_velo = victem_velocity;
let saved_velo = victem_entity.velocity.load();
victem_entity.knockback(
strength * 0.5,
(yaw * (PI / 180.0)).sin() as f64,
-(yaw * (PI / 180.0)).cos() as f64,
);
let victem_velocity = victem_entity.velocity.load();
let packet = &CEntityVelocity::new(
&entity_id,
victem_velocity.x as f32,
victem_velocity.y as f32,
victem_velocity.z as f32,
);
let velocity = entity.velocity.load();
victem_entity
entity
.velocity
.store(velocity.multiply(0.6, 1.0, 0.6));

Expand Down
4 changes: 1 addition & 3 deletions pumpkin/src/world/player_chunker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ pub async fn update_position(player: &Player) {
},
|chunk_pos| {
unloading_chunks.push(chunk_pos);
// player
// .client
// .send_packet(&CUnloadChunk::new(chunk_pos.x, chunk_pos.z));
},
false,
);
Expand All @@ -131,6 +128,7 @@ pub async fn update_position(player: &Player) {
.world
.mark_chunks_as_not_watched(&unloading_chunks)
.await;
// we may don't need to iter twice
for chunk in unloading_chunks {
if !player
.client
Expand Down

0 comments on commit 8ede38d

Please sign in to comment.