aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/misc
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-02 20:38:55 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-02 20:38:55 +0100
commitee0ae23560e911fbec5e5262feaaa58dc5d52e7a (patch)
treeecd2221d199c8768aae9442c4c81922b0e0352f1 /src/main/java/at/hannibal2/skyhanni/features/misc
parent6173d681603839168db97e3fbd2cb74c2e7a2897 (diff)
downloadskyhanni-ee0ae23560e911fbec5e5262feaaa58dc5d52e7a.tar.gz
skyhanni-ee0ae23560e911fbec5e5262feaaa58dc5d52e7a.tar.bz2
skyhanni-ee0ae23560e911fbec5e5262feaaa58dc5d52e7a.zip
Created EntityMaxHealthUpdateEvent, started with better logic for colored mobs.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/HighlightAreaMiniBoss.kt40
2 files changed, 41 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt
index 0b4effca4..898a18b3d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt
@@ -24,7 +24,7 @@ class CorruptedMobHighlight {
val entity = event.entity
if (entity in corruptedMobs) return
- val baseMaxHealth = entity.baseMaxHealth.toFloat()
+ val baseMaxHealth = entity.baseMaxHealth
if (event.health == baseMaxHealth * 3) {
corruptedMobs.add(entity)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/HighlightAreaMiniBoss.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/HighlightAreaMiniBoss.kt
new file mode 100644
index 000000000..66e6ceca3
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/HighlightAreaMiniBoss.kt
@@ -0,0 +1,40 @@
+package at.hannibal2.skyhanni.features.misc
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.EntityMaxHealthUpdateEvent
+import at.hannibal2.skyhanni.events.withAlpha
+import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper
+import at.hannibal2.skyhanni.utils.LorenzColor
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import net.minecraft.entity.monster.EntityBlaze
+import net.minecraft.entity.monster.EntityEnderman
+import net.minecraft.entity.monster.EntityMob
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class HighlightAreaMiniBoss {
+
+ @SubscribeEvent
+ fun onEntityHealthUpdate(event: EntityMaxHealthUpdateEvent) {
+ if (!isEnabled()) return
+
+ for (bossType in AreaMiniBossType.values()) {
+ val clazz = bossType.clazz
+ val entity = event.entity
+
+ if (!clazz.isInstance(entity)) continue
+ if (event.maxHealth != bossType.health) continue
+
+ RenderLivingEntityHelper.setEntityColor(entity, bossType.color)
+ RenderLivingEntityHelper.setNoHurtTime(entity)
+ }
+ }
+
+ private fun isEnabled(): Boolean =
+ LorenzUtils.inSkyBlock && SkyHanniMod.feature.misc.highlightAreaMinisBoss
+
+ enum class AreaMiniBossType(val clazz: Class<out EntityMob>, val health: Int, val color: Int) {
+ ENDERMAN(EntityEnderman::class.java, 8_000_000, LorenzColor.LIGHT_PURPLE.toColor().withAlpha(127)),
+ BLAZE(EntityBlaze::class.java, 30_000_000, LorenzColor.DARK_RED.toColor().withAlpha(60)),
+ ;
+ }
+} \ No newline at end of file