Started work on flamethrower sounds, also increased efficiency of SoundHandler (now loops over sounds only once instead of twice)

This commit is contained in:
Aidan C. Brady committed 2014-07-15 01:09:38 -04:00
1 parent f9fdb56e24
commit cdeb25803c
5 files changed
+102 -20

No files matched your search

@@ -181,29 +181,26 @@ public class SoundHandler
{
ArrayList<Sound> soundsToRemove = new ArrayList<Sound>();
World world = FMLClientHandler.instance().getClient().theWorld;
for(Sound sound : sounds.values())
if(FMLClientHandler.instance().getClient().thePlayer != null && world != null)
{
if(FMLClientHandler.instance().getClient().thePlayer != null && world != null)
for(Sound sound : sounds.values())
{
if(!sound.update(world))
{
soundsToRemove.add(sound);
continue;
}
if(sound.isPlaying)
{
sound.updateVolume();
}
}
}
for(Sound sound : soundsToRemove)
{
sound.remove();
}
for(Sound sound : sounds.values())
{
if(sound.isPlaying)
for(Sound sound : soundsToRemove)
{
sound.updateVolume();
sound.remove();
}
}
}