aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/ambientaddons/mixin/MixinBossStatus.java
blob: 9cf0a52607b1ab2934a6cc0f33c900b9d669dd20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.ambientaddons.mixin;

import com.ambientaddons.events.BossStatusEvent;
import net.minecraft.entity.boss.BossStatus;
import net.minecraft.entity.boss.IBossDisplayData;
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(BossStatus.class)
public abstract class MixinBossStatus {

    @Inject(method = "setBossStatus", at = @At("HEAD"), cancellable = true)
    private static void onSetBossStatus(IBossDisplayData displayData, boolean hasColorModifierIn, CallbackInfo ci) {
        if (MinecraftForge.EVENT_BUS.post(new BossStatusEvent(displayData, hasColorModifierIn))) {
            ci.cancel();
        }
    }
}