|
|
|
@ -2,15 +2,10 @@ use std::{collections::HashMap, sync::Mutex};
|
|
|
|
|
|
|
|
|
|
use once_cell::sync::Lazy;
|
|
|
|
|
use valence::{
|
|
|
|
|
entity::{axolotl::PlayingDead, living::Health, EntityId},
|
|
|
|
|
packet::WritePacket,
|
|
|
|
|
entity::{living::Health, EntityId},
|
|
|
|
|
prelude::{event::PlayerMove, *},
|
|
|
|
|
};
|
|
|
|
|
use valence_protocol::{
|
|
|
|
|
item::FoodComponent,
|
|
|
|
|
packet::s2c::play::{DamageTiltS2c, EntityAnimationS2c, EntityDamageS2c, HealthUpdateS2c},
|
|
|
|
|
var_int::VarInt,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static PLAYER_HEIGHT_HISTORY: Lazy<Mutex<HashMap<i32, f64>>> =
|
|
|
|
|
Lazy::new(|| Mutex::new(HashMap::new()));
|
|
|
|
@ -20,7 +15,7 @@ pub fn fall_damage(
|
|
|
|
|
mut events: EventReader<PlayerMove>,
|
|
|
|
|
) {
|
|
|
|
|
for event in events.iter() {
|
|
|
|
|
let (mut client, id, mut health, gamemode) = clients.get_mut(event.client).unwrap();
|
|
|
|
|
let (_client, id, mut health, gamemode) = clients.get_mut(event.client).unwrap();
|
|
|
|
|
|
|
|
|
|
if event.on_ground && *gamemode == GameMode::Survival {
|
|
|
|
|
let fall_distance = PLAYER_HEIGHT_HISTORY
|
|
|
|
|