More work - SoundHandler now uses a channel-based system for sounds.

This commit is contained in:
Aidan C. Brady committed 2014-07-16 17:07:54 -04:00
1 parent be7ea115b6
commit 4309a7d7b1
3 files changed
+38 -16

No files matched your search

@@ -47,6 +47,11 @@ public class SoundHandler
public Map<Object, SoundMap> soundMaps = Collections.synchronizedMap(new HashMap<Object, SoundMap>());
public static Minecraft mc = Minecraft.getMinecraft();
public static final String CHANNEL_TILE_DEFAULT = "tile";
public static final String CHANNEL_JETPACK = "jetpack";
public static final String CHANNEL_GASMASK = "gasMask";
public static final String CHANNEL_FLAMETHROWER = "flamethrower";
/**
* SoundHandler -- a class that handles all Sounds used by Mekanism.
@@ -254,14 +259,14 @@ public class SoundHandler
}
}
public Sound getSound(Object obj, String path)
public Sound getSound(Object obj, String channel)
{
if(soundMaps.get(obj) == null)
{
return null;
}
return soundMaps.get(obj).getSound(path);
return soundMaps.get(obj).getSound(channel);
}
/**
@@ -295,11 +300,23 @@ public class SoundHandler
{
synchronized(soundMaps)
{
String toReturn = "Mekanism_" + soundMaps.size() + "_" + new Random().nextInt(10000);
String toReturn = "Mekanism_" + getActiveSize() + "_" + new Random().nextInt(10000);
return toReturn;
}
}
public int getActiveSize()
{
int count = 0;
for(SoundMap map : soundMaps.values())
{
count += map.size();
}
return count;
}
/**
* Plays a sound in a specific location.