aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dulkirmod/mixins/MixinSoundManager.java
blob: f4e228f7df6168d3df2b9af4b9693e32384dfe05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package dulkirmod.mixins;

import dulkirmod.events.AlwaysPlaySoundEvent;
import net.minecraft.client.audio.ISound;
import net.minecraft.client.audio.SoundManager;
import net.minecraftforge.common.MinecraftForge;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(SoundManager.class)
public class MixinSoundManager {
    @Inject(at = @At("HEAD"), method = "playSound")
    public void onSound(ISound p_sound, CallbackInfo ci) {
        MinecraftForge.EVENT_BUS.post(new AlwaysPlaySoundEvent(p_sound, (SoundManager) (Object) this));
    }
}