Jump to content

Playsound() is inconsistent.


Recommended Posts

Okay, I know it sounds weird ( LOL ) but the playsound code line seems to ignore it's basic call sometimes.

Like I know it has been called, I know sometimes it works, but for some unforseen mystery reason it doesn't play the sound sometimes.
The code works fine, I even used message in the chat to confirm that the sound is supposed to play. But it just doesn't sometimes.
(What I mean is the chat tells me when the sound should play at the exact same time the message appear. BUT sometime the message goes but the sound does not.)
This bugs me, I though it would be a client or server problem... But I have absolutelly no Idea what's causing the playsound to just ignore it's function.

I suspect it's because there somewhat of a limit of sounds that can be emitted from one single entity ?
Because my goal was to make a custom damage sound based on how much damage a player takes. (it never plays) [I used the onEntityHurtEvent everything work except the playsound]
And a low health beeping noise... (in a loop, yet... sometimes it plays, sometimes it does not.) [But it seems like it cannot plays the sound if it is already playing. However, I've tried using a duplicaded sound track but NOPE it just won't let the sound play one right after another.]

I've tried putting the stream to false :
-No progress so far.
-No crashes either.
-All sounds are also correctly registererd.
-Using /Playsound commands works perfectly. (The sound works fine. The playsound in the mods code is inconsistent)

I really need the help from ya'll.

Link to comment
Share on other sites

21 hours ago, vemerion said:

You might have already done so, but if you haven't, then I recommend taking a look at the Forge Sounds Documentation. Among other things, it details which method to call based on if the code is run on the client/server/both sides.

Thank you for your awnser.
And yes I have...
I was very desperate so I tried for an entire day to see the problem.
But I couldnt... I even read about thread talking about beeing able to replace the damage sound... And apperently the playsound worked for them as they even tried to erase the classic hurt sound without soundpacks. I suspect it's because they were using an older version... I 'm on 1.12.2 Forge.
I wanna make sure that thoses sounds are client side only. (because they are like an optionnal GUI soundtrack)

Link to comment
Share on other sites

This topic is now closed to further replies.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.