generated from MrSphay/codex-agent-repository-kit
This commit is contained in:
@@ -1,66 +1,12 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.vinlanx.explosionoverhaul.client;
|
||||
|
||||
import com.vinlanx.explosionoverhaul.ModSounds;
|
||||
import com.vinlanx.explosionoverhaul.client.Blur;
|
||||
import com.vinlanx.explosionoverhaul.client.DeafnessConcussionEffect;
|
||||
import com.vinlanx.explosionoverhaul.client.FadingMusicInstance;
|
||||
import com.vinlanx.explosionoverhaul.client.LowPassConcussionEffect;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.sounds.SoundInstance;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
import net.neoforged.neoforge.event.TickEvent;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
|
||||
@OnlyIn(value=Dist.CLIENT)
|
||||
@EventBusSubscriber(modid="explosionoverhaul", value={Dist.CLIENT})
|
||||
public class ConcussionSoundManager {
|
||||
private static FadingMusicInstance currentLowSound = null;
|
||||
public static void startLowSound(float volume) {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onClientTick(TickEvent.ClientTickEvent event) {
|
||||
if (event.phase != TickEvent.Phase.END) {
|
||||
return;
|
||||
}
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (mc.f_91073_ == null || mc.player == null) {
|
||||
if (currentLowSound != null) {
|
||||
mc.m_91106_().m_120399_((SoundInstance)currentLowSound);
|
||||
currentLowSound = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (mc.m_91104_()) {
|
||||
return;
|
||||
}
|
||||
boolean deafness = DeafnessConcussionEffect.isActive();
|
||||
boolean lowpass = LowPassConcussionEffect.isActive();
|
||||
boolean blur = Blur.isActive();
|
||||
float targetVolume = 0.0f;
|
||||
if (blur) {
|
||||
if (deafness) {
|
||||
targetVolume = 1.0f;
|
||||
} else if (lowpass) {
|
||||
targetVolume = 0.4f;
|
||||
}
|
||||
}
|
||||
if (targetVolume > 0.0f) {
|
||||
if (currentLowSound == null || !mc.m_91106_().m_120403_((SoundInstance)currentLowSound)) {
|
||||
currentLowSound = new FadingMusicInstance((SoundEvent)ModSounds.LOW_SOUND.get(), 0.01f, SoundSource.MASTER);
|
||||
currentLowSound.fadeTo(targetVolume, 1.0f);
|
||||
mc.m_91106_().m_120367_((SoundInstance)currentLowSound);
|
||||
} else if (Math.abs(currentLowSound.getCurrentVolume() - targetVolume) > 0.01f && !currentLowSound.hasFinishedFading()) {
|
||||
currentLowSound.fadeTo(targetVolume, 0.5f);
|
||||
}
|
||||
} else if (currentLowSound != null && mc.m_91106_().m_120403_((SoundInstance)currentLowSound) && !currentLowSound.hasFinishedFading()) {
|
||||
currentLowSound.fadeOutAndStop(1.0f);
|
||||
}
|
||||
public static void stopLowSound() {
|
||||
}
|
||||
|
||||
public static void tick() {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user