Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

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

 

)

  • 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 )

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

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.