diff options
Diffstat (limited to 'src/main/java/com/ambientaddons/mixin/MixinBossStatus.java')
-rw-r--r-- | src/main/java/com/ambientaddons/mixin/MixinBossStatus.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main/java/com/ambientaddons/mixin/MixinBossStatus.java b/src/main/java/com/ambientaddons/mixin/MixinBossStatus.java new file mode 100644 index 0000000..9cf0a52 --- /dev/null +++ b/src/main/java/com/ambientaddons/mixin/MixinBossStatus.java @@ -0,0 +1,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(); + } + } +} |