Skip to content

Commit 5351554

Browse files
committed
chore: release version 1.5.1
fix: add sound enabled checks to playSound
1 parent 8f4fdb2 commit 5351554

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ExtraSounds Next - Changelog
22

3-
## [1.5.0] - Upcoming
3+
## [1.5.0]
44

55
**New Features**
66
- Added sound support for popular mods:
@@ -14,4 +14,8 @@
1414

1515
**Technical Changes**
1616
- Migrated to Stonecutter architecture for better multi-version support
17-
---
17+
18+
## [1.5.1]
19+
20+
**Fixes**
21+
- Sound switches not working properly

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ org.gradle.configuration-cache=false
55
mod.id=extrasounds
66
mod.name=ExtraSounds Next
77
mod.group=dev.arbor
8-
mod.version=1.5.0
8+
mod.version=1.5.1
99
mod.channel_tag=
1010
mod.authors=Arborsm, stashymane
1111
mod.contributors=

src/main/java/dev/arbor/extrasoundsnext/sounds/SoundManager.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,10 @@ public static void playSound(SoundEvent snd, SoundType type, Mixers... optionalV
290290
}
291291

292292
public static void playSound(SoundEvent snd, float pitch, Mixers... optionalVolumes) {
293+
if (!shouldPlaySound(snd)) {
294+
return;
295+
}
296+
293297
float volume = getSoundVolume(Mixers.MASTER);
294298
if (optionalVolumes != null) {
295299
for (Mixers cat : optionalVolumes) {
@@ -336,6 +340,10 @@ public static void playSound(SoundEvent snd, SoundType type, float volume, float
336340
}
337341

338342
public static void playSound(SoundEvent snd, SoundType type, float volume, float pitch, BlockPos position, boolean anti, Mixers... optionalVolumes) {
343+
if (!shouldPlaySound(snd)) {
344+
return;
345+
}
346+
339347
volume *= getSoundVolume(Mixers.MASTER) * getSoundVolume(type);
340348
if (optionalVolumes != null) {
341349
for (Mixers cat : optionalVolumes) {
@@ -447,4 +455,22 @@ public static float getSoundVolume(Mixers category, boolean... anti) {
447455
return volume;
448456
}
449457
*///?}
458+
459+
/**
460+
* Checks if a sound should be played based on the enabled/disabled state in config.
461+
* This is a unified helper method to ensure all sound playback paths respect user settings.
462+
*
463+
* @param event The sound event to check
464+
* @return true if the sound should be played, false if it's disabled
465+
*/
466+
private static boolean shouldPlaySound(SoundEvent event) {
467+
if (event == null) {
468+
return true; // Allow null sounds to pass through (fallback behavior)
469+
}
470+
SoundEntry entry = SoundEntry.fromSoundEvent(event);
471+
if (entry == null) {
472+
return true; // Sound not in our registry, allow it
473+
}
474+
return VolumeConfig.isSoundEnabled(entry);
475+
}
450476
}

0 commit comments

Comments
 (0)