Jump to content

Recommended Posts

Posted

Hello guys may i ask if my code is write about custom background music in custom in custom dimension . Id try many time to check but i never succeeded hopefully someone might help me with thes

heres my SoundLoader class

 

public class MHFSoundEvents 

{
 private final ArrayList<Object> music = Lists.newArrayList();  

@ForgeSubscribe
public void onSound(SoundLoadEvent event) {
// You add them the same way as you add blocks.
event.manager.addSound("monsterhunter:kirin/say1.ogg");
event.manager.addSound("monsterhunter:kirin/say2.ogg");
event.manager.addSound("monsterhunter:kirin/hurt1.ogg");


// Music Theme

}
public void onSoundLoadEvent(SoundLoadEvent event, URL URL) {
        music.add(new SoundPoolEntry("monsterhunter:MHFMainTheme1.ogg", URL)); // URL can be anything: point to a file, point to something in your classpath, etc.
        music.add(new SoundPoolEntry("monsterhunter:MHFMainTheme2.ogg", URL)); // URL can be anything: point to a file, point to something in your classpath, etc.
        music.add(new SoundPoolEntry("monsterhunter:MHFMainTheme3.ogg", URL)); // URL can be anything: point to a file, point to something in your classpath, etc.
    }

public void onBackgroundMusic(PlayBackgroundMusicEvent event, Random rand)
{
	Minecraft mc = Minecraft.getMinecraft();
        if (mc.thePlayer.dimension == 3) {
            event.result = (SoundPoolEntry) music.get(rand.nextInt(music.size()));
        }
    }
    




 

Posted

Don't be impatient mate, europeans are still at work while americans are waking up now :P

A few hours and there will be more activity and your thread will be responded too if anyone has a proper answer :)

If you guys dont get it.. then well ya.. try harder...

Posted

public void onSoundLoadEvent(SoundLoadEvent event, URL URL)
...
public void onBackgroundMusic(PlayBackgroundMusicEvent event, Random rand)

Do you call those methods yourself ?

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.