quarry icon indicating copy to clipboard operation
quarry copied to clipboard

Sending sound packets, and teleporting to a different dimension

Open fizzrepo opened this issue 3 years ago • 2 comments

I want users to be able to select a dimension (so that they get the ambient sounds and the sky), but I want a ding sound to play when they teleport. What packet would this be?

fizzrepo avatar May 31 '21 07:05 fizzrepo

I don't understand this, can we get an advanced documentation on sending titles, tablists, bossbars etc?

fizzrepo avatar May 31 '21 09:05 fizzrepo

The Minecraft protocol documentation is located at wiki.vg/Protocol. You need the named_sound_effect packet. Here's roughly how you can use it for your purpose:

soundCategory = 8
x, y, z = self.position
volume = 1
pitch = 1

staticPart = (
  self.downstream.buff_type.pack_varint(soundCategory) +
  self.downstream.buff_type.pack("iii", round(x*8), round(y*8), round(z*8)) +
  self.downstream.buff_type.pack("ff", volume, pitch)
)

self.downstream.send_packet("named_sound_effect",
  self.downstream.buff_type.pack_string("block.bell.use") + staticPart )

self.downstream.send_packet("named_sound_effect",
  self.downstream.buff_type.pack_string("block.bell.resonate") + staticPart )

self.position must be updated for each upstream and downstream position packets

zax2002 avatar Jun 13 '21 05:06 zax2002