mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-14 09:46:53 -04:00
Mute looping sounds while game is paused.
This commit is contained in:
parent
f57163cd1b
commit
3867d3b778
@ -19,6 +19,8 @@ import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.audio.SoundCategory
|
||||
import net.minecraft.client.audio.SoundManager
|
||||
import net.minecraft.client.audio.SoundPoolEntry
|
||||
import net.minecraft.server.MinecraftServer
|
||||
import net.minecraft.server.integrated.IntegratedServer
|
||||
import net.minecraft.tileentity.TileEntity
|
||||
import net.minecraft.util.ResourceLocation
|
||||
import net.minecraftforge.client.event.sound.SoundLoadEvent
|
||||
@ -52,7 +54,9 @@ object Sound {
|
||||
def soundSystem: SoundSystem = ReflectionHelper.getPrivateValue(classOf[SoundManager], manager, "sndSystem", "field_148620_e", "e")
|
||||
|
||||
private def updateVolume() {
|
||||
val volume = FMLClientHandler.instance.getClient.gameSettings.getSoundLevel(SoundCategory.BLOCKS)
|
||||
val volume =
|
||||
if (isGamePaused) 0f
|
||||
else FMLClientHandler.instance.getClient.gameSettings.getSoundLevel(SoundCategory.BLOCKS)
|
||||
if (volume != lastVolume) {
|
||||
lastVolume = volume
|
||||
sources.synchronized {
|
||||
@ -63,6 +67,11 @@ object Sound {
|
||||
}
|
||||
}
|
||||
|
||||
private def isGamePaused = MinecraftServer.getServer != null && !MinecraftServer.getServer.isDedicatedServer && (MinecraftServer.getServer match {
|
||||
case integrated: IntegratedServer => Minecraft.getMinecraft.isGamePaused
|
||||
case _ => false
|
||||
})
|
||||
|
||||
private def processQueue() {
|
||||
if (commandQueue.nonEmpty) {
|
||||
commandQueue.synchronized {
|
||||
|
Loading…
x
Reference in New Issue
Block a user