sound-blocker module

sound-blocker: Minecraft 26.3 cheat module, full source for every implementation (1 client: Meteor Client).

1 implementationMisc

Clients with this module

Full module source: 1 implementation

Every implementation below is the complete module file, verbatim. Expand a client to read its code.

Meteor ClientMiscsrc/main/java/meteordevelopment/meteorclient/systems/modules/misc/SoundBlocker.javaJava · 48 lines · 1.7 KB

Cancels out selected sounds.

Settingssounds
SoundBlocker.javaJava · Minecraft 26.2 · 48 lines · 1.7 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
3
 * Copyright (c) Meteor Development.
4
 */
5
6
package meteordevelopment.meteorclient.systems.modules.misc;
7
8
import meteordevelopment.meteorclient.events.world.PlaySoundEvent;
9
import meteordevelopment.meteorclient.settings.Setting;
10
import meteordevelopment.meteorclient.settings.SettingGroup;
11
import meteordevelopment.meteorclient.settings.SoundEventListSetting;
12
import meteordevelopment.meteorclient.systems.modules.Categories;
13
import meteordevelopment.meteorclient.systems.modules.Module;
14
import meteordevelopment.orbit.EventHandler;
15
import net.minecraft.client.resources.sounds.SoundInstance;
16
import net.minecraft.core.registries.BuiltInRegistries;
17
import net.minecraft.sounds.SoundEvent;
18
19
import java.util.List;
20
21
public class SoundBlocker extends Module {
22
    private final SettingGroup sgGeneral = settings.getDefaultGroup();
23
24
    private final Setting<List<SoundEvent>> sounds = sgGeneral.add(new SoundEventListSetting.Builder()
25
        .name("sounds")
26
        .description("Sounds to block.")
27
        .build()
28
    );
29
30
    public SoundBlocker() {
31
        super(Categories.Misc, "sound-blocker", "Cancels out selected sounds.");
32
    }
33
34
    @EventHandler
35
    private void onPlaySound(PlaySoundEvent event) {
36
        for (SoundEvent sound : sounds.get()) {
37
            if (sound.location().equals(event.sound.getIdentifier())) {
38
                event.cancel();
39
                break;
40
            }
41
        }
42
    }
43
44
    public boolean shouldBlock(SoundInstance soundInstance) {
45
        return isActive() && sounds.get().contains(Setting.parseId(BuiltInRegistries.SOUND_EVENT, soundInstance.getIdentifier().getPath()));
46
    }
47
}
48