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

Hey, i would like to play a background music on my mod

 

It works great with these following method:

this.mc.thePlayer.playSound("magiccrusade:luan_hong", 1, 1);
...
this.mc.theWorld.playSound(...)
this.mc.theWorld.playSoundAtEntity(...)
...

 

... but the sound is play only at the given location, and not "in background"

I don't find how to play "in background" (just like minecraft vanilla musics), does anyone has a solution?

 

I've also searched on LWJGL library but i can't make it work

 

Thank you (i hope my english wasn't too bad)

Hi

 

After rummaging through MusicTicker,  I think you might be able to achieve it using ISound.AttenuationType = NONE, see MovingSoundMinecartRiding constructor for a vanilla example, also PositionedSoundRecord

 

    public static PositionedSoundRecord func_147673_a(ResourceLocation p_147673_0_)
    {
        return new PositionedSoundRecord(p_147673_0_, 1.0F, 1.0F, false, 0, ISound.AttenuationType.NONE, 0.0F, 0.0F, 0.0F);
    }

 

-TGG

 

 

 

 

  • Author

Yes awesome! I've just searched in these classes and find this solution ^^

 

This code works great:

this.mc.getSoundHandler().playSound(PositionedSoundRecord.func_147673_a(new ResourceLocation("magiccrusade:luan_hong")));

 

Thank you!!

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.