Merge pull request #121 from Draake/master-pr1
Added additional sound events to allow for low level information.
This commit is contained in:
commit
db6ac47689
4 changed files with 89 additions and 8 deletions
|
@ -0,0 +1,14 @@
|
|||
package net.minecraftforge.client.event.sound;
|
||||
|
||||
import net.minecraft.src.SoundManager;
|
||||
|
||||
public class PlaySoundEffectSourceEvent extends SoundEvent
|
||||
{
|
||||
public final SoundManager manager;
|
||||
public final String name;
|
||||
public PlaySoundEffectSourceEvent(SoundManager manager, String name)
|
||||
{
|
||||
this.manager = manager;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package net.minecraftforge.client.event.sound;
|
||||
|
||||
import net.minecraft.src.SoundManager;
|
||||
|
||||
public class PlaySoundSourceEvent extends SoundEvent
|
||||
{
|
||||
public final SoundManager manager;
|
||||
public final String name;
|
||||
public final float x;
|
||||
public final float y;
|
||||
public final float z;
|
||||
public PlaySoundSourceEvent(SoundManager manager, String name, float x, float y, float z)
|
||||
{
|
||||
this.manager = manager;
|
||||
this.name = name;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package net.minecraftforge.client.event.sound;
|
||||
|
||||
import net.minecraft.src.SoundManager;
|
||||
|
||||
public class PlayStreamingSourceEvent extends SoundEvent
|
||||
{
|
||||
public final SoundManager manager;
|
||||
public final String name;
|
||||
public final float x;
|
||||
public final float y;
|
||||
public final float z;
|
||||
public PlayStreamingSourceEvent(SoundManager manager, String name, float x, float y, float z)
|
||||
{
|
||||
this.manager = manager;
|
||||
this.name = name;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/SoundManager.java
|
||||
+++ ../src_work/minecraft/net/minecraft/src/SoundManager.java
|
||||
@@ -2,6 +2,18 @@
|
||||
@@ -2,6 +2,21 @@
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Random;
|
||||
|
@ -8,8 +8,11 @@
|
|||
+import net.minecraftforge.client.ForgeHooksClient;
|
||||
+import net.minecraftforge.client.ModCompatibilityClient;
|
||||
+import net.minecraftforge.client.event.sound.PlaySoundEffectEvent;
|
||||
+import net.minecraftforge.client.event.sound.PlaySoundEffectSourceEvent;
|
||||
+import net.minecraftforge.client.event.sound.PlaySoundEvent;
|
||||
+import net.minecraftforge.client.event.sound.PlaySoundSourceEvent;
|
||||
+import net.minecraftforge.client.event.sound.PlayStreamingEvent;
|
||||
+import net.minecraftforge.client.event.sound.PlayStreamingSourceEvent;
|
||||
+import net.minecraftforge.client.event.sound.SoundEvent;
|
||||
+import net.minecraftforge.client.event.sound.PlayBackgroundMusicEvent;
|
||||
+import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
||||
|
@ -19,7 +22,7 @@
|
|||
import paulscode.sound.SoundSystem;
|
||||
import paulscode.sound.SoundSystemConfig;
|
||||
import paulscode.sound.codecs.CodecJOrbis;
|
||||
@@ -37,9 +49,11 @@
|
||||
@@ -37,9 +52,11 @@
|
||||
private Random rand = new Random();
|
||||
private int ticksBeforeMusic;
|
||||
|
||||
|
@ -32,7 +35,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
@@ -54,6 +68,8 @@
|
||||
@@ -54,6 +71,8 @@
|
||||
{
|
||||
this.tryToSetLibraryAndCodecs();
|
||||
}
|
||||
|
@ -41,7 +44,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
@@ -73,6 +89,8 @@
|
||||
@@ -73,6 +92,8 @@
|
||||
SoundSystemConfig.setCodec("ogg", CodecJOrbis.class);
|
||||
SoundSystemConfig.setCodec("mus", CodecMus.class);
|
||||
SoundSystemConfig.setCodec("wav", CodecWav.class);
|
||||
|
@ -50,7 +53,7 @@
|
|||
sndSystem = new SoundSystem();
|
||||
this.options.soundVolume = var1;
|
||||
this.options.musicVolume = var2;
|
||||
@@ -161,10 +179,12 @@
|
||||
@@ -161,10 +182,12 @@
|
||||
}
|
||||
|
||||
SoundPoolEntry var1 = this.soundPoolMusic.getRandomSound();
|
||||
|
@ -64,7 +67,7 @@
|
|||
sndSystem.backgroundMusic("BgMusic", var1.soundUrl, var1.soundName, false);
|
||||
sndSystem.setVolume("BgMusic", this.options.musicVolume);
|
||||
sndSystem.play("BgMusic");
|
||||
@@ -214,6 +234,7 @@
|
||||
@@ -214,6 +237,7 @@
|
||||
if (par1Str != null)
|
||||
{
|
||||
SoundPoolEntry var8 = this.soundPoolStreaming.getRandomSoundFromSoundPool(par1Str);
|
||||
|
@ -72,7 +75,15 @@
|
|||
|
||||
if (var8 != null && par5 > 0.0F)
|
||||
{
|
||||
@@ -239,6 +260,7 @@
|
||||
@@ -225,6 +249,7 @@
|
||||
float var9 = 16.0F;
|
||||
sndSystem.newStreamingSource(true, var7, var8.soundUrl, var8.soundName, false, par2, par3, par4, 2, var9 * 4.0F);
|
||||
sndSystem.setVolume(var7, 0.5F * this.options.soundVolume);
|
||||
+ MinecraftForge.EVENT_BUS.post(new PlayStreamingSourceEvent(this, var7, par2, par3, par4));
|
||||
sndSystem.play(var7);
|
||||
}
|
||||
}
|
||||
@@ -239,6 +264,7 @@
|
||||
if (loaded && this.options.soundVolume != 0.0F)
|
||||
{
|
||||
SoundPoolEntry var7 = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str);
|
||||
|
@ -80,7 +91,15 @@
|
|||
|
||||
if (var7 != null && par5 > 0.0F)
|
||||
{
|
||||
@@ -274,6 +296,7 @@
|
||||
@@ -260,6 +286,7 @@
|
||||
}
|
||||
|
||||
sndSystem.setVolume(var8, par5 * this.options.soundVolume);
|
||||
+ MinecraftForge.EVENT_BUS.post(new PlaySoundSourceEvent(this, var8, par2, par3, par4));
|
||||
sndSystem.play(var8);
|
||||
}
|
||||
}
|
||||
@@ -274,6 +301,7 @@
|
||||
if (loaded && this.options.soundVolume != 0.0F)
|
||||
{
|
||||
SoundPoolEntry var4 = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str);
|
||||
|
@ -88,3 +107,11 @@
|
|||
|
||||
if (var4 != null)
|
||||
{
|
||||
@@ -289,6 +317,7 @@
|
||||
par2 *= 0.25F;
|
||||
sndSystem.setPitch(var5, par3);
|
||||
sndSystem.setVolume(var5, par2 * this.options.soundVolume);
|
||||
+ MinecraftForge.EVENT_BUS.post(new PlaySoundEffectSourceEvent(this, var5));
|
||||
sndSystem.play(var5);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue