@@ -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