mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 00:37:52 +00:00
91 lines
3.7 KiB
Diff
91 lines
3.7 KiB
Diff
--- ../src_base/minecraft/net/minecraft/src/SoundManager.java
|
|
+++ ../src_work/minecraft/net/minecraft/src/SoundManager.java
|
|
@@ -2,6 +2,18 @@
|
|
|
|
import java.io.File;
|
|
import java.util.Random;
|
|
+
|
|
+import net.minecraftforge.client.ForgeHooksClient;
|
|
+import net.minecraftforge.client.ModCompatibilityClient;
|
|
+import net.minecraftforge.client.event.sound.PlaySoundEffectEvent;
|
|
+import net.minecraftforge.client.event.sound.PlaySoundEvent;
|
|
+import net.minecraftforge.client.event.sound.PlayStreamingEvent;
|
|
+import net.minecraftforge.client.event.sound.SoundEvent;
|
|
+import net.minecraftforge.client.event.sound.PlayBackgroundMusicEvent;
|
|
+import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
|
+import net.minecraftforge.client.event.sound.SoundSetupEvent;
|
|
+import net.minecraftforge.common.MinecraftForge;
|
|
+import static net.minecraftforge.client.event.sound.SoundEvent.*;
|
|
import paulscode.sound.SoundSystem;
|
|
import paulscode.sound.SoundSystemConfig;
|
|
import paulscode.sound.codecs.CodecJOrbis;
|
|
@@ -37,9 +49,11 @@
|
|
private Random rand = new Random();
|
|
private int ticksBeforeMusic;
|
|
|
|
+ public static int MUSIC_INTERVAL = 12000;
|
|
+
|
|
public SoundManager()
|
|
{
|
|
- this.ticksBeforeMusic = this.rand.nextInt(12000);
|
|
+ this.ticksBeforeMusic = this.rand.nextInt(MUSIC_INTERVAL);
|
|
}
|
|
|
|
/**
|
|
@@ -54,6 +68,8 @@
|
|
{
|
|
this.tryToSetLibraryAndCodecs();
|
|
}
|
|
+ ModCompatibilityClient.audioModLoad(this);
|
|
+ MinecraftForge.EVENT_BUS.post(new SoundLoadEvent(this));
|
|
}
|
|
|
|
/**
|
|
@@ -73,6 +89,8 @@
|
|
SoundSystemConfig.setCodec("ogg", CodecJOrbis.class);
|
|
SoundSystemConfig.setCodec("mus", CodecMus.class);
|
|
SoundSystemConfig.setCodec("wav", CodecWav.class);
|
|
+ ModCompatibilityClient.audioModAddCodecs();
|
|
+ MinecraftForge.EVENT_BUS.post(new SoundSetupEvent(this));
|
|
sndSystem = new SoundSystem();
|
|
this.options.soundVolume = var1;
|
|
this.options.musicVolume = var2;
|
|
@@ -161,10 +179,12 @@
|
|
}
|
|
|
|
SoundPoolEntry var1 = this.soundPoolMusic.getRandomSound();
|
|
+ var1 = ModCompatibilityClient.audioModPickBackgroundMusic(this, var1);
|
|
+ var1 = SoundEvent.getResult(new PlayBackgroundMusicEvent(this, var1));
|
|
|
|
if (var1 != null)
|
|
{
|
|
- this.ticksBeforeMusic = this.rand.nextInt(12000) + 12000;
|
|
+ this.ticksBeforeMusic = this.rand.nextInt(MUSIC_INTERVAL) + MUSIC_INTERVAL;
|
|
sndSystem.backgroundMusic("BgMusic", var1.soundUrl, var1.soundName, false);
|
|
sndSystem.setVolume("BgMusic", this.options.musicVolume);
|
|
sndSystem.play("BgMusic");
|
|
@@ -214,6 +234,7 @@
|
|
if (par1Str != null)
|
|
{
|
|
SoundPoolEntry var8 = this.soundPoolStreaming.getRandomSoundFromSoundPool(par1Str);
|
|
+ var8 = SoundEvent.getResult(new PlayStreamingEvent(this, var8, par1Str, par2, par3, par4));
|
|
|
|
if (var8 != null && par5 > 0.0F)
|
|
{
|
|
@@ -239,6 +260,7 @@
|
|
if (loaded && this.options.soundVolume != 0.0F)
|
|
{
|
|
SoundPoolEntry var7 = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str);
|
|
+ var7 = SoundEvent.getResult(new PlaySoundEvent(this, var7, par1Str, par2, par3, par4, par5, par6));
|
|
|
|
if (var7 != null && par5 > 0.0F)
|
|
{
|
|
@@ -274,6 +296,7 @@
|
|
if (loaded && this.options.soundVolume != 0.0F)
|
|
{
|
|
SoundPoolEntry var4 = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str);
|
|
+ var4 = SoundEvent.getResult(new PlaySoundEffectEvent(this, var4, par1Str, par2, par3));
|
|
|
|
if (var4 != null)
|
|
{
|