Let other mods take precedence in changing the music system

This commit is contained in:
chylex authored and chylex committed 2016-01-06 12:00:31 +01:00
1 parent ab83926a54
commit 652fd13294
2 files changed
+11 -6

No files matched your search

@@ -1,8 +1,10 @@
package chylex.hee.sound;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.MusicTicker;
import net.minecraftforge.client.event.sound.SoundLoadEvent;
import net.minecraftforge.common.MinecraftForge;
import chylex.hee.system.logging.Log;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -20,16 +22,19 @@ public final class MusicManager{
private MusicManager(){}
@SubscribeEvent
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onSoundLoad(SoundLoadEvent e){
if (hasLoaded || (!enableCustomMusic && !removeVanillaDelay))return;
Minecraft mc = Minecraft.getMinecraft();
if (mc.mcMusicTicker != null){
mc.mcMusicTicker = CustomMusicTicker.setup(mc);
hasLoaded = true;
Log.debug("Successfully replaced MusicTicker.");
if (mc.mcMusicTicker.getClass() == MusicTicker.class){
mc.mcMusicTicker = CustomMusicTicker.setup(mc);
hasLoaded = true;
Log.debug("Successfully replaced MusicTicker.");
}
else Log.warn("Another mod has already replaced the music system: $0",mc.mcMusicTicker.getClass().getName());
}
}
}
@@ -80,8 +80,8 @@ public final class ConfigHandler{
if (firstTimeClient){
ModClientProxy.loadEnderbacon(getInt("hardcoreEnderbaconMode", 0, "0 = enabled on April Fools, 1 = always enabled, 2 = never enabled.").setShowInGui(false).getInt());
MusicManager.enableCustomMusic = getBool("enableMusic", true, "Custom music playing in the End dimension and custom Music Discs.").setRequiresMcRestart(true).getBoolean();
MusicManager.removeVanillaDelay = getBool("removeVanillaDelay", false, "Removes long delays between vanilla music tracks.").setRequiresMcRestart(true).getBoolean();
MusicManager.enableCustomMusic = getBool("enableMusic", true, "Custom music playing in the End dimension and custom Music Discs. If another mod that changes music is installed, HEE music will be disabled.").setRequiresMcRestart(true).getBoolean();
MusicManager.removeVanillaDelay = getBool("removeVanillaDelay", false, "Removes long delays between vanilla music tracks. If another mod that changes music is installed, the config option will be disabled.").setRequiresMcRestart(true).getBoolean();
firstTimeClient = false;
}