Jump to content

Recommended Posts

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)

Posted

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

 

 

 

 

Posted

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

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