aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-08-15 11:31:48 +0200
committerLorenz <lo.scherf@gmail.com>2022-08-15 11:31:48 +0200
commit263f80c3ecb6896de74668b4833a2b5c154bf463 (patch)
treed6840cbdb8d2e850b8ca84ffa681978d3bb3a828 /src
parent7da9e1ee2927a693adedbc3386f3f5d81bbc4b0d (diff)
downloadskyhanni-263f80c3ecb6896de74668b4833a2b5c154bf463.tar.gz
skyhanni-263f80c3ecb6896de74668b4833a2b5c154bf463.tar.bz2
skyhanni-263f80c3ecb6896de74668b4833a2b5c154bf463.zip
added coloring to damage indicator except dungeon
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/damageindicator/BossDamageIndicator.kt90
-rw-r--r--src/main/java/at/hannibal2/skyhanni/damageindicator/BossType.kt27
-rw-r--r--src/main/java/at/hannibal2/skyhanni/damageindicator/EntityData.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt5
5 files changed, 88 insertions, 41 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/damageindicator/BossDamageIndicator.kt b/src/main/java/at/hannibal2/skyhanni/damageindicator/BossDamageIndicator.kt
index e47efff76..f7f6060c6 100644
--- a/src/main/java/at/hannibal2/skyhanni/damageindicator/BossDamageIndicator.kt
+++ b/src/main/java/at/hannibal2/skyhanni/damageindicator/BossDamageIndicator.kt
@@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.dungeon.DungeonData
import at.hannibal2.skyhanni.events.DamageIndicatorFinalBossEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.misc.ScoreboardData
+import at.hannibal2.skyhanni.test.LorenzTest
import at.hannibal2.skyhanni.utils.*
import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth
import net.minecraft.client.Minecraft
@@ -75,18 +76,40 @@ class BossDamageIndicator {
}
val partialTicks = event.partialTicks
+ val pos = Vec3(
+ RenderUtils.interpolate(entity.posX, entity.lastTickPosX, partialTicks),
+ RenderUtils.interpolate(entity.posY, entity.lastTickPosY, partialTicks) + 0.5f,
+ RenderUtils.interpolate(entity.posZ, entity.lastTickPosZ, partialTicks)
+ )
RenderUtils.drawLabel(
- Vec3(
- RenderUtils.interpolate(entity.posX, entity.lastTickPosX, partialTicks),
- RenderUtils.interpolate(entity.posY, entity.lastTickPosY, partialTicks) + 0.5f,
- RenderUtils.interpolate(entity.posZ, entity.lastTickPosZ, partialTicks)
- ),
+ pos,
text,
color.toColor(),
partialTicks,
true,
6f
)
+
+
+ var bossName = data.bossType.bossName
+ if (data.namePrefix.isNotEmpty()) {
+ bossName = data.namePrefix + bossName
+ }
+ if (data.nameSuffix.isNotEmpty()) {
+ bossName += data.nameSuffix
+ }
+
+ val scale2 = LorenzTest.b.toFloat()
+ val above = LorenzTest.a.toFloat()
+ RenderUtils.drawLabel(
+ pos,
+ bossName,
+ LorenzColor.WHITE.toColor(),
+ partialTicks,
+ true,
+ scale2,
+ above
+ )
}
GlStateManager.enableDepth()
GlStateManager.enableCull()
@@ -131,7 +154,6 @@ class BossDamageIndicator {
var calcHealth = health
var calcMaxHealth = maxHealth
- var extraPrefix = ""
if (DungeonData.isOneOf("F4")) {
calcHealth = when (health) {
@@ -162,6 +184,7 @@ class BossDamageIndicator {
if (entityData.bossType == BossType.END_ENDERMAN_SLAYER) {
+ var statePrefix = ""
//Hides the damage indicator when in hit phase or in laser phase
if (entity is EntityEnderman) {
var hidden = false
@@ -176,60 +199,79 @@ class BossDamageIndicator {
//custom prefix and health for the four different ender slayers
when (maxHealth) {
300_000_000, 600_000_000 -> {
+ entityData.namePrefix = "§4"
+ entityData.nameSuffix = " 4"
val step = maxHealth / 6
calcMaxHealth = step
if (health > step * 5) {
calcHealth -= step * 5
- extraPrefix = "1/6"
+ statePrefix = "§c1/6 "
} else if (health > step * 4) {
calcHealth -= step * 4
- extraPrefix = "2/6"
+ statePrefix = "§e2/6 "
} else if (health > step * 3) {
calcHealth -= step * 3
- extraPrefix = "3/6"
+ statePrefix = "§e3/6 "
} else if (health > step * 2) {
calcHealth -= step * 2
- extraPrefix = "4/6"
+ statePrefix = "§e4/6 "
} else if (health > step) {
calcHealth -= step
- extraPrefix = "5/6"
+ statePrefix = "§e5/6 "
} else {
calcHealth = health
- extraPrefix = "6/6"
+ statePrefix = "§a6/6 "
}
}
else -> {
+ when (maxHealth) {
+ 300_000, 600_000 -> {
+ entityData.namePrefix = "§a"
+ entityData.nameSuffix = " 1"
+ }
+ 15_000_000, 30_000_000 -> {
+ entityData.namePrefix = "§e"
+ entityData.nameSuffix = " 2"
+ }
+ 66_666_666, 66_666_666 * 2 -> {
+ entityData.namePrefix = "§c"
+ entityData.nameSuffix = " 3"
+ }
+ }
+
val step = maxHealth / 3
calcMaxHealth = step
if (health > step * 2) {
calcHealth -= step * 2
- extraPrefix = "1/3"
+ statePrefix = "§c1/3 "
} else if (health > step) {
calcHealth -= step
- extraPrefix = "2/3"
+ statePrefix = "§e2/3 "
} else {
calcHealth = health
- extraPrefix = "3/3"
+ statePrefix = "§a3/3 "
}
}
+
}
}
+ entityData.namePrefix = statePrefix + entityData.namePrefix
}
if (entityData.bossType == BossType.NETHER_MAGMA_BOSS) {
if (entity is EntityMagmaCube) {
val slimeSize = entity.slimeSize
- extraPrefix = when (slimeSize) {
- 24 -> "1/6"
- 22 -> "2/6"
- 20 -> "3/6"
- 18 -> "4/6"
- 16 -> "5/6"
+ entityData.namePrefix = when (slimeSize) {
+ 24 -> "§c1/6"
+ 22 -> "§e2/6"
+ 20 -> "§e3/6"
+ 18 -> "§e4/6"
+ 16 -> "§e5/6"
else -> {
calcMaxHealth = 10_000_000
- "6/6"
+ "§a6/6"
}
- }
+ } + " §f"
//hide while in the middle
val position = entity.getLorenzVec()
@@ -304,7 +346,7 @@ class BossDamageIndicator {
}
entityData.lastHealth = health
- entityData.text = extraPrefix + " " + NumberUtil.format(calcHealth)
+ entityData.text = NumberUtil.format(calcHealth)
entityData.color = color
entityData.timeLastTick = System.currentTimeMillis()
data[entity.uniqueID] = entityData
diff --git a/src/main/java/at/hannibal2/skyhanni/damageindicator/BossType.kt b/src/main/java/at/hannibal2/skyhanni/damageindicator/BossType.kt
index f912758d4..cdb005b3f 100644
--- a/src/main/java/at/hannibal2/skyhanni/damageindicator/BossType.kt
+++ b/src/main/java/at/hannibal2/skyhanni/damageindicator/BossType.kt
@@ -1,22 +1,21 @@
package at.hannibal2.skyhanni.damageindicator
-enum class BossType {
- DUNGEON,
+enum class BossType(val bossName: String) {
+ DUNGEON("Generic Dungeon boss"),//TODO split in different bosses
-// CRIMSON_AILE_BLADESOUL,
- NETHER_BLADESOUL,
- NETHER_MAGMA_BOSS,
- NETHER_ASHFANG,
- NETHER_BARBARIAN_DUKE,
- NETHER_MAGE_OUTLAW,
+ NETHER_BLADESOUL("§8Bladesoul"),
+ NETHER_MAGMA_BOSS("§4Magma Boss"),
+ NETHER_ASHFANG("§cAshfang"),
+ NETHER_BARBARIAN_DUKE("§eBarbarian Duke"),
+ NETHER_MAGE_OUTLAW("§5Mage Outlaw"),
- NETHER_VANQUISHER,
+ NETHER_VANQUISHER("§5Vanquisher"),
- END_ENDSTONE_PROTECTOR,
- END_ENDERMAN_SLAYER,
- END_ENDER_DRAGON,
+ END_ENDSTONE_PROTECTOR("§cEndstone Protector"),//TODO add color
+ END_ENDERMAN_SLAYER("Voidgloom Seraph"),
+ END_ENDER_DRAGON("Ender Dragon"),//TODO fix totally
- HUB_REVENANT_HORROR,
- HUB_HEADLESS_HORSEMAN,
+ HUB_REVENANT_HORROR("§5Revenant Horror 5"),//TODO add other variants like voidgloom?
+ HUB_HEADLESS_HORSEMAN("§6Headless Horseman"),
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/damageindicator/EntityData.kt b/src/main/java/at/hannibal2/skyhanni/damageindicator/EntityData.kt
index ffbe00a87..f7a56d620 100644
--- a/src/main/java/at/hannibal2/skyhanni/damageindicator/EntityData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/damageindicator/EntityData.kt
@@ -14,5 +14,7 @@ class EntityData(
var text: String = "",
var color: LorenzColor = LorenzColor.DARK_GREEN,
var timeLastTick: Long = 0,
- var hidden: Boolean = false
+ var hidden: Boolean = false,
+ var namePrefix: String = "",
+ var nameSuffix: String = ""
) \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
index 428a86d9f..c7f92e5e7 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
@@ -26,6 +26,9 @@ class LorenzTest {
var enabled = false
var text = ""
+ var a = -9.0
+ var b = 3.9
+
val debugLogger = LorenzLogger("debug/test")
fun printLore() {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index 765a075a8..430c45777 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -327,7 +327,8 @@ object RenderUtils {
color: Color,
partialTicks: Float,
shadow: Boolean = false,
- scale: Float = 1f
+ scale: Float = 1f,
+ yOff: Float = 0f,
) {
var mc = Minecraft.getMinecraft()
val player = mc.thePlayer
@@ -351,7 +352,7 @@ object RenderUtils {
GlStateManager.disableLighting()
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0)
GlStateManager.enableTexture2D()
- mc.fontRendererObj.drawString(text, (-width).toFloat(), 0f, color.rgb, shadow)
+ mc.fontRendererObj.drawString(text, (-width).toFloat(), yOff, color.rgb, shadow)
GlStateManager.disableBlend()
GlStateManager.popMatrix()
}