diff --git a/server/block/sign.go b/server/block/sign.go index ef45b8722..e09fc992f 100644 --- a/server/block/sign.go +++ b/server/block/sign.go @@ -6,6 +6,7 @@ import ( "github.com/df-mc/dragonfly/server/item" "github.com/df-mc/dragonfly/server/world" "github.com/df-mc/dragonfly/server/world/particle" + "github.com/df-mc/dragonfly/server/world/sound" "github.com/go-gl/mathgl/mgl64" "image/color" "strings" @@ -119,10 +120,13 @@ func (s Sign) Wax(cube.Pos, mgl64.Vec3) (world.Block, bool) { } // Activate ... -func (s Sign) Activate(pos cube.Pos, _ cube.Face, _ *world.World, user item.User, _ *item.UseContext) bool { +func (s Sign) Activate(pos cube.Pos, _ cube.Face, w *world.World, user item.User, _ *item.UseContext) bool { if editor, ok := user.(SignEditor); ok && !s.Waxed { editor.OpenSign(pos, s.EditingFrontSide(pos, user.Position())) } + if s.Waxed { + w.PlaySound(pos.Vec3(), sound.WaxedInteractFail{}) + } return true } diff --git a/server/item/honeycomb.go b/server/item/honeycomb.go index e1f6bd2ff..dd7c97f5b 100644 --- a/server/item/honeycomb.go +++ b/server/item/honeycomb.go @@ -3,6 +3,7 @@ package item import ( "github.com/df-mc/dragonfly/server/block/cube" "github.com/df-mc/dragonfly/server/world" + "github.com/df-mc/dragonfly/server/world/sound" "github.com/go-gl/mathgl/mgl64" ) @@ -15,6 +16,7 @@ func (Honeycomb) UseOnBlock(pos cube.Pos, _ cube.Face, _ mgl64.Vec3, w *world.Wo if wa, ok := w.Block(pos).(waxable); ok { if res, ok := wa.Wax(pos, user.Position()); ok { w.SetBlock(pos, res, nil) + w.PlaySound(pos.Vec3(), sound.WaxOn{}) ctx.SubtractFromCount(1) return true } diff --git a/server/session/world.go b/server/session/world.go index 4624fb85d..124fb24c8 100644 --- a/server/session/world.go +++ b/server/session/world.go @@ -526,6 +526,13 @@ func (s *Session) playSound(pos mgl64.Vec3, t world.Sound, disableRelative bool) Position: vec64To32(pos), }) return + case sound.WaxOn: + s.writePacket(&packet.LevelEvent{ + EventType: packet.LevelEventWaxOn, + Position: vec64To32(pos), + }) + case sound.WaxedInteractFail: + pk.SoundType = packet.SoundEventWaxedSignInteractFail case sound.Pop: s.writePacket(&packet.LevelEvent{ EventType: packet.LevelEventSoundInfinityArrowPickup, diff --git a/server/world/sound/block.go b/server/world/sound/block.go index e735e3ec8..a4dfebd96 100644 --- a/server/world/sound/block.go +++ b/server/world/sound/block.go @@ -176,6 +176,12 @@ type ComposterReady struct{ sound } // LecternBookPlace is a sound played when a book is placed in a lectern. type LecternBookPlace struct{ sound } +// WaxOn is a sound played when a sign is waxed. +type WaxOn struct{ sound } + +// WaxedInteractFail is a sound played when a player tries to interact with a waxed sign. +type WaxedInteractFail struct{ sound } + // sound implements the world.Sound interface. type sound struct{}