[Bug]: Mod's music events don't allow sound event listeners to track them
GizmoTheMoonPig opened this issue ยท 2 comments
Minecraft Version
1.20.1
Mod Version
4.0.1
Mod Loader
Forge
Mod Loader Version
47.1.3
Describe the bug
Hello! I'm the owner of the Music Manager mod. While trying to add support for toasts to appear while this mod's music tracks were playing, I noticed the sounds weren't even being recognized by my SoundEventListener
. I took a peek into your code to look into this (sorry!) and discovered a couple things wrong with your sound loops.
-
the sound loops use
SoundSource.RECORDS
instead ofSoundSource.MUSIC
. Since these tracks are music tracks and not music disc tracks, they should be in the MUSIC source. This will allow mine and other mods' sound event listeners to properly find them. -
the
SoundInstance
itself isn't recognizable. This one isn't necessarily your fault, it's just thatSoundInstance
s need 1 of 3 things changed in them to be listenable:- set the sound's attenuation to
NONE
instead ofLINEAR
(most recommended one) - set the sound's
relative
field totrue
- give the sound a high attenuation distance, or properly set its origin
- set the sound's attenuation to
(note: blue skies had a similar issue with their sounds: see https://gitlab.com/modding-legacy/blue-skies/-/issues/157 if you need a better explanation on this part!)
Thanks for hearing me out! Hope this can get fixed sometime soon, I'd love to show the tracks for this mod when Music Manager is installed!
Steps to Reproduce
N/A, as this is a code-level issue and isnt normally noticeable
Crash Reports/Logs
No response
Is OptiFine installed?
- OptiFine is installed
Screenhots
No response
Mod List
NONE
Should be fixed in the next available update, let me know if that works for you when it comes out