From 38e6266d2e608f376833dc9bc0c1074bed24535b Mon Sep 17 00:00:00 2001 From: Appability Date: Sun, 30 Oct 2022 20:42:56 -0700 Subject: kuudra HP display features --- .../com/ambientaddons/mixin/MixinBossStatus.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/main/java/com/ambientaddons/mixin/MixinBossStatus.java (limited to 'src/main/java/com') 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(); + } + } +} -- cgit