mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 14:24:35 +00:00
Sounds work! Also got tick handlers set up, still have to do a few things
This commit is contained in:
1 parent
815944c49a
commit
f0d3848f8a
8 files changed
+61
-46
No files matched your search
@@ -46,9 +46,6 @@ public class SoundHandler
|
||||
/** All the sound references in the Minecraft game. */
|
||||
public Map<Object, Sound> sounds = Collections.synchronizedMap(new HashMap<Object, Sound>());
|
||||
|
||||
/** The current base volume Minecraft is using. */
|
||||
public float masterVolume = 0;
|
||||
|
||||
public static Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
/**
|
||||
@@ -84,20 +81,6 @@ public class SoundHandler
|
||||
|
||||
Mekanism.logger.info("Preloaded " + listings.size() + " object sounds.");
|
||||
|
||||
/*listings = listFiles(corePath.replace("%20", " ").replace(".jar!", ".jar").replace("file:", ""), "assets/mekanism/sounds/etc");
|
||||
|
||||
for(String s : listings)
|
||||
{
|
||||
if(s.contains("/mekanism/sounds/etc/"))
|
||||
{
|
||||
s = s.split("/mekanism/sounds/etc/")[1];
|
||||
}
|
||||
|
||||
mc.sndManager.addSound("mekanism:etc/" + s);
|
||||
}
|
||||
|
||||
Mekanism.logger.info("Initialized " + listings.size() + " sound effects.");*/
|
||||
|
||||
if(MekanismClient.holidays)
|
||||
{
|
||||
listings = listFiles(corePath.replace("%20", " ").replace(".jar!", ".jar").replace("file:", ""), "assets/mekanism/sounds/holiday");
|
||||
@@ -223,8 +206,6 @@ public class SoundHandler
|
||||
sound.updateVolume();
|
||||
}
|
||||
}
|
||||
|
||||
masterVolume = FMLClientHandler.instance().getClient().gameSettings.getSoundLevel(SoundCategory.MASTER);
|
||||
}
|
||||
else {
|
||||
for(Sound sound : sounds.values())
|
||||
@@ -319,19 +300,41 @@ public class SoundHandler
|
||||
}
|
||||
|
||||
String s = getSoundSystem().quickPlay(false, url, soundPath, false, object.xCoord, object.yCoord, object.zCoord, 0, 16F);
|
||||
getSoundSystem().setVolume(s, masterVolume);
|
||||
getSoundSystem().setVolume(s, getMasterVolume());
|
||||
}
|
||||
|
||||
public float getMasterVolume()
|
||||
{
|
||||
return FMLClientHandler.instance().getClient().gameSettings.getSoundLevel(SoundCategory.MASTER);
|
||||
}
|
||||
|
||||
public static SoundSystem getSoundSystem()
|
||||
{
|
||||
try {
|
||||
SoundManager manager = (SoundManager)MekanismUtils.getPrivateValue(mc.getSoundHandler(), SoundManager.class, ObfuscatedNames.SoundHandler_sndManager);
|
||||
return (SoundSystem)MekanismUtils.getPrivateValue(manager, SoundSystem.class, ObfuscatedNames.SoundManager_sndSystem);
|
||||
return (SoundSystem)MekanismUtils.getPrivateValue(getSoundManager(), SoundManager.class, ObfuscatedNames.SoundManager_sndSystem);
|
||||
} catch(Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static SoundManager getSoundManager()
|
||||
{
|
||||
try {
|
||||
return (SoundManager)MekanismUtils.getPrivateValue(mc.getSoundHandler(), net.minecraft.client.audio.SoundHandler.class, ObfuscatedNames.SoundHandler_sndManager);
|
||||
} catch(Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSystemLoaded()
|
||||
{
|
||||
try {
|
||||
return (Boolean)MekanismUtils.getPrivateValue(getSoundManager(), net.minecraft.client.audio.SoundManager.class, new String[] {"loaded"});
|
||||
} catch(Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void playSound(String sound)
|
||||
{
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation(sound), 1.0F));
|
||||
|
||||
Reference in new issue
Block a user