Skip to content

Commit 5f665df

Browse files
committed
Don't stop previous sound
1 parent e9e8311 commit 5f665df

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

common/src/main/java/dev/terminalmc/clientsort/util/SoundUtil.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,13 @@
2222
import net.minecraft.client.resources.sounds.SoundInstance;
2323
import net.minecraft.resources.ResourceLocation;
2424
import net.minecraft.sounds.SoundSource;
25-
import org.jetbrains.annotations.Nullable;
2625

2726
import static dev.terminalmc.clientsort.config.Config.options;
2827

2928
public class SoundUtil {
3029
private static long time = Long.MIN_VALUE;
3130
private static float pitch = 1.0F;
3231
private static float increment = 0.01F;
33-
private static @Nullable SoundInstance sound;
3432

3533
public static void reset(int size) {
3634
increment = (options().soundMaxPitch - options().soundMinPitch) / size;
@@ -53,14 +51,10 @@ public static void play() {
5351
time = now + options().soundRate;
5452
ResourceLocation location = options().sortSoundLoc;
5553
if (location != null) {
56-
if (sound != null) {
57-
Minecraft.getInstance().getSoundManager().stop(sound);
58-
}
59-
sound = new SimpleSoundInstance(
54+
Minecraft.getInstance().getSoundManager().play(new SimpleSoundInstance(
6055
location, SoundSource.MASTER, options().soundVolume, soundPitch,
6156
SoundInstance.createUnseededRandom(), false, 0,
62-
SoundInstance.Attenuation.NONE, 0, 0, 0, true);
63-
Minecraft.getInstance().getSoundManager().play(sound);
57+
SoundInstance.Attenuation.NONE, 0, 0, 0, true));
6458
}
6559
}
6660
}

0 commit comments

Comments
 (0)