/* * Decompiled with CFR 0.152. */ package com.vinlanx.explosionoverhaul; import net.minecraftforge.client.event.sound.PlaySoundEvent; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.SubscribeEvent; public class ClientSoundHandler { private static boolean suppressVanillaExplosionSound = false; private static int suppressionTicksRemaining = 0; public static void setSuppressVanillaExplosionSound(boolean suppress, int durationTicks) { suppressVanillaExplosionSound = suppress; suppressionTicksRemaining = durationTicks; } @SubscribeEvent public void onClientTick(TickEvent.ClientTickEvent event) { if (event.phase == TickEvent.Phase.END) { if (suppressionTicksRemaining > 0) { --suppressionTicksRemaining; } else if (suppressionTicksRemaining == 0 && suppressVanillaExplosionSound) { suppressVanillaExplosionSound = false; } } } @SubscribeEvent(priority=EventPriority.HIGH) public void onExplosionSound(PlaySoundEvent event) { if (event.getSound() != null && event.getSound().m_7904_().m_135815_().equals("entity.generic.explode") && suppressVanillaExplosionSound) { event.setSound(null); } } }