Skip to content

Commit

Permalink
new: hide dropper hurt sounds (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
MicrocontrollersDev committed Jun 5, 2023
1 parent 3b607f5 commit 6e76195
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/cc/woverflow/hytils/HytilsReborn.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import cc.woverflow.hytils.handlers.chat.modules.events.LevelupEvent;
import cc.woverflow.hytils.handlers.chat.modules.triggers.AutoQueue;
import cc.woverflow.hytils.handlers.chat.modules.triggers.SilentRemoval;
import cc.woverflow.hytils.handlers.game.dropper.DropperHurtSound;
import cc.woverflow.hytils.handlers.game.duels.SumoRenderDistance;
import cc.woverflow.hytils.handlers.game.hardcore.HardcoreStatus;
import cc.woverflow.hytils.handlers.game.housing.HousingMusic;
Expand Down Expand Up @@ -182,6 +183,7 @@ private void registerHandlers() {
eventBus.register(new SumoRenderDistance());
eventBus.register(new MiddleBeaconMiniWalls());
eventBus.register(new MiddleWaypointUHC());
eventBus.register(new DropperHurtSound());

// height overlay
EventManager.INSTANCE.register(HeightHandler.INSTANCE);
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/cc/woverflow/hytils/config/HytilsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,13 @@ public class HytilsConfig extends Config {
)
public static boolean hideDropperActionBar;

@Switch(
name = "Mute Hurt Sounds in Dropper",
description = "Mute the sounds of other players failing in Dropper.",
category = "Game", subcategory = "Dropper"
)
public static boolean muteDropperHurtSound;

@Switch(
name = "Lower Render Distance in Sumo",
description = "Lowers render distance to your desired value in Sumo Duels.",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Hytils Reborn - Hypixel focused Quality of Life mod.
* Copyright (C) 2020, 2021, 2022, 2023 Polyfrost, Sk1er LLC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package cc.woverflow.hytils.handlers.game.dropper;

import cc.polyfrost.oneconfig.utils.hypixel.HypixelUtils;
import cc.polyfrost.oneconfig.utils.hypixel.LocrawInfo;
import cc.polyfrost.oneconfig.utils.hypixel.LocrawUtil;
import cc.woverflow.hytils.config.HytilsConfig;
import net.minecraftforge.client.event.sound.PlaySoundEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

public class DropperHurtSound {

@SubscribeEvent
public void onSound(PlaySoundEvent event) {
LocrawInfo locraw = LocrawUtil.INSTANCE.getLocrawInfo();
if (HytilsConfig.muteDropperHurtSound && HypixelUtils.INSTANCE.isHypixel() && locraw != null && locraw.getGameMode().equalsIgnoreCase("dropper") && event.name.equals("game.player.hurt")) {
event.result = null;
}
}
}

0 comments on commit 6e76195

Please sign in to comment.