Skip to content

Commit

Permalink
Fix elytra flying sound
Browse files Browse the repository at this point in the history
  • Loading branch information
OreCruncher committed Feb 5, 2024
1 parent 84abccd commit 8c54f39
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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());

Expand Down

0 comments on commit 8c54f39

Please sign in to comment.