aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/SummoningMobManager.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt52
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/EntityData.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt137
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniboss.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt33
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt11
8 files changed, 106 insertions, 151 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/SummoningMobManager.kt b/src/main/java/at/hannibal2/skyhanni/features/SummoningMobManager.kt
index 99cd8615f..0d272771d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/SummoningMobManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/SummoningMobManager.kt
@@ -127,8 +127,8 @@ class SummoningMobManager {
continue
}
- val maxHealth = entityLiving.baseMaxHealth.toInt()
- val color = NumberUtil.percentageColor(currentHealth, maxHealth).getChatColor()
+ val maxHealth = entityLiving.baseMaxHealth
+ val color = NumberUtil.percentageColor(currentHealth.toLong(), maxHealth.toLong()).getChatColor()
val currentFormat = NumberUtil.format(currentHealth)
val maxFormat = NumberUtil.format(maxHealth)
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 a6fff41ca..e9ccc363b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
@@ -36,7 +36,7 @@ class DamageIndicatorManager {
private var mobFinder: MobFinder? = null
private val decimalFormat = DecimalFormat("0.0")
- private val maxHealth = mutableMapOf<UUID, Int>()
+ private val maxHealth = mutableMapOf<UUID, Long>()
companion object {
private var data = mutableMapOf<UUID, EntityData>()
@@ -229,11 +229,11 @@ class DamageIndicatorManager {
checkFinalBoss(entityData.finalDungeonBoss, entity.entityId)
}
- val health = entity.health.toInt()
- val maxHealth: Int
+ val health = entity.health.toLong()
+ val maxHealth: Long
val biggestHealth = getMaxHealthFor(entity)
- if (biggestHealth == 0) {
- val currentMaxHealth = entity.baseMaxHealth.toInt()
+ if (biggestHealth == 0L) {
+ val currentMaxHealth = entity.baseMaxHealth.toLong()
maxHealth = max(currentMaxHealth, health)
setMaxHealth(entity, maxHealth)
} else {
@@ -242,7 +242,7 @@ class DamageIndicatorManager {
entityData.namePrefix = ""
entityData.nameSuffix = ""
- val customHealthText = if (health == 0) {
+ val customHealthText = if (health == 0L) {
entityData.dead = true
"§cDead"
} else {
@@ -273,9 +273,9 @@ class DamageIndicatorManager {
private fun getCustomHealth(
entityData: EntityData,
- health: Int,
+ health: Long,
entity: EntityLivingBase,
- maxHealth: Int,
+ maxHealth: Long,
): String? {
if (entityData.bossType == BossType.DUNGEON_F4_THORN) {
return checkThorn(health)
@@ -287,13 +287,13 @@ class DamageIndicatorManager {
entityData.bossType == BossType.SLAYER_ENDERMAN_4
) {
if (entity is EntityEnderman) {
- return checkEnderSlayer(entity, entityData, health, maxHealth)
+ return checkEnderSlayer(entity, entityData, health.toInt(), maxHealth.toInt())
}
}
if (entityData.bossType == BossType.NETHER_MAGMA_BOSS) {
if (entity is EntityMagmaCube) {
- return checkMagmaCube(entity, entityData, health, maxHealth)
+ return checkMagmaCube(entity, entityData, health.toInt(), maxHealth.toInt())
}
}
@@ -337,7 +337,7 @@ class DamageIndicatorManager {
18 -> "§e4/6"
16 -> "§e5/6"
else -> {
- val color = NumberUtil.percentageColor(health, 10_000_000)
+ val color = NumberUtil.percentageColor(health.toLong(), 10_000_000)
entityData.namePrefix = "§a6/6"
return color.getChatColor() + NumberUtil.format(health)
}
@@ -373,7 +373,7 @@ class DamageIndicatorManager {
}
if (calcHealth == -1) return null
- val color = NumberUtil.percentageColor(calcHealth, maxHealth)
+ val color = NumberUtil.percentageColor(calcHealth.toLong(), maxHealth.toLong())
return color.getChatColor() + NumberUtil.format(calcHealth)
}
@@ -432,7 +432,7 @@ class DamageIndicatorManager {
else -> return null
}
val result =
- NumberUtil.percentageColor(calcHealth, calcMaxHealth).getChatColor() + NumberUtil.format(calcHealth)
+ NumberUtil.percentageColor(calcHealth.toLong(), calcMaxHealth.toLong()).getChatColor() + NumberUtil.format(calcHealth)
//Hit phase
@@ -447,7 +447,7 @@ class DamageIndicatorManager {
}
val name = armorStandHits.name.removeColor()
val hits = name.between("Seraph ", " Hit").toInt()
- return NumberUtil.percentageColor(hits, maxHits).getChatColor() + "$hits Hits"
+ return NumberUtil.percentageColor(hits.toLong(), maxHits.toLong()).getChatColor() + "$hits Hits"
}
//Laser phase
@@ -467,11 +467,11 @@ class DamageIndicatorManager {
return result
}
- private fun checkThorn(realHealth: Int): String? {
+ private fun checkThorn(realHealth: Long): String? {
val maxHealth: Int
val health = if (DungeonData.isOneOf("F4")) {
maxHealth = 4
- when (realHealth) {
+ when (realHealth.toInt()) {
300_000, 600_000 -> 4
222_000, 444_000 -> 3
144_000, 288_000 -> 2
@@ -480,11 +480,7 @@ class DamageIndicatorManager {
else -> {
LorenzUtils.error(
"Unexpected health of thorn in f4! (${
- LorenzUtils.formatDouble(
- LorenzUtils.formatDouble(
- realHealth.toDouble()
- ).toDouble()
- )
+ LorenzUtils.formatDouble(realHealth.toDouble())
})"
)
return null
@@ -492,7 +488,7 @@ class DamageIndicatorManager {
}
} else if (DungeonData.isOneOf("M4")) {
maxHealth = 6
- when (realHealth) {
+ when (realHealth.toInt()) {
//TODO test all non derpy values!
1_800_000 / 2, 1_800_000 -> 6
1_494_000 / 2, 1_494_000 -> 5
@@ -519,11 +515,11 @@ class DamageIndicatorManager {
LorenzUtils.error("Invalid thorn floor!")
return null
}
- val color = NumberUtil.percentageColor(health, maxHealth)
+ val color = NumberUtil.percentageColor(health.toLong(), maxHealth.toLong())
return color.getChatColor() + health + "/" + maxHealth
}
- private fun checkDamage(entityData: EntityData, health: Int, lastHealth: Int, bossType: BossType) {
+ private fun checkDamage(entityData: EntityData, health: Long, lastHealth: Long, bossType: BossType) {
val damage = lastHealth - health
val healing = health - lastHealth
if (damage > 0) {
@@ -534,7 +530,7 @@ class DamageIndicatorManager {
}
if (healing > 0) {
//Hide auto heal every 10 ticks (with rounding errors)
- if ((healing == 15_000 || healing == 15_001) && bossType == BossType.SLAYER_ZOMBIE_5) return
+ if ((healing == 15_000L || healing == 15_001L) && bossType == BossType.SLAYER_ZOMBIE_5) return
val damageCounter = entityData.damageCounter
damageCounter.currentHealing += healing
@@ -560,12 +556,12 @@ class DamageIndicatorManager {
}
}
- private fun setMaxHealth(entity: EntityLivingBase, currentMaxHealth: Int) {
+ private fun setMaxHealth(entity: EntityLivingBase, currentMaxHealth: Long) {
maxHealth[entity.uniqueID!!] = currentMaxHealth
}
- private fun getMaxHealthFor(entity: EntityLivingBase): Int {
- return maxHealth.getOrDefault(entity.uniqueID!!, 0)
+ private fun getMaxHealthFor(entity: EntityLivingBase): Long {
+ return maxHealth.getOrDefault(entity.uniqueID!!, 0L)
}
@SubscribeEvent
diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/EntityData.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/EntityData.kt
index f2483aae9..7271daf33 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/EntityData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/EntityData.kt
@@ -11,7 +11,7 @@ class EntityData(
val bossType: BossType,
val damageCounter: DamageCounter = DamageCounter(),
- var lastHealth: Int = 0,
+ var lastHealth: Long = 0L,
var healthText: String = "",
var timeLastTick: Long = 0,
// var healthLineHidden: Boolean = false,
diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt
index 65c6d4e1b..cefac9a25 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt
@@ -1,9 +1,9 @@
package at.hannibal2.skyhanni.features.damageindicator
import at.hannibal2.skyhanni.features.dungeon.DungeonData
+import at.hannibal2.skyhanni.utils.EntityUtils.hasMaxHealth
import at.hannibal2.skyhanni.utils.EntityUtils.hasNameTagWith
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth
import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.getLorenzVec
@@ -154,11 +154,12 @@ class MobFinder {
if (DungeonData.isOneOf("F4", "M4")) {
if (entity is EntityGhast) {
- return EntityResult(bossType = BossType.DUNGEON_F4_THORN,
+ return EntityResult(
+ bossType = BossType.DUNGEON_F4_THORN,
ignoreBlocks = true,
- finalDungeonBoss = true)
+ finalDungeonBoss = true
+ )
}
-
}
if (DungeonData.isOneOf("F5", "M5")) {
@@ -186,15 +187,10 @@ class MobFinder {
}
} else {
- val maxHealth = entity.baseMaxHealth.toInt()
if (entity is EntityBlaze) {
if (entity.name != "Dinnerbone") {
if (entity.hasNameTagWith(2, "§e﴾ §8[§7Lv200§8] §l§8§lAshfang§r ")) {
- if (maxHealth == 50_000_000) {
- return EntityResult(bossType = BossType.NETHER_ASHFANG)
- }
- //Derpy
- if (maxHealth == 100_000_000) {
+ if (entity.hasMaxHealth(50_000_000)) {
return EntityResult(bossType = BossType.NETHER_ASHFANG)
}
}
@@ -220,19 +216,11 @@ class MobFinder {
}
if (entity is EntityEnderman) {
if (entity.hasNameTagWith(3, "§c☠ §bVoidgloom Seraph ")) {
- when (maxHealth) {
- 300_000, 600_000 -> {
- return EntityResult(bossType = BossType.SLAYER_ENDERMAN_1)
- }
- 12_000_000, 24_000_000 -> {
- return EntityResult(bossType = BossType.SLAYER_ENDERMAN_2)
- }
- 50_000_000, 100_000_000 -> {
- return EntityResult(bossType = BossType.SLAYER_ENDERMAN_3)
- }
- 210_000_000, 420_000_000 -> {
- return EntityResult(bossType = BossType.SLAYER_ENDERMAN_4)
- }
+ when {
+ entity.hasMaxHealth(300_000) -> return EntityResult(bossType = BossType.SLAYER_ENDERMAN_1)
+ entity.hasMaxHealth(12_000_000) -> return EntityResult(bossType = BossType.SLAYER_ENDERMAN_2)
+ entity.hasMaxHealth(50_000_000) -> return EntityResult(bossType = BossType.SLAYER_ENDERMAN_3)
+ entity.hasMaxHealth(210_000_000) -> return EntityResult(bossType = BossType.SLAYER_ENDERMAN_4)
}
}
}
@@ -247,23 +235,15 @@ class MobFinder {
}
if (entity is EntityZombie) {
if (entity.hasNameTagWith(2, "§c☠ §bRevenant Horror")) {
- when (maxHealth) {
- 500, 1_000 -> {
- return EntityResult(bossType = BossType.SLAYER_ZOMBIE_1)
- }
- 20_000, 40_000 -> {
- return EntityResult(bossType = BossType.SLAYER_ZOMBIE_2)
- }
- 400_000, 800_000 -> {
- return EntityResult(bossType = BossType.SLAYER_ZOMBIE_3)
- }
- 1_500_000, 3_000_000 -> {
- return EntityResult(bossType = BossType.SLAYER_ZOMBIE_4)
- }
+ when {
+ entity.hasMaxHealth(500) -> return EntityResult(bossType = BossType.SLAYER_ZOMBIE_1)
+ entity.hasMaxHealth(20_000) -> return EntityResult(bossType = BossType.SLAYER_ZOMBIE_2)
+ entity.hasMaxHealth(400_000) -> return EntityResult(bossType = BossType.SLAYER_ZOMBIE_3)
+ entity.hasMaxHealth(1_500_000) -> return EntityResult(bossType = BossType.SLAYER_ZOMBIE_4)
}
}
if (entity.hasNameTagWith(2, "§c☠ §fAtoned Horror ")) {
- if (maxHealth == 10_000_000 || maxHealth == 20_000_000) {
+ if (entity.hasMaxHealth(10_000_000)) {
return EntityResult(bossType = BossType.SLAYER_ZOMBIE_5)
}
}
@@ -275,30 +255,22 @@ class MobFinder {
}
if (entity is EntityMagmaCube) {
if (entity.hasNameTagWith(15, "§e﴾ §8[§7Lv500§8] §l§4§lMagma Boss§r ")) {
- if (maxHealth == 200_000_000) {
- return EntityResult(bossType = BossType.NETHER_MAGMA_BOSS, ignoreBlocks = true)
- }
- //Derpy
- if (maxHealth == 400_000_000) {
+ if (entity.hasMaxHealth(200_000_000)) {
return EntityResult(bossType = BossType.NETHER_MAGMA_BOSS, ignoreBlocks = true)
}
}
}
if (entity is EntityHorse) {
if (entity.hasNameTagWith(15, "§8[§7Lv100§8] §c§6Headless Horseman§r ")) {
- if (maxHealth == 3_000_000) {
- return EntityResult(bossType = BossType.HUB_HEADLESS_HORSEMAN)
- }
- //Derpy
- if (maxHealth == 6_000_000) {
+ if (entity.hasMaxHealth(3_000_000)) {
return EntityResult(bossType = BossType.HUB_HEADLESS_HORSEMAN)
}
}
}
if (entity is EntityBlaze) {
if (entity.hasNameTagWith(2, "§c☠ §bInferno Demonlord ")) {
- when (maxHealth) {
- 2_500_000, 5_000_000 -> {
+ when {
+ entity.hasMaxHealth(2_500_000) -> {
return EntityResult(bossType = BossType.SLAYER_BLAZE_1)
}
}
@@ -306,53 +278,31 @@ class MobFinder {
}
if (entity is EntitySpider) {
if (entity.hasNameTagWith(1, "§5☠ §4Tarantula Broodfather ")) {
- when (maxHealth) {
- 740, 1_500 -> {
- return EntityResult(bossType = BossType.SLAYER_SPIDER_1)
- }
- 30_000, 60_000 -> {
- return EntityResult(bossType = BossType.SLAYER_SPIDER_2)
- }
- 900_000, 1_800_000 -> {
- return EntityResult(bossType = BossType.SLAYER_SPIDER_3)
- }
- 2_400_000, 4_800_000 -> {
- return EntityResult(bossType = BossType.SLAYER_SPIDER_4)
- }
+ when {
+ entity.hasMaxHealth(740) -> return EntityResult(bossType = BossType.SLAYER_SPIDER_1)
+ entity.hasMaxHealth(30_000) -> return EntityResult(bossType = BossType.SLAYER_SPIDER_2)
+ entity.hasMaxHealth(900_000) -> return EntityResult(bossType = BossType.SLAYER_SPIDER_3)
+ entity.hasMaxHealth(2_400_000) -> return EntityResult(bossType = BossType.SLAYER_SPIDER_4)
}
}
}
if (entity is EntityWolf) {
if (entity.hasNameTagWith(1, "§c☠ §fSven Packmaster ")) {
- when (maxHealth) {
- 2_000, 4_000 -> {
- return EntityResult(bossType = BossType.SLAYER_WOLF_1)
- }
- 40_000, 80_000 -> {
- return EntityResult(bossType = BossType.SLAYER_WOLF_2)
- }
- 750_000, 1_500_000 -> {
- return EntityResult(bossType = BossType.SLAYER_WOLF_3)
- }
- 2_000_000, 4_000_000 -> {
- return EntityResult(bossType = BossType.SLAYER_WOLF_4)
- }
+ when {
+ entity.hasMaxHealth(2_000) -> return EntityResult(bossType = BossType.SLAYER_WOLF_1)
+ entity.hasMaxHealth(40_000) -> return EntityResult(bossType = BossType.SLAYER_WOLF_2)
+ entity.hasMaxHealth(750_000) -> return EntityResult(bossType = BossType.SLAYER_WOLF_3)
+ entity.hasMaxHealth(2_000_000) -> return EntityResult(bossType = BossType.SLAYER_WOLF_4)
}
}
}
if (entity is EntityOtherPlayerMP) {
- if (entity.name == "Minos Inquisitor") {
- return EntityResult(bossType = BossType.MINOS_INQUISITOR)
- }
- if (entity.name == "Minos Champion") {
- return EntityResult(bossType = BossType.MINOS_CHAMPION)
- }
- if (entity.name == "Minotaur ") {
- return EntityResult(bossType = BossType.MINOTAUR)
- }
+ if (entity.name == "Minos Inquisitor") return EntityResult(bossType = BossType.MINOS_INQUISITOR)
+ if (entity.name == "Minos Champion") return EntityResult(bossType = BossType.MINOS_CHAMPION)
+ if (entity.name == "Minotaur ") return EntityResult(bossType = BossType.MINOTAUR)
}
if (entity is EntityIronGolem) {
- if (entity.baseMaxHealth % 1_500_000 == 0.0) {
+ if (entity.hasMaxHealth(1_500_000)) {
return EntityResult(bossType = BossType.GAIA_CONSTURUCT)
}
}
@@ -519,26 +469,13 @@ class MobFinder {
for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) {
if (entity is EntityGuardian) {
-
- val maxHealth = entity.baseMaxHealth.toInt()
-
//F3
- if (maxHealth == 1_000_000 || maxHealth == 1_200_000) {
- guardians.add(entity)
- }
-
- //F3 Derpy
- if (maxHealth == 2_000_000 || maxHealth == 2_400_000) {
+ if (entity.hasMaxHealth(1_000_000) || entity.hasMaxHealth(1_200_000)) {
guardians.add(entity)
}
//M3
- if (maxHealth == 240_000_000 || maxHealth == 280_000_000) {
- guardians.add(entity)
- }
-
- //M3 Derpy
- if (maxHealth == 120_000_000 || maxHealth == 140_000_000) {
+ if (entity.hasMaxHealth(120_000_000) || entity.hasMaxHealth(240_000_000)) {
guardians.add(entity)
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt b/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt
index f2dcaed89..7e5f95f64 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt
@@ -4,9 +4,9 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.RenderMobColoredEvent
import at.hannibal2.skyhanni.events.ResetEntityHurtEvent
import at.hannibal2.skyhanni.events.withAlpha
+import at.hannibal2.skyhanni.utils.EntityUtils.hasMaxHealth
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth
import net.minecraft.client.Minecraft
import net.minecraft.entity.monster.EntityEnderman
import net.minecraftforge.event.world.WorldEvent
@@ -54,7 +54,7 @@ class VoidlingExtremistColor {
private fun find() {
Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance<EntityEnderman>()
- .filter { it !in extremists && it.baseMaxHealth % 8_000_000 == 0.0 }.forEach { extremists.add(it) }
+ .filter { it !in extremists && it.hasMaxHealth(8_000_000) }.forEach { extremists.add(it) }
}
private fun isEnabled(): Boolean {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniboss.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniboss.kt
index e2fb2719a..faff3885a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniboss.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniboss.kt
@@ -5,9 +5,9 @@ import at.hannibal2.skyhanni.events.RenderMobColoredEvent
import at.hannibal2.skyhanni.events.ResetEntityHurtEvent
import at.hannibal2.skyhanni.events.withAlpha
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
+import at.hannibal2.skyhanni.utils.EntityUtils.hasMaxHealth
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth
import net.minecraft.client.Minecraft
import net.minecraft.entity.Entity
import net.minecraft.entity.EntityLivingBase
@@ -39,23 +39,23 @@ class HighlightSlayerMiniboss {
val list = mutableListOf<EntityLivingBase>()
list.addAll(entityList.filterIsInstance<EntityZombie>().filter {
- it.baseMaxHealth % 24_000 == 0.0 || it.baseMaxHealth % 90_000 == 0.0 || it.baseMaxHealth % 360_000 == 0.0 || it.baseMaxHealth % 600_000 == 0.0 || it.baseMaxHealth % 2_400_000 == 0.0
+ it.hasMaxHealth(24_000) || it.hasMaxHealth(90_000) || it.hasMaxHealth(360_000) || it.hasMaxHealth(600_000) || it.hasMaxHealth(2_400_000)
})
list.addAll(entityList.filterIsInstance<EntitySpider>().filter {
- it.baseMaxHealth % 54_000 == 0.0 || it.baseMaxHealth % 144_000 == 0.0 || it.baseMaxHealth % 576_000 == 0.0
+ it.hasMaxHealth(54_000) || it.hasMaxHealth(144_000) || it.hasMaxHealth(576_000)
})
list.addAll(entityList.filterIsInstance<EntityWolf>().filter {
- it.baseMaxHealth % 45_000 == 0.0 || it.baseMaxHealth % 120_000 == 0.0 || it.baseMaxHealth % 450_000 == 0.0
+ it.hasMaxHealth(45_000) || it.hasMaxHealth(120_000) || it.hasMaxHealth(450_000)
})
list.addAll(entityList.filterIsInstance<EntityEnderman>().filter {
- it.baseMaxHealth % 12_000_000 == 0.0 || it.baseMaxHealth % 25_000_000 == 0.0
+ it.hasMaxHealth(12_000_000) || it.hasMaxHealth(25_000_000)
})
list.addAll(entityList.filterIsInstance<EntityBlaze>().filter {
- it.baseMaxHealth % 12_000_000 == 0.0 || it.baseMaxHealth % 25_000_000 == 0.0
+ it.hasMaxHealth(12_000_000) || it.hasMaxHealth(25_000_000)
})
list.filter { it !in miniBosses && !DamageIndicatorManager.isBoss(it) }.forEach(miniBosses::add)
@@ -89,4 +89,4 @@ class HighlightSlayerMiniboss {
private fun isEnabled(): Boolean {
return LorenzUtils.inSkyblock && SkyHanniMod.feature.misc.slayerMinibossHighlight && !LorenzUtils.inDungeons && !LorenzUtils.inKuudraFight
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
index 990812b11..d057abd90 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
@@ -1,6 +1,8 @@
package at.hannibal2.skyhanni.utils
+import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth
import net.minecraft.entity.EntityLiving
+import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.util.AxisAlignedBB
@@ -43,13 +45,13 @@ object EntityUtils {
}
}
- fun EntityLiving.getNameTagWith(
- y: Int,
- contains: String,
- debugRightEntity: Boolean = false,
- inaccuracy: Double = 1.6,
- debugWrongEntity: Boolean = false,
- ): EntityArmorStand? {
+ fun EntityLiving.getNameTagWith(
+ y: Int,
+ contains: String,
+ debugRightEntity: Boolean = false,
+ inaccuracy: Double = 1.6,
+ debugWrongEntity: Boolean = false,
+ ): EntityArmorStand? {
val center = getLorenzVec().add(0, y, 0)
val a = center.add(-inaccuracy, -inaccuracy - 3, -inaccuracy).toBlocPos()
val b = center.add(inaccuracy, inaccuracy + 3, inaccuracy).toBlocPos()
@@ -69,4 +71,21 @@ object EntityUtils {
result
}
}
+
+ fun EntityLivingBase.hasMaxHealth(health: Int): Boolean {
+ return when (this.baseMaxHealth) {
+ health.toDouble() -> true
+
+ //Derpy
+ health.toDouble() * 2 -> true
+
+ //Corrupted
+ health.toDouble() * 3 -> true
+
+ //Derpy + Corrupted
+ health.toDouble() * 2 * 3 -> true
+
+ else -> false
+ }
+ }
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
index afc35b3ec..86829a4b0 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
@@ -106,26 +106,32 @@ object NumberUtil {
decimal = processDecimal(1000, lastNumber, decimal)
lastNumber = 1000
}
+
'D' -> {
decimal = processDecimal(500, lastNumber, decimal)
lastNumber = 500
}
+
'C' -> {
decimal = processDecimal(100, lastNumber, decimal)
lastNumber = 100
}
+
'L' -> {
decimal = processDecimal(50, lastNumber, decimal)
lastNumber = 50
}
+
'X' -> {
decimal = processDecimal(10, lastNumber, decimal)
lastNumber = 10
}
+
'V' -> {
decimal = processDecimal(5, lastNumber, decimal)
lastNumber = 5
}
+
'I' -> {
decimal = processDecimal(1, lastNumber, decimal)
lastNumber = 1
@@ -157,10 +163,7 @@ object NumberUtil {
return isNotEmpty() && pattern.matcher(this).matches()
}
- fun percentageColor(
- have: Int,
- max: Int,
- ): LorenzColor {
+ fun percentageColor(have: Long, max: Long): LorenzColor {
val percentage = have.toDouble() / max.toDouble()
return when {
percentage > 0.9 -> LorenzColor.DARK_GREEN