From 5d5c79f783b604ee84dbf131430a9d28252b88ea Mon Sep 17 00:00:00 2001 From: Lorenz Date: Mon, 15 Aug 2022 09:10:40 +0200 Subject: fixed ender slayer damage indicator and added derpy support for damage indicator --- src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/main/java/at/hannibal2/skyhanni/utils') 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 -- cgit