You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's trying to get the registered object. However, this doesn't work for mod sounds—it always throws this error message. (I know you haven't updated GitHub with the latest versions of Ding, but it's still pretty much the same)
I tried having Ding re-create the sound reference whenever it needs to play it, and it seems to do the trick. Here's how it works:
SoundEvent recreate = new SoundEvent(new ResourceLocation("mymod:mysound"));
Minecraft.getInstance().getSoundHandler().play(SimpleSound.master(recreate, 1));
Obviously you'd have to change that up to work with the Ding config file, but from my testing this fixes the problem I outlined above.
Here's a gist of Ding.java for the 1.15.2 with my changes.
Edit after some more testing
Alright, I've done some more digging around. It looks like Ding only has this problem when the sounds are registered using Events, as described here. When using DeferredRegister (seen here), it works fine. I guess the problem was sorta on my end, after all.
For anyone else who has trouble with this, here's an example of how you register using DeferredRegister (at least in 1.15).
I think it would be good for you to add something about this to the mod page on CurseForge so others don't have to figure it out like I did! I love the mod.
The text was updated successfully, but these errors were encountered:
TheNathanSpace
changed the title
Ding is unable to access registered sounds in other mods
Ding is unable to access sounds from other mods when those mods register them using RegistryEvent
Nov 9, 2020
I've been trying to get Ding to play a sound from a mod I'm making. However, I keep getting the error
Could not find sound: mymod:mysound
.I've done some digging around, and I figured out the problem.
Here's how Ding currently gets and plays the sounds:
It's trying to get the registered object. However, this doesn't work for mod sounds—it always throws this error message. (I know you haven't updated GitHub with the latest versions of Ding, but it's still pretty much the same)
I tried having Ding re-create the sound reference whenever it needs to play it, and it seems to do the trick. Here's how it works:
Obviously you'd have to change that up to work with the Ding config file, but from my testing this fixes the problem I outlined above.
Here's a gist of
Ding.java
for the 1.15.2 with my changes.Edit after some more testing
Alright, I've done some more digging around. It looks like Ding only has this problem when the sounds are registered using
Events
, as described here. When usingDeferredRegister
(seen here), it works fine. I guess the problem was sorta on my end, after all.For anyone else who has trouble with this, here's an example of how you register using DeferredRegister (at least in 1.15).
I think it would be good for you to add something about this to the mod page on CurseForge so others don't have to figure it out like I did! I love the mod.
The text was updated successfully, but these errors were encountered: