aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-08-17 18:29:23 +0200
committerLorenz <lo.scherf@gmail.com>2022-08-17 18:29:23 +0200
commitab5987a3929378e5118f409ea7df014fd70cbdf2 (patch)
tree3a4b44d1658530427ac2dd4b27e7c0ab11244643 /src/main/java
parentbc4858e91e30e366378720ca534deaddb07acb4a (diff)
downloadskyhanni-ab5987a3929378e5118f409ea7df014fd70cbdf2.tar.gz
skyhanni-ab5987a3929378e5118f409ea7df014fd70cbdf2.tar.bz2
skyhanni-ab5987a3929378e5118f409ea7df014fd70cbdf2.zip
add dummy as debug damage indicator and adding debugs
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/DamageIndicator.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossFinder.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossType.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt28
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/EntityData.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt40
7 files changed, 70 insertions, 21 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/DamageIndicator.java b/src/main/java/at/hannibal2/skyhanni/config/features/DamageIndicator.java
index 0adef7865..042ce6bd5 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/DamageIndicator.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/DamageIndicator.java
@@ -53,11 +53,12 @@ public class DamageIndicator {
"\u00a7bDungeon Floor 4",
"\u00a7bDungeon Floor 5",
"\u00a7bDungeon Floor 6",
- "\u00a7bDungeon Floor 7"
+ "\u00a7bDungeon Floor 7",
+ "Dummy"
}
)
//TODO only show currently working and tested features
- public List<Integer> bossesToShow = new ArrayList<>(Arrays.asList(0, 1, 2, 5, 6, 7, 8, 9));
+ public List<Integer> bossesToShow = new ArrayList<>(Arrays.asList(0, 1, 2, 5, 6, 7, 8, 9, 18));
@Expose
@ConfigOption(name = "Hide Damage Splash", desc = "Hiding damage splashes near the damage indicator")
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 9a91c7680..5b64e9150 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossFinder.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossFinder.kt
@@ -241,7 +241,7 @@ class BossFinder {
}
if (entity is EntityIronGolem) {
if (entity.hasNameTagWith(3, "§e﴾ §8[§7Lv100§8] §lEndstone Protector§r ")) {
- return EntityResult(bossType = BossType.END_ENDSTONE_PROTECTOR, ignoreBlocks = true)
+ return EntityResult(bossType = BossType.END_ENDSTONE_PROTECTOR)
}
}
if (entity is EntityZombie) {
@@ -266,6 +266,9 @@ class BossFinder {
return EntityResult(bossType = BossType.SLAYER_ZOMBIE_5)
}
}
+ if (entity.hasNameTagWith(2, "Dummy §a10M§c❤")) {
+ return EntityResult(bossType = BossType.DUMMY)
+ }
}
if (entity is EntityMagmaCube) {
if (entity.hasNameTagWith(15, "§e﴾ §8[§7Lv500§8] §l§4§lMagma Boss§r ")) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossType.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossType.kt
index 0bae4bbbd..109bfa9bc 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossType.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossType.kt
@@ -48,6 +48,8 @@ enum class BossType(val fullName: String, val bossTypeToggle: Int, val shortName
DUNGEON_F("", 16),
DUNGEON_75("", 17),
+ DUMMY("Dummy", 18),
+
//TODO arachne
//TODO corelone
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 1feaaa7ab..a95b1eda9 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
@@ -59,13 +59,17 @@ class DamageIndicatorManager {
val player = Minecraft.getMinecraft().thePlayer
//TODO config to define between 100ms and 5 sec
- for (uuid in data.filter { System.currentTimeMillis() > it.value.timeLastTick + if (it.value.dead) 3_000 else 100 }
+ for (uuid in data.filter { System.currentTimeMillis() > it.value.timeLastTick + if (it.value.dead) 4_000 else 100 }
.map { it.key }) {
data.remove(uuid)
}
for (data in data.values) {
- tickDamage(data.damageCounter)
+
+ //TODO test end stone protector in hole? - maybe change eye pos
+// data.ignoreBlocks =
+// data.bossType == BossType.END_ENDSTONE_PROTECTOR && Minecraft.getMinecraft().thePlayer.isSneaking
+
if (!data.ignoreBlocks) {
if (!player.canEntityBeSeen(data.entity)) continue
}
@@ -96,9 +100,9 @@ class DamageIndicatorManager {
loc
}
- if (!data.healthLineHidden) {
- RenderUtils.drawLabel(location, healthText, partialTicks, true, 6f)
- }
+// if (!data.healthLineHidden) {
+ RenderUtils.drawLabel(location, healthText, partialTicks, true, 6f)
+// }
var bossName = when (SkyHanniMod.feature.damageIndicator.bossName) {
0 -> ""
@@ -113,7 +117,9 @@ 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)
if (SkyHanniMod.feature.damageIndicator.showDamageOverTime) {
@@ -222,6 +228,7 @@ class DamageIndicatorManager {
val lastHealth = data[entity.uniqueID]!!.lastHealth
val bossType = entityData.bossType
checkDamage(entityData, health, lastHealth, bossType)
+ tickDamage(entityData.damageCounter)
}
entityData.lastHealth = health
@@ -312,8 +319,9 @@ class DamageIndicatorManager {
} + " §f"
//hide while in the middle
- val position = entity.getLorenzVec()
- entityData.healthLineHidden = position.x == -368.0 && position.z == -804.0
+// val position = entity.getLorenzVec()
+ //TODO other logic or something
+// entityData.healthLineHidden = position.x == -368.0 && position.z == -804.0
var calcHealth = -1
for (line in ScoreboardData.sidebarLinesRaw) {
@@ -446,7 +454,7 @@ class DamageIndicatorManager {
}
} else if (DungeonData.isOneOf("M4")) {
maxHealth = 6
- when (realHealth) {
+ when (realHealth) {
//TODO test all non derpy values!
1_800_000 / 2, 1_800_000 -> 6
1_494_000 / 2, 1_494_000 -> 5
@@ -531,7 +539,7 @@ class DamageIndicatorManager {
}
@SubscribeEvent
- fun onWorldRender(event: EntityJoinWorldEvent) {
+ fun onEntityJoin(event: EntityJoinWorldEvent) {
bossFinder?.handleNewEntity(event.entity)
}
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 a28c6822a..f2483aae9 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/EntityData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/EntityData.kt
@@ -14,7 +14,7 @@ class EntityData(
var lastHealth: Int = 0,
var healthText: String = "",
var timeLastTick: Long = 0,
- var healthLineHidden: Boolean = false,
+// var healthLineHidden: Boolean = false,
var namePrefix: String = "",
var nameSuffix: String = "",
var dead: Boolean = false,
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt
index 1388c076a..5d5c03c4d 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt
@@ -4,10 +4,7 @@ import net.minecraft.entity.Entity
import net.minecraft.util.BlockPos
import net.minecraft.util.Rotations
import net.minecraft.util.Vec3
-import kotlin.math.cos
-import kotlin.math.pow
-import kotlin.math.round
-import kotlin.math.sin
+import kotlin.math.*
data class LorenzVec(
val x: Double,
@@ -68,6 +65,10 @@ data class LorenzVec(
return "$x $y $z"
}
+ fun length(): Double {
+ return sqrt(x * x + y * y + z * z)
+ }
+
companion object {
fun getFromYawPitch(yaw: Double, pitch: Double): LorenzVec {
val yaw: Double = (yaw + 90) * Math.PI / 180
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index 71b47f23a..92febf7b6 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -327,6 +327,7 @@ object RenderUtils {
shadow: Boolean = false,
scale: Float = 1f,
yOff: Float = 0f,
+ debug: Boolean = false,
) {
val minecraft = Minecraft.getMinecraft()
val player = minecraft.thePlayer
@@ -336,8 +337,35 @@ object RenderUtils {
pos.y - player.lastTickPosY + (pos.y - player.posY - (pos.y - player.lastTickPosY)) * partialTicks
val z =
pos.z - player.lastTickPosZ + (pos.z - player.posZ - (pos.z - player.lastTickPosZ)) * partialTicks
+
+
+ //7 - 25
+
+ val translate = LorenzVec(x, y, z)
+ val length = translate.length().toFloat()
+
+ var finalText = text
+ var factor = 1f
+ var finalScale = scale
+ if (debug) {
+// if (tick++ % 60 == 0) {
+ finalText = "$text ${length.toInt()}"
+// println("translate: $length")
+// }
+ if (length < 8) {
+ factor = 8 / length
+// translate = translate.multiply(8 / length)
+ }
+ if (length > 15) {
+ factor = 15 / length
+// translate = translate.multiply(15 / length)
+ }
+// val finalScale = scale * (1 / factor)
+ finalScale = scale * sqrt(factor.toDouble()).toFloat()
+ }
+
val f1 = 0.0266666688
- val width = minecraft.fontRendererObj.getStringWidth(text) / 2
+ val width = minecraft.fontRendererObj.getStringWidth(finalText) / 2
GlStateManager.pushMatrix()
GlStateManager.translate(x, y, z)
GL11.glNormal3f(0f, 1f, 0f)
@@ -345,12 +373,18 @@ object RenderUtils {
GlStateManager.rotate(-renderManager.playerViewY, 0f, 1f, 0f)
GlStateManager.rotate(renderManager.playerViewX, 1f, 0f, 0f)
GlStateManager.scale(-f1, -f1, -f1)
- GlStateManager.scale(scale, scale, scale)
+// GlStateManager.scale(scale, scale, scale)
+ GlStateManager.scale(finalScale, finalScale, finalScale)
+// GlStateManager.scale(finalScale, finalScale, finalScale)
GlStateManager.enableBlend()
GlStateManager.disableLighting()
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0)
GlStateManager.enableTexture2D()
- minecraft.fontRendererObj.drawString(text, (-width).toFloat(), yOff, LorenzColor.WHITE.toColor().rgb, shadow)
+ minecraft.fontRendererObj.drawString(finalText,
+ (-width).toFloat(),
+ yOff,
+ LorenzColor.WHITE.toColor().rgb,
+ shadow)
GlStateManager.disableBlend()
GlStateManager.popMatrix()
}