Jump to content

Recommended Posts

Posted

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 ..

Posted

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) {}

 

)

Posted

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 )

Posted

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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