Gugu42 Posted March 28, 2014 Posted March 28, 2014 Hello ! I basically want to play a sound after a player stayed in the GUI for 30 seconds. The timer works just fine, but the sound isn't played ... Here's my code : if (soundCooldown <= 10 * 20) { soundCooldown++; //System.out.println(soundCooldown); } if (soundCooldown >= 10 * 20) { System.out.println("Sound cooldown is at 600 now !"); soundCooldown = 0; Random random = new Random(); int randomInt = random.nextInt(2); if (randomInt == 1) { player.worldObj.playSoundAtEntity(player, "rcmod:VendorSalesman.vendor_speech1", 1.0F, 1.0F); System.out.println("Sound 1 played !"); } else { player.worldObj.playSoundAtEntity(player, "rcmod:VendorSalesman.vendor_speech4", 1.0F, 1.0F); System.out.println("Sound 4 played !"); } } It is in the updateScreen method, but it shouldn't be a problem, since this is basically an update method, so the function will be called regardless of its nature .. Quote
Gugu42 Posted March 28, 2014 Author Posted March 28, 2014 I checked it, didn't see a thing about sound ... ( There are two obfuscated method in it : public boolean func_82252_a() { return this.field_82253_i; } public void func_82251_b(int par1, int par2) {} ) Quote
Gugu42 Posted March 28, 2014 Author Posted March 28, 2014 Well, for me, nothing about sounds at all, yes : http://pastebin.com/Tr8vDPZ8 Quote
Gugu42 Posted March 28, 2014 Author Posted March 28, 2014 No problem, I tought it was something like that when I saw that I did not have the method. I tried it, doesn't look like it's working. Here's the whole code of my GUI class ( It is REALLY messy and not optimized, sorry ) http://pastebin.com/s05Kkduj ( Note : The console get the output ) Quote
Gugu42 Posted March 28, 2014 Author Posted March 28, 2014 Hm, the sound is in the sound/VendorSalesman, so I changed that, still not working. ( I tought the sound folder was automatically picked, and it was then subfolders etc... http://puu.sh/7MSxb.png for the folder etc... And, I registered the sound like this : http://puu.sh/7MSzL.png Quote
Gugu42 Posted March 28, 2014 Author Posted March 28, 2014 So I'll have to change the name ? Also, the sounds is a .wav file, I'll try to change the extension to check if it's that, and then the file name Quote
Gugu42 Posted March 28, 2014 Author Posted March 28, 2014 http://puu.sh/7MUZi.png It's working ! Thanks a lot ! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.