diff options
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossFinder.kt | 3 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt | 27 |
2 files changed, 23 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossFinder.kt index 671ed8e21..2f151abf4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossFinder.kt @@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.utils.hasNameTagWith import net.minecraft.client.Minecraft import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraft.entity.Entity +import net.minecraft.entity.EntityLiving import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.boss.EntityDragon import net.minecraft.entity.boss.EntityWither @@ -266,6 +267,8 @@ class BossFinder { return EntityResult(bossType = BossType.SLAYER_ZOMBIE_5) } } + } + if (entity is EntityLiving) { if (entity.hasNameTagWith(2, "Dummy §a10M§c❤")) { return EntityResult(bossType = BossType.DUMMY) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt index 830c372e3..072661329 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt @@ -485,8 +485,10 @@ class DamageIndicatorManager { val damage = lastHealth - health val healing = health - lastHealth if (damage > 0) { - val damageCounter = entityData.damageCounter - damageCounter.currentDamage += damage + if (entityData.bossType != BossType.DUMMY) { + val damageCounter = entityData.damageCounter + damageCounter.currentDamage += damage + } } if (healing > 0) { //Hide auto heal every 10 ticks (with rounding errors) @@ -543,6 +545,8 @@ class DamageIndicatorManager { bossFinder?.handleNewEntity(event.entity) } + private val dummyDamageCache = mutableListOf<UUID>() + @SubscribeEvent(priority = EventPriority.HIGH) fun onRenderLiving(event: RenderLivingEvent.Specials.Pre<EntityLivingBase>) { val entity = event.entity @@ -556,13 +560,22 @@ class DamageIndicatorManager { entity.customNameTag = entity.customNameTag.replace(",", "") } - if (SkyHanniMod.feature.damageIndicator.hideDamageSplash) { - if (data.values.any { - val distance = it.entity.getLorenzVec().distance(entity.getLorenzVec()) - distance < 4.5 - }) { + val entityData = data.values.find { + val distance = it.entity.getLorenzVec().distance(entity.getLorenzVec()) + distance < 4.5 + } + if (entityData != null) { + if (SkyHanniMod.feature.damageIndicator.hideDamageSplash) { event.isCanceled = true } + if (entityData.bossType == BossType.DUMMY) { + + val uuid = entity.uniqueID + if (dummyDamageCache.contains(uuid)) return + dummyDamageCache.add(uuid) + val dmg = name.toCharArray().filter { Character.isDigit(it) }.joinToString("").toLong() + entityData.damageCounter.currentDamage += dmg + } } } }
\ No newline at end of file |