Skip to content

Commit

Permalink
fixup! wip! wobble
Browse files Browse the repository at this point in the history
  • Loading branch information
DaPigGuy committed Jan 7, 2025
1 parent 81a9109 commit 42286ae
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion server/block/decorated_pot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
}
Expand Down
7 changes: 6 additions & 1 deletion server/session/world.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 5 additions & 1 deletion server/world/sound/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit 42286ae

Please sign in to comment.