diff options
author | Lorenz <lo.scherf@gmail.com> | 2022-08-15 09:10:40 +0200 |
---|---|---|
committer | Lorenz <lo.scherf@gmail.com> | 2022-08-15 09:10:40 +0200 |
commit | 5d5c79f783b604ee84dbf131430a9d28252b88ea (patch) | |
tree | 14354d0eba148c63cd89b8cbac5a8d767c3109be /src/main/java/at/hannibal2/skyhanni/utils | |
parent | 5d2045ce2b2a0da2b70987ccf373877370edb490 (diff) | |
download | skyhanni-5d5c79f783b604ee84dbf131430a9d28252b88ea.tar.gz skyhanni-5d5c79f783b604ee84dbf131430a9d28252b88ea.tar.bz2 skyhanni-5d5c79f783b604ee84dbf131430a9d28252b88ea.zip |
fixed ender slayer damage indicator and added derpy support for damage indicator
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt index 510b04fb8..1388c076a 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt @@ -6,6 +6,7 @@ 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 data class LorenzVec( @@ -54,6 +55,19 @@ data class LorenzVec( fun add(other: LorenzVec) = LorenzVec(x + other.x, y + other.y, z + other.z) + fun subtract(other: LorenzVec) = LorenzVec(x - other.x, y - other.y, z - other.z) + + fun printWithAccuracy(accuracy: Int): String { + val x = (round(x * accuracy) / accuracy) + val y = (round(y * accuracy) / accuracy) + val z = (round(z * accuracy) / accuracy) + return LorenzVec(x, y, z).toCleanString() + } + + private fun toCleanString(): String { + return "$x $y $z" + } + companion object { fun getFromYawPitch(yaw: Double, pitch: Double): LorenzVec { val yaw: Double = (yaw + 90) * Math.PI / 180 |