aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/event
diff options
context:
space:
mode:
authorEmpa <42304516+ItsEmpa@users.noreply.github.com>2024-10-11 19:01:42 +0200
committerGitHub <noreply@github.com>2024-10-11 19:01:42 +0200
commit9a2286ac3070e1ba0023445dc8243e618989e86e (patch)
tree6c4ad95a8df2ce6fff17e5ea96f8df09c4e5ea07 /src/main/java/at/hannibal2/skyhanni/features/event
parent8c54be95700b224c2f93b549465dbe06bf3bbe86 (diff)
downloadskyhanni-9a2286ac3070e1ba0023445dc8243e618989e86e.tar.gz
skyhanni-9a2286ac3070e1ba0023445dc8243e618989e86e.tar.bz2
skyhanni-9a2286ac3070e1ba0023445dc8243e618989e86e.zip
Backend: LorenzVec up/down and drawLineToEye (#2056)
Co-authored-by: ItsEmpa <itsempa@users.noreply.github.com> Co-authored-by: Cal <cwolfson58@gmail.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/event')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt23
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocations.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt13
3 files changed, 18 insertions, 22 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt
index aa58c3c0f..57cc77df5 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt
@@ -31,10 +31,9 @@ import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
-import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
import at.hannibal2.skyhanni.utils.RenderUtils.drawColor
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
-import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation
+import at.hannibal2.skyhanni.utils.RenderUtils.drawLineToEye
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.TimeUtils.format
import at.hannibal2.skyhanni.utils.toLorenzVec
@@ -281,34 +280,32 @@ object GriffinBurrowHelper {
if (distance > 10) {
// TODO use round(1)
val formattedDistance = distance.toInt().addSeparators()
- event.drawDynamicText(location.add(y = 1), "§d§lInquisitor §e${formattedDistance}m", 1.7)
+ event.drawDynamicText(location.up(), "§d§lInquisitor §e${formattedDistance}m", 1.7)
} else {
- event.drawDynamicText(location.add(y = 1), "§d§lInquisitor", 1.7)
+ event.drawDynamicText(location.up(), "§d§lInquisitor", 1.7)
}
if (distance < 5) {
InquisitorWaypointShare.maybeRemove(inquis)
}
- event.drawDynamicText(location.add(y = 1), "§eFrom §b${inquis.displayName}", 1.6, yOff = 9f)
+ event.drawDynamicText(location.up(), "§eFrom §b${inquis.displayName}", 1.6, yOff = 9f)
if (config.inquisitorSharing.showDespawnTime) {
val spawnTime = inquis.spawnTime
val format = (75.seconds - spawnTime.passedSince()).format()
- event.drawDynamicText(location.add(y = 1), "§eDespawns in §b$format", 1.6, yOff = 18f)
+ event.drawDynamicText(location.up(), "§eDespawns in §b$format", 1.6, yOff = 18f)
}
}
}
val currentWarp = BurrowWarpHelper.currentWarp
if (config.lineToNext) {
- val player = event.exactPlayerEyeLocation()
-
var color: LorenzColor?
val renderLocation = if (currentWarp != null) {
color = LorenzColor.AQUA
currentWarp.location
} else {
color = if (shouldFocusOnInquis) LorenzColor.LIGHT_PURPLE else LorenzColor.WHITE
- targetLocation?.add(0.5, 0.5, 0.5) ?: return
+ targetLocation?.blockCenter() ?: return
}
val lineWidth = if (targetLocation in particleBurrows) {
@@ -316,7 +313,7 @@ object GriffinBurrowHelper {
3
} else 2
if (currentWarp == null) {
- event.draw3DLine(player, renderLocation, color.toColor(), lineWidth, false)
+ event.drawLineToEye(renderLocation, color.toColor(), lineWidth, false)
}
}
@@ -330,7 +327,7 @@ object GriffinBurrowHelper {
val distance = location.distance(playerLocation)
val burrowType = burrow.value
event.drawColor(location, burrowType.color, distance > 10)
- event.drawDynamicText(location.add(y = 1), burrowType.text, 1.5)
+ event.drawDynamicText(location.up(), burrowType.text, 1.5)
}
}
@@ -340,10 +337,10 @@ object GriffinBurrowHelper {
val distance = guessLocation.distance(playerLocation)
event.drawColor(guessLocation, LorenzColor.WHITE, distance > 10)
val color = if (currentWarp != null && targetLocation == guessLocation) "§b" else "§f"
- event.drawDynamicText(guessLocation.add(y = 1), "${color}Guess", 1.5)
+ event.drawDynamicText(guessLocation.up(), "${color}Guess", 1.5)
if (distance > 5) {
val formattedDistance = distance.toInt().addSeparators()
- event.drawDynamicText(guessLocation.add(y = 1), "§e${formattedDistance}m", 1.7, yOff = 10f)
+ event.drawDynamicText(guessLocation.up(), "§e${formattedDistance}m", 1.7, yOff = 10f)
}
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocations.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocations.kt
index 896220842..13c530112 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocations.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocations.kt
@@ -142,9 +142,9 @@ object HoppityEggLocations {
val nameColorCode = (if (name != null) LorenzColor.GREEN else LorenzColor.RED).getChatColor()
event.drawColor(location, color, false, 0.5f)
- event.drawDynamicText(location.add(y = 0.5), "$nameColorCode$name", 1.2)
+ event.drawDynamicText(location.up(0.5), "$nameColorCode$name", 1.2)
if (location.distanceSqToPlayer() < 100) {
- event.drawDynamicText(location.add(y = 0.5), location.toCleanString(), 1.0, yOff = 12f)
+ event.drawDynamicText(location.up(0.5), location.toCleanString(), 1.0, yOff = 12f)
}
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt
index e5425af34..bef61bfbf 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt
@@ -24,9 +24,9 @@ import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.NumberUtil.formatInt
import at.hannibal2.skyhanni.utils.NumberUtil.roundTo
import at.hannibal2.skyhanni.utils.RecalculatingValue
-import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
import at.hannibal2.skyhanni.utils.RenderUtils.drawColor
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
+import at.hannibal2.skyhanni.utils.RenderUtils.drawLineToEye
import at.hannibal2.skyhanni.utils.RenderUtils.drawWaypointFilled
import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation
import at.hannibal2.skyhanni.utils.SimpleTimeMark
@@ -120,11 +120,10 @@ object HoppityEggLocator {
}
private fun LorenzRenderWorldEvent.drawGuessLocations() {
- val eyeLocation = exactPlayerEyeLocation()
for ((index, eggLocation) in possibleEggLocations.withIndex()) {
drawEggWaypoint(eggLocation, "§aGuess #${index + 1}")
if (config.showLine) {
- draw3DLine(eyeLocation, eggLocation.add(0.5, 0.5, 0.5), LorenzColor.GREEN.toColor(), 2, false)
+ drawLineToEye(eggLocation.blockCenter(), LorenzColor.GREEN.toColor(), 2, false)
}
}
}
@@ -136,7 +135,7 @@ object HoppityEggLocator {
if (dist < 10 && HoppityEggLocations.hasCollectedEgg(eggLocation)) {
val alpha = ((10 - dist) / 10).coerceAtMost(0.5).toFloat()
drawColor(eggLocation, LorenzColor.RED, false, alpha)
- drawDynamicText(eggLocation.add(y = 1), "§cDuplicate Location!", 1.5)
+ drawDynamicText(eggLocation.up(), "§cDuplicate Location!", 1.5)
}
}
}
@@ -152,10 +151,10 @@ object HoppityEggLocator {
config.waypointColor.toChromaColor(),
seeThroughBlocks = true,
)
- drawDynamicText(it.add(y = 1), "§aGuess", 1.5)
+ drawDynamicText(it.up(), "§aGuess", 1.5)
}
if (!drawLocations && config.showLine) {
- draw3DLine(eyeLocation, it.add(0.5, 0.5, 0.5), LorenzColor.GREEN.toColor(), 2, false)
+ drawLineToEye(it.blockCenter(), LorenzColor.GREEN.toColor(), 2, false)
}
}
}
@@ -170,7 +169,7 @@ object HoppityEggLocator {
} else {
drawColor(location, LorenzColor.RED.toColor(), false, 0.5f)
}
- drawDynamicText(location.add(y = 1), possibleDuplicateLabel, 1.5)
+ drawDynamicText(location.up(), possibleDuplicateLabel, 1.5)
}
private fun shouldShowAllEggs() = config.showAllWaypoints && !locatorInHotbar && HoppityEggType.eggsRemaining()