Jump to content

How do I get the music that is playing?


ByRodrick

Recommended Posts

Hi! This is my first time creating a mod in Minecraft. It will be for personal use, and the goal is to play creepy/scary music at night. I want it to play without overlapping with Minecraft music (C418, etc.). I have almost finished it, but I don't know how to detect if Minecraft music is playing.

I tried accessing a "currentMusic" variable in the MusicManager class via reflection, but it doesn't work.
 

Class<?> musicManagerClass = musicManager.getClass();

java.lang.reflect.Field currentMusicField = musicManagerClass.getDeclaredField("currentMusic");

currentMusicField.setAccessible(true);

currentMusic = (SoundInstance) currentMusicField.get(musicManager);


Does anyone know how to do it?

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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