aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-01-22 12:44:10 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-01-22 12:44:10 +0100
commit7e0dbf15ca6f67bd32e9ef50f369ab9b316b99f3 (patch)
tree663e2278514415a347e6f3e20ed70399ee07b933 /src/main/java/at/hannibal2/skyhanni
parent9360f10e193b4bc3d634cc853e7cfd82d5ff5b76 (diff)
downloadskyhanni-7e0dbf15ca6f67bd32e9ef50f369ab9b316b99f3.tar.gz
skyhanni-7e0dbf15ca6f67bd32e9ef50f369ab9b316b99f3.tar.bz2
skyhanni-7e0dbf15ca6f67bd32e9ef50f369ab9b316b99f3.zip
Damage Indicator dynamic text size scale. Enderman beacon render priority fixed.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt55
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt2
2 files changed, 33 insertions, 24 deletions
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 3affefaf4..48abd66ff 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
@@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.utils.EntityUtils.getNameTagWith
import at.hannibal2.skyhanni.utils.EntityUtils.hasNameTagWith
import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth
import at.hannibal2.skyhanni.utils.LorenzUtils.between
+import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraft.client.Minecraft
import net.minecraft.client.renderer.GlStateManager
@@ -107,7 +108,30 @@ class DamageIndicatorManager {
data.remove(uuid)
}
- var playerLocation = LocationUtils.playerLocation()
+ val sizeHealth: Double
+ val sizeNameAbove: Double
+ val sizeBossName: Double
+ val sizeFinalResults: Double
+ val smallestDistanceVew: Double
+ val thirdPersonView = Minecraft.getMinecraft().gameSettings.thirdPersonView
+ // 0 == normal
+ // 1 == f3 behind
+ // 2 == selfie
+ if (thirdPersonView == 1) {
+ sizeHealth = 2.8
+ sizeNameAbove = 2.2
+ sizeBossName = 2.4
+ sizeFinalResults = 1.8
+
+ smallestDistanceVew = 10.0
+ } else {
+ sizeHealth = 1.9
+ sizeNameAbove = 1.8
+ sizeBossName = 2.1
+ sizeFinalResults = 1.4
+
+ smallestDistanceVew = 6.0
+ }
for (data in data.values) {
@@ -132,7 +156,6 @@ class DamageIndicatorManager {
}
val partialTicks = event.partialTicks
- var tooClose = false
val location = if (data.dead && data.deathLocation != null) {
data.deathLocation!!
} else {
@@ -142,26 +165,16 @@ class DamageIndicatorManager {
RenderUtils.interpolate(entity.posZ, entity.lastTickPosZ, partialTicks)
)
if (data.dead) data.deathLocation = loc
- val distance = loc.distance(playerLocation)
- Minecraft.getMinecraft().renderManager
- tooClose = distance < 5 && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0
- if (tooClose) {
- loc.add(0.0, -1.0, 0.0)
- } else {
- loc
- }
+ loc
}
- RenderUtils.drawLabel(location, healthText, partialTicks, true, 6f)
+
+ event.drawDynamicText(location, healthText, sizeHealth, smallestDistanceVew = smallestDistanceVew)
if (data.nameAbove.isNotEmpty()) {
- RenderUtils.drawLabel(
- location, data.nameAbove, partialTicks, true, 3.9f, if (tooClose) -9.0f else -18.0f
- )
+ event.drawDynamicText(location, data.nameAbove, sizeNameAbove, -18f, smallestDistanceVew = smallestDistanceVew)
}
- if (tooClose) continue
-
var bossName = when (SkyHanniMod.feature.damageIndicator.bossName) {
0 -> ""
1 -> data.bossType.fullName
@@ -175,11 +188,7 @@ class DamageIndicatorManager {
if (data.nameSuffix.isNotEmpty()) {
bossName += data.nameSuffix
}
- //TODO fix scaling problem
-
-// val debug = Minecraft.getMinecraft().thePlayer.isSneaking
-// RenderUtils.drawLabel(location, bossName, partialTicks, true, 3.9f, -9.0f, debug = debug)
- RenderUtils.drawLabel(location, bossName, partialTicks, true, 3.9f, -9.0f)
+ event.drawDynamicText(location, bossName, sizeBossName, -9f, smallestDistanceVew = smallestDistanceVew)
if (SkyHanniMod.feature.damageIndicator.showDamageOverTime) {
var diff = 13f
@@ -195,7 +204,7 @@ class DamageIndicatorManager {
} else {
"$formatDamage §7/ $formatHealing"
}
- RenderUtils.drawLabel(location, finalResult, partialTicks, true, 3.9f, diff)
+ event.drawDynamicText(location, finalResult, sizeFinalResults, diff, smallestDistanceVew = smallestDistanceVew)
diff += 9f
}
for (damage in data.damageCounter.oldDamages) {
@@ -208,7 +217,7 @@ class DamageIndicatorManager {
} else {
"$formatDamage §7/ $formatHealing"
}
- RenderUtils.drawLabel(location, finalResult, partialTicks, true, 3.9f, diff)
+ event.drawDynamicText(location, finalResult, sizeFinalResults, diff, smallestDistanceVew = smallestDistanceVew)
diff += 9f
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt
index a36db4820..0105064d2 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt
@@ -63,7 +63,7 @@ class EndermanSlayerBeacon {
}
}
- @SubscribeEvent
+ @SubscribeEvent(priority = EventPriority.HIGH)
fun onWorldRender(event: RenderWorldLastEvent) {
if (!isEnabled()) return