Posted March 28, 201411 yr 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 ..
March 28, 201411 yr Author 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) {} )
March 28, 201411 yr Author Well, for me, nothing about sounds at all, yes : http://pastebin.com/Tr8vDPZ8
March 28, 201411 yr Author 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 )
March 28, 201411 yr Author 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
March 28, 201411 yr Author 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
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.