From 42286aec8add3d57632e6924dfc448f0babc90e6 Mon Sep 17 00:00:00 2001 From: DaPigGuy Date: Mon, 6 Jan 2025 20:43:51 -0800 Subject: [PATCH] fixup! wip! wobble --- server/block/decorated_pot.go | 2 +- server/session/world.go | 7 ++++++- server/world/sound/block.go | 6 +++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/server/block/decorated_pot.go b/server/block/decorated_pot.go index 13be891f1..5f73b6b36 100644 --- a/server/block/decorated_pot.go +++ b/server/block/decorated_pot.go @@ -76,7 +76,7 @@ func (p DecoratedPot) wobble(pos cube.Pos, tx *world.Tx, success bool) { if success { tx.AddParticle(pos.Vec3Middle().Add(mgl64.Vec3{0, 1.25}), particle.DustPlume{}) - tx.PlaySound(pos.Vec3Centre(), sound.DecoratedPotInserted{}) + tx.PlaySound(pos.Vec3Centre(), sound.DecoratedPotInserted{Progress: float64(p.Item.Count()) / float64(p.Item.MaxCount())}) } else { tx.PlaySound(pos.Vec3Centre(), sound.DecoratedPotInsertFailed{}) } diff --git a/server/session/world.go b/server/session/world.go index 410dec61c..de2cc0878 100644 --- a/server/session/world.go +++ b/server/session/world.go @@ -816,7 +816,12 @@ func (s *Session) playSound(pos mgl64.Vec3, t world.Sound, disableRelative bool) Position: vec64To32(pos), }) case sound.DecoratedPotInserted: - pk.SoundType = packet.SoundEventDecoratedPotInsert + s.writePacket(&packet.PlaySound{ + SoundName: "block.decorated_pot.insert", + Position: vec64To32(pos), + Volume: 1, + Pitch: 0.7 + 0.5*float32(so.Progress), + }) case sound.DecoratedPotInsertFailed: pk.SoundType = packet.SoundEventDecoratedPotInsertFail } diff --git a/server/world/sound/block.go b/server/world/sound/block.go index 62bd17498..e87c2b7ab 100644 --- a/server/world/sound/block.go +++ b/server/world/sound/block.go @@ -201,7 +201,11 @@ type WaxRemoved struct{ sound } type CopperScraped struct{ sound } // DecoratedPotInserted is a sound played when an item is successfully inserted into a decorated pot. -type DecoratedPotInserted struct{ sound } +type DecoratedPotInserted struct { + sound + // Progress is how much of the decorated pot has been filled. + Progress float64 +} // DecoratedPotInsertFailed is a sound played when an item fails to be inserted into a decorated pot. type DecoratedPotInsertFailed struct{ sound }