aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
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/utils/RenderUtils.kt
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/utils/RenderUtils.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index 39f251340..14241f314 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -1100,6 +1100,15 @@ object RenderUtils {
return exactLocation(player) + add
}
+ fun LorenzRenderWorldEvent.exactPlayerEyeLocation(player: Entity): LorenzVec {
+ val add = if (player.isSneaking) LorenzVec(0.0, 1.54, 0.0) else LorenzVec(0.0, 1.62, 0.0)
+ return exactLocation(player) + add
+ }
+
+ fun LorenzRenderWorldEvent.drawLineToEye(location: LorenzVec, color: Color, lineWidth: Int, depth: Boolean) {
+ draw3DLine(exactPlayerEyeLocation(), location, color, lineWidth, depth)
+ }
+
fun exactLocation(entity: Entity, partialTicks: Float): LorenzVec {
if (entity.isDead) return entity.getLorenzVec()
val x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks