Skip to content

Commit 8ede38d

Browse files
committed
fix: knockback
1 parent b7ac8ad commit 8ede38d

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

pumpkin/src/client/player_packet.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -422,21 +422,21 @@ impl Player {
422422
if config.knockback {
423423
let yaw = entity.yaw.load();
424424
let strength = 1.0;
425-
let victem_velocity = victem_entity.velocity.load();
426-
let saved_velo = victem_velocity;
425+
let saved_velo = victem_entity.velocity.load();
427426
victem_entity.knockback(
428427
strength * 0.5,
429428
(yaw * (PI / 180.0)).sin() as f64,
430429
-(yaw * (PI / 180.0)).cos() as f64,
431430
);
431+
let victem_velocity = victem_entity.velocity.load();
432432
let packet = &CEntityVelocity::new(
433433
&entity_id,
434434
victem_velocity.x as f32,
435435
victem_velocity.y as f32,
436436
victem_velocity.z as f32,
437437
);
438438
let velocity = entity.velocity.load();
439-
victem_entity
439+
entity
440440
.velocity
441441
.store(velocity.multiply(0.6, 1.0, 0.6));
442442

pumpkin/src/world/player_chunker.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,6 @@ pub async fn update_position(player: &Player) {
112112
},
113113
|chunk_pos| {
114114
unloading_chunks.push(chunk_pos);
115-
// player
116-
// .client
117-
// .send_packet(&CUnloadChunk::new(chunk_pos.x, chunk_pos.z));
118115
},
119116
false,
120117
);
@@ -131,6 +128,7 @@ pub async fn update_position(player: &Player) {
131128
.world
132129
.mark_chunks_as_not_watched(&unloading_chunks)
133130
.await;
131+
// we may don't need to iter twice
134132
for chunk in unloading_chunks {
135133
if !player
136134
.client

0 commit comments

Comments
 (0)