mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-15 10:21:45 -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.SoundCategory
|
||||||
import net.minecraft.client.audio.SoundManager
|
import net.minecraft.client.audio.SoundManager
|
||||||
import net.minecraft.client.audio.SoundPoolEntry
|
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.tileentity.TileEntity
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import net.minecraftforge.client.event.sound.SoundLoadEvent
|
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")
|
def soundSystem: SoundSystem = ReflectionHelper.getPrivateValue(classOf[SoundManager], manager, "sndSystem", "field_148620_e", "e")
|
||||||
|
|
||||||
private def updateVolume() {
|
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) {
|
if (volume != lastVolume) {
|
||||||
lastVolume = volume
|
lastVolume = volume
|
||||||
sources.synchronized {
|
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() {
|
private def processQueue() {
|
||||||
if (commandQueue.nonEmpty) {
|
if (commandQueue.nonEmpty) {
|
||||||
commandQueue.synchronized {
|
commandQueue.synchronized {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user