From 8c54f397f808d24fc16601ec28658c3f7ca7b3ac Mon Sep 17 00:00:00 2001 From: OreCruncher Date: Mon, 5 Feb 2024 06:14:17 -0800 Subject: [PATCH] Fix elytra flying sound --- .../orecruncher/dsurround/sound/SoundInstanceHandler.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/org/orecruncher/dsurround/sound/SoundInstanceHandler.java b/src/main/java/org/orecruncher/dsurround/sound/SoundInstanceHandler.java index 0367f963..b3caca84 100644 --- a/src/main/java/org/orecruncher/dsurround/sound/SoundInstanceHandler.java +++ b/src/main/java/org/orecruncher/dsurround/sound/SoundInstanceHandler.java @@ -1,6 +1,7 @@ package org.orecruncher.dsurround.sound; import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; +import net.minecraft.client.resources.sounds.ElytraOnPlayerSoundInstance; import net.minecraft.client.resources.sounds.SoundInstance; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundSource; @@ -104,6 +105,11 @@ public static boolean inRange(final Vec3 listener, final SoundInstance sound, fi if (sound.isRelative() || sound.getAttenuation() == SoundInstance.Attenuation.NONE || sound.getSource() == SoundSource.WEATHER) return true; + // Do not cancel if it is the elytra flying sound. Due to the derpy implementation, the location of the + // sound is at Origin after construction. Could mixin the class to correct, but this is safer. + if (sound instanceof ElytraOnPlayerSoundInstance) + return true; + // Make sure a sound is assigned so that the volume check can work sound.resolve(GameUtils.getSoundManager());