mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 11:54:59 -04:00
audio: check attenuation distance before playing/loading
* This fixes a lot of issues with sound spamming (e.g. on Cuberite servers)
This commit is contained in:
parent
668e3d27dc
commit
c5dfb63113
@ -184,6 +184,12 @@ class AudioPlayer(
|
||||
if (!profile.enabled) {
|
||||
return
|
||||
}
|
||||
position?.let {
|
||||
val distance = (this.listener.position - it).length()
|
||||
if (distance >= sound.attenuationDistance) {
|
||||
return
|
||||
}
|
||||
}
|
||||
queue += add@{
|
||||
sound.load(connection.assetsManager)
|
||||
val source = getAvailableSource()
|
||||
|
Loading…
x
Reference in New Issue
Block a user