diff --git a/Cargo.toml b/Cargo.toml index 1e40aed69..d48b915a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ debug = true [workspace.dependencies] log = "0.4" -tokio = { version = "1.42", features = [ +tokio = { version = "1.43", features = [ "macros", "net", "rt-multi-thread", @@ -50,7 +50,7 @@ rayon = "1.10.0" parking_lot = { version = "0.12.3", features = ["send_guard"] } crossbeam = "0.8.4" -uuid = { version = "1.11.0", features = ["serde", "v3", "v4"] } +uuid = { version = "1.12.1", features = ["serde", "v3", "v4"] } derive_more = { version = "1.0.0", features = ["full"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/pumpkin-registry/Cargo.toml b/pumpkin-registry/Cargo.toml index c63200dd0..ca74857a4 100644 --- a/pumpkin-registry/Cargo.toml +++ b/pumpkin-registry/Cargo.toml @@ -8,7 +8,7 @@ pumpkin-protocol = { path = "../pumpkin-protocol" } pumpkin-nbt = { path = "../pumpkin-nbt" } pumpkin-util = { path = "../pumpkin-util" } -indexmap = { version = "2.7.0", features = ["serde"] } +indexmap = { version = "2.7.1", features = ["serde"] } serde.workspace = true serde_json.workspace = true diff --git a/pumpkin-world/Cargo.toml b/pumpkin-world/Cargo.toml index e92a82d08..235771f98 100644 --- a/pumpkin-world/Cargo.toml +++ b/pumpkin-world/Cargo.toml @@ -27,10 +27,10 @@ num-traits = "0.2" # Compression flate2 = "1.0" -lz4 = "1.28.0" +lz4 = "1.28.1" file-guard = "0.2.0" -indexmap = "2.7.0" +indexmap = "2.7.1" enum_dispatch = "0.3.13" diff --git a/pumpkin/Cargo.toml b/pumpkin/Cargo.toml index d11c703af..4856e4d1a 100644 --- a/pumpkin/Cargo.toml +++ b/pumpkin/Cargo.toml @@ -68,7 +68,7 @@ sha2 = "0.10.8" base64 = "0.22.1" # icon loading -png = "0.17.15" +png = "0.17.16" # logging simple_logger = { version = "5.0.0", features = ["threads"] } @@ -78,10 +78,10 @@ time = "0.3.37" chrono = { version = "0.4.39", features = ["serde"]} # commands -async-trait = "0.1.83" +async-trait = "0.1.85" # plugins -libloading = "0.8.5" +libloading = "0.8.6" [build-dependencies] git-version = "0.3.9" # This makes it so the entire project doesn't recompile on each build on linux. diff --git a/pumpkin/src/entity/living.rs b/pumpkin/src/entity/living.rs index bad7946b1..794d3ea52 100644 --- a/pumpkin/src/entity/living.rs +++ b/pumpkin/src/entity/living.rs @@ -2,6 +2,7 @@ use std::sync::atomic::AtomicI32; use async_trait::async_trait; use crossbeam::atomic::AtomicCell; +use pumpkin_data::sound::Sound; use pumpkin_nbt::tag::NbtTag; use pumpkin_protocol::client::play::{CDamageEvent, CEntityStatus, CSetEntityMetadata, Metadata}; use pumpkin_util::math::vector3::Vector3; @@ -135,6 +136,10 @@ impl LivingEntity { return; } + self.entity + .play_sound(Self::get_fall_sound(fall_distance as i32)) + .await; + // TODO: Play block fall sound self.damage(damage, 10).await; // Fall } else if y_diff < 0.0 { self.fall_distance.store(0.0); @@ -144,6 +149,14 @@ impl LivingEntity { } } + fn get_fall_sound(distance: i32) -> Sound { + if distance > 4 { + Sound::EntityGenericBigFall + } else { + Sound::EntityGenericSmallFall + } + } + /// Kills the Entity /// /// This is similar to `kill` but Spawn Particles, Animation and plays death sound diff --git a/pumpkin/src/entity/mod.rs b/pumpkin/src/entity/mod.rs index 9b155bea4..c1d38ab49 100644 --- a/pumpkin/src/entity/mod.rs +++ b/pumpkin/src/entity/mod.rs @@ -3,7 +3,10 @@ use std::sync::{atomic::AtomicBool, Arc}; use async_trait::async_trait; use crossbeam::atomic::AtomicCell; -use pumpkin_data::entity::{EntityPose, EntityType}; +use pumpkin_data::{ + entity::{EntityPose, EntityType}, + sound::{Sound, SoundCategory}, +}; use pumpkin_nbt::{compound::NbtCompound, tag::NbtTag}; use pumpkin_protocol::{ client::play::{ @@ -296,6 +299,13 @@ impl Entity { self.world.broadcast_packet_all(&packet).await; } + /// Plays sound at this entity's position with the entity's sound category + pub async fn play_sound(&self, sound: Sound) { + self.world + .play_sound(sound, SoundCategory::Neutral, &self.pos.load()) + .await; + } + pub async fn set_pose(&self, pose: EntityPose) { self.pose.store(pose); let pose = pose as i32;