From af07a78f7600c4e843018ac62cd6c7f146bb9269 Mon Sep 17 00:00:00 2001 From: Wojbie Date: Thu, 18 May 2017 23:12:55 +0200 Subject: [PATCH] Speaker rage limit Limit max volume of speaker to volume of normal noteblock. --- .../shared/peripheral/speaker/SpeakerPeripheral.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerPeripheral.java b/src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerPeripheral.java index 6ffc4c1b3..70779250e 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerPeripheral.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerPeripheral.java @@ -168,7 +168,7 @@ private synchronized Object[] playNote(Object[] arguments, ILuaContext context) } // If the resource location for note block notes changes, this method call will need to be updated - Object[] returnValue = playSound(new Object[] {"block.note." + arguments[0], volume, Math.pow(2d, (pitch - 12) / 12d)}, context, true); + Object[] returnValue = playSound(new Object[] {"block.note." + arguments[0], Math.min(volume,3f) , Math.pow(2d, (pitch - 12) / 12d)}, context, true); if (returnValue[0] instanceof Boolean && (Boolean) returnValue[0]) { @@ -238,7 +238,7 @@ private synchronized Object[] playSound(Object[] arguments, ILuaContext context, @Nullable @Override public Object[] execute() throws LuaException { - world.playSound( null, pos, SoundEvent.REGISTRY.getObject( resource ), SoundCategory.RECORDS, vol, soundPitch ); + world.playSound( null, pos, SoundEvent.REGISTRY.getObject( resource ), SoundCategory.RECORDS, Math.min(vol,3f), soundPitch ); return null; }