aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.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/LocationUtils.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/LocationUtils.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt
index 34aa3f22f..d2394624c 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt
@@ -35,7 +35,7 @@ object LocationUtils {
fun playerEyeLocation(): LorenzVec {
val player = Minecraft.getMinecraft().thePlayer
val vec = player.getLorenzVec()
- return vec.add(y = player.getEyeHeight().toDouble())
+ return vec.up(player.getEyeHeight().toDouble())
}
fun AxisAlignedBB.isInside(vec: LorenzVec) = isVecInside(vec.toVec3())
@@ -53,7 +53,7 @@ object LocationUtils {
fun LorenzVec.canBeSeen(yOffsetRange: IntRange, radius: Double = 150.0): Boolean =
yOffsetRange.any { offset ->
- this.add(y = offset).canBeSeen(radius)
+ up(offset).canBeSeen(radius)
}
fun AxisAlignedBB.minBox() = LorenzVec(minX, minY, minZ)
@@ -99,7 +99,7 @@ object LocationUtils {
fun AxisAlignedBB.getCenter() = getEdgeLengths() * 0.5 + minBox()
- fun AxisAlignedBB.getTopCenter() = getCenter().add(y = (maxY - minY) / 2)
+ fun AxisAlignedBB.getTopCenter() = getCenter().up((maxY - minY) / 2)
fun AxisAlignedBB.clampTo(other: AxisAlignedBB): AxisAlignedBB {
val minX = max(this.minX, other.minX)