mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-06-26 15:13:01 +00:00
Clamp the volume for all sounds, rather than just notes
This restores the previous behaviour.
This commit is contained in:
parent
0fc1b8c46b
commit
ac1f30ef43
@ -139,10 +139,7 @@ public class SpeakerPeripheral implements IPeripheral
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the resource location for note block notes changes, this method call will need to be updated
|
// If the resource location for note block notes changes, this method call will need to be updated
|
||||||
boolean success = playSound( context, noteName,
|
boolean success = playSound( context, noteName, volume, (float) Math.pow( 2.0, (pitch - 12.0) / 12.0 ), true );
|
||||||
Math.min( volume, 3f ),
|
|
||||||
(float) Math.pow( 2.0, (pitch - 12.0) / 12.0 ), true
|
|
||||||
);
|
|
||||||
|
|
||||||
if( success ) m_notesThisTick.incrementAndGet();
|
if( success ) m_notesThisTick.incrementAndGet();
|
||||||
return new Object[] { success };
|
return new Object[] { success };
|
||||||
@ -158,17 +155,18 @@ public class SpeakerPeripheral implements IPeripheral
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final World world = getWorld();
|
World world = getWorld();
|
||||||
final BlockPos pos = getPos();
|
BlockPos pos = getPos();
|
||||||
|
|
||||||
context.issueMainThreadTask( () -> {
|
context.issueMainThreadTask( () -> {
|
||||||
MinecraftServer server = world.getMinecraftServer();
|
MinecraftServer server = world.getMinecraftServer();
|
||||||
if( server == null ) return null;
|
if( server == null ) return null;
|
||||||
|
|
||||||
double x = pos.getX() + 0.5, y = pos.getY() + 0.5, z = pos.getZ() + 0.5;
|
double x = pos.getX() + 0.5, y = pos.getY() + 0.5, z = pos.getZ() + 0.5;
|
||||||
|
float adjVolume = Math.min( volume, 3.0f );
|
||||||
server.getPlayerList().sendToAllNearExcept(
|
server.getPlayerList().sendToAllNearExcept(
|
||||||
null, x, y, z, volume > 1.0f ? 16 * volume : 16.0, world.provider.getDimension(),
|
null, x, y, z, adjVolume > 1.0f ? 16 * adjVolume : 16.0, world.provider.getDimension(),
|
||||||
new SPacketCustomSound( name, SoundCategory.RECORDS, x, y, z, volume, pitch )
|
new SPacketCustomSound( name, SoundCategory.RECORDS, x, y, z, adjVolume, pitch )
|
||||||
);
|
);
|
||||||
return null;
|
return null;
|
||||||
} );
|
} );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user