quarry
quarry copied to clipboard
Sending sound packets, and teleporting to a different dimension
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?
I don't understand this, can we get an advanced documentation on sending titles, tablists, bossbars etc?
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