diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/HighlightAreaMiniBoss.kt | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/HighlightAreaMiniBoss.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/HighlightAreaMiniBoss.kt index 66e6ceca3..385b895cb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/HighlightAreaMiniBoss.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/HighlightAreaMiniBoss.kt @@ -4,11 +4,15 @@ 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.EntityUtils.hasMaxHealth import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.entity.EntityLiving import net.minecraft.entity.monster.EntityBlaze import net.minecraft.entity.monster.EntityEnderman -import net.minecraft.entity.monster.EntityMob +import net.minecraft.entity.monster.EntitySpider +import net.minecraft.entity.monster.EntityZombie +import net.minecraft.entity.passive.EntityWolf import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class HighlightAreaMiniBoss { @@ -17,22 +21,27 @@ class HighlightAreaMiniBoss { fun onEntityHealthUpdate(event: EntityMaxHealthUpdateEvent) { if (!isEnabled()) return - for (bossType in AreaMiniBossType.values()) { - val clazz = bossType.clazz - val entity = event.entity + val entity = event.entity + val maxHealth = event.maxHealth - if (!clazz.isInstance(entity)) continue - if (event.maxHealth != bossType.health) continue + for (bossType in AreaMiniBossType.values()) { + if (!bossType.clazz.isInstance(entity)) continue - RenderLivingEntityHelper.setEntityColor(entity, bossType.color) - RenderLivingEntityHelper.setNoHurtTime(entity) + if (entity.hasMaxHealth(bossType.health, false, maxHealth)) { + 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) { + enum class AreaMiniBossType(val clazz: Class<out EntityLiving>, val health: Int, val color: Int) { + GOLDEN_GHOUL(EntityZombie::class.java, 45_000, LorenzColor.YELLOW.toColor().withAlpha(127)), +// OLD_WOLF(EntityWolf::class.java, 15_000, LorenzColor.RED.toColor().withAlpha(60)), + OLD_WOLF(EntityWolf::class.java, 15_000, LorenzColor.GOLD.toColor().withAlpha(60)), + KEEPER(EntitySpider::class.java, 3000, LorenzColor.GREEN.toColor().withAlpha(60)), 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)), ; |