generated from MrSphay/codex-agent-repository-kit
Decompile upstream Explosion Overhaul 0.2.3.0
This commit is contained in:
38
com/vinlanx/explosionoverhaul/ClientSoundHandler.java
Normal file
38
com/vinlanx/explosionoverhaul/ClientSoundHandler.java
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user