2013-06-15 11:08:58 +00:00
|
|
|
package biomesoplenty.handlers;
|
|
|
|
|
|
|
|
import java.util.logging.Level;
|
|
|
|
|
2013-07-06 05:18:35 +00:00
|
|
|
import net.minecraftforge.client.event.sound.PlayStreamingEvent;
|
2013-06-16 00:30:58 +00:00
|
|
|
import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
|
|
|
import net.minecraftforge.event.ForgeSubscribe;
|
2013-07-06 05:18:35 +00:00
|
|
|
import cpw.mods.fml.client.FMLClientHandler;
|
2013-06-15 11:08:58 +00:00
|
|
|
import cpw.mods.fml.common.FMLCommonHandler;
|
2013-06-16 00:30:58 +00:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2013-06-15 11:08:58 +00:00
|
|
|
|
|
|
|
public class SoundHandler
|
|
|
|
{
|
2013-07-06 05:18:35 +00:00
|
|
|
static String[] recordSoundFiles = { "biomesoplenty:bopdisc.ogg", "biomesoplenty:bopdiscmud.ogg" };
|
2013-08-30 11:38:54 +00:00
|
|
|
static String[] soundFiles = { "biomesoplenty:mob/phantom/say.ogg", "biomesoplenty:mob/phantom/hurt.ogg", "biomesoplenty:mob/phantom/death.ogg" };
|
2013-06-15 11:08:58 +00:00
|
|
|
|
2013-06-16 00:30:58 +00:00
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
@ForgeSubscribe
|
|
|
|
public void onSoundLoad(SoundLoadEvent event)
|
2013-06-15 11:08:58 +00:00
|
|
|
{
|
2013-06-16 00:30:58 +00:00
|
|
|
for (String soundFile : soundFiles)
|
2013-06-15 11:08:58 +00:00
|
|
|
{
|
2013-06-16 00:30:58 +00:00
|
|
|
try
|
|
|
|
{
|
2013-07-02 03:57:49 +00:00
|
|
|
event.manager.soundPoolSounds.addSound(soundFile);
|
2013-06-16 00:30:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception e)
|
2013-06-15 11:08:58 +00:00
|
|
|
{
|
2013-06-16 00:30:58 +00:00
|
|
|
FMLCommonHandler.instance().getFMLLogger().log(Level.WARNING, "[BiomesOPlenty] Failed loading sound file: " + soundFile);
|
2013-06-15 11:08:58 +00:00
|
|
|
}
|
|
|
|
}
|
2013-06-16 00:30:58 +00:00
|
|
|
|
2013-07-06 05:18:35 +00:00
|
|
|
for (String recordSoundFile : recordSoundFiles)
|
2013-06-16 00:30:58 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2013-07-06 05:18:35 +00:00
|
|
|
event.manager.soundPoolStreaming.addSound(recordSoundFile);
|
2013-06-16 00:30:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
FMLCommonHandler.instance().getFMLLogger().log(Level.WARNING, "[BiomesOPlenty] Failed loading sound file: " + recordSoundFile);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-07-06 05:18:35 +00:00
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
@ForgeSubscribe
|
|
|
|
public void onPlayStreaming(PlayStreamingEvent event)
|
|
|
|
{
|
|
|
|
if (event.name == "bopdisc")
|
|
|
|
{
|
|
|
|
FMLClientHandler.instance().getClient().sndManager.playStreaming("biomesoplenty:bopdisc", (float) event.x + 0.5F, (float) event.y + 0.5F, (float) event.z + 0.5F);
|
|
|
|
}
|
|
|
|
else if (event.name == "bopdiscmud")
|
|
|
|
{
|
|
|
|
FMLClientHandler.instance().getClient().sndManager.playStreaming("biomesoplenty:bopdiscmud", (float) event.x + 0.5F, (float) event.y + 0.5F, (float) event.z + 0.5F);
|
|
|
|
}
|
|
|
|
}
|
2013-06-15 11:08:58 +00:00
|
|
|
}
|