diff --git a/lib/plugins/sound.js b/lib/plugins/sound.js index df9979152..659bf7fa3 100644 --- a/lib/plugins/sound.js +++ b/lib/plugins/sound.js @@ -4,6 +4,7 @@ module.exports = inject function inject (bot) { bot._client.on('named_sound_effect', (packet) => { + console.log('named_sound_effect event triggered') const soundName = packet.soundName const pt = new Vec3(packet.x / 8, packet.y / 8, packet.z / 8) const volume = packet.volume @@ -13,6 +14,7 @@ function inject (bot) { }) bot._client.on('sound_effect', (packet) => { + console.log('sound_effect event triggered') const soundId = packet.soundId const soundCategory = packet.soundCategory const pt = new Vec3(packet.x / 8, packet.y / 8, packet.z / 8) diff --git a/test/externalTests/soundEffect.js b/test/externalTests/soundEffect.js new file mode 100644 index 000000000..174738c82 --- /dev/null +++ b/test/externalTests/soundEffect.js @@ -0,0 +1,20 @@ +const assert = require('assert') +const { once } = require('../../lib/promise_utils') + +module.exports = () => async (bot) => { + bot.on('soundEffectHeard', (soundName, position, volume, pitch) => { + console.log(`soundEffectHeard: ${soundName}`) + }) + + bot.on('hardcodedSoundEffectHeard', (soundId, soundCategory, position, volume, pitch) => { + console.log(`hardcodedSoundEffectHeard: ${soundId}`) + }) + + bot.test.sayEverywhere('/playsound minecraft:entity.zombie.ambient neutral @a') + await bot.test.wait(1000) + + bot.test.sayEverywhere('/playsound 0 neutral @a') + await bot.test.wait(1000) + + assert.ok(true) +}