package at.hannibal2.skyhanni.features.slayer import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.EntityMaxHealthUpdateEvent import at.hannibal2.skyhanni.events.withAlpha import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager 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.EntityCreature import net.minecraft.entity.monster.EntityBlaze import net.minecraft.entity.monster.EntityEnderman 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 HighlightSlayerMiniBoss { @SubscribeEvent fun onEntityHealthUpdate(event: EntityMaxHealthUpdateEvent) { if (!isEnabled()) return val entity = event.entity if (DamageIndicatorManager.isBoss(entity)) return val maxHealth = event.maxHealth for (bossType in SlayerMiniBossType.values()) { if (!bossType.clazz.isInstance(entity)) continue if (bossType.health.any { entity.hasMaxHealth(it, false, maxHealth) }) { RenderLivingEntityHelper.setEntityColor(entity, LorenzColor.AQUA.toColor().withAlpha(127)) { SkyHanniMod.feature.slayer.slayerMinibossHighlight } RenderLivingEntityHelper.setNoHurtTime(entity) { SkyHanniMod.feature.slayer.slayerMinibossHighlight } } } } private fun isEnabled() = LorenzUtils.inSkyBlock && SkyHanniMod.feature.slayer.slayerMinibossHighlight && !LorenzUtils.inDungeons && !LorenzUtils.inKuudraFight enum class SlayerMiniBossType(val clazz: Class, vararg val health: Int) { REVENANT(EntityZombie::class.java, 24_000, 90_000, 360_000, 600_000, 2_400_000), TARANTULA(EntitySpider::class.java, 54_000, 144_000, 576_000), SVEN(EntityWolf::class.java, 45_000, 120_000, 450_000), VOIDLING(EntityEnderman::class.java, 8_400_000, 17_500_000, 52_500_000), INFERNAL(EntityBlaze::class.java, 12_000_000, 25_000_000), ; } }