generated from MrSphay/codex-agent-repository-kit
Decompile upstream Explosion Overhaul 0.2.3.0
This commit is contained in:
58
com/vinlanx/explosionoverhaul/mixin/ChannelLowpassMixin.java
Normal file
58
com/vinlanx/explosionoverhaul/mixin/ChannelLowpassMixin.java
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.vinlanx.explosionoverhaul.mixin;
|
||||
|
||||
import com.mojang.blaze3d.audio.Channel;
|
||||
import com.vinlanx.explosionoverhaul.client.LowPassConcussionEffect;
|
||||
import com.vinlanx.explosionoverhaul.client.SoundEngineAudioQueue;
|
||||
import com.vinlanx.explosionoverhaul.client.SoundPhysicsCompatibility;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(value={Channel.class})
|
||||
public class ChannelLowpassMixin {
|
||||
@Shadow
|
||||
@Final
|
||||
private int f_83642_;
|
||||
|
||||
@Inject(method={"play"}, at={@At(value="HEAD")})
|
||||
private void onPlay(CallbackInfo ci) {
|
||||
try {
|
||||
boolean active = LowPassConcussionEffect.isActive();
|
||||
if ("Sound engine".equals(Thread.currentThread().getName())) {
|
||||
SoundEngineAudioQueue.drainNow();
|
||||
}
|
||||
if (active) {
|
||||
SoundEngineAudioQueue.enqueueAudio(() -> LowPassConcussionEffect.attachFilterToSource(this.f_83642_));
|
||||
if ("Sound engine".equals(Thread.currentThread().getName())) {
|
||||
SoundEngineAudioQueue.drainNow();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
// empty catch block
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method={"stop"}, at={@At(value="HEAD")})
|
||||
private void onStop(CallbackInfo ci) {
|
||||
if (SoundPhysicsCompatibility.isCompatibilityEnabled()) {
|
||||
SoundPhysicsCompatibility.onSourceStop(this.f_83642_);
|
||||
}
|
||||
try {
|
||||
SoundEngineAudioQueue.enqueueAudio(() -> LowPassConcussionEffect.detachFilterFromSource(this.f_83642_));
|
||||
if ("Sound engine".equals(Thread.currentThread().getName())) {
|
||||
SoundEngineAudioQueue.drainNow();
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
// empty catch block
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user