From c9a96559bd9b017978e39758d63ee15b348275b0 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 7 Apr 2024 11:08:51 +0200 Subject: code cleanup --- .../java/at/hannibal2/skyhanni/utils/LorenzVec.kt | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni') diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt index 0353dc386..e8715703f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt @@ -109,21 +109,15 @@ data class LorenzVec( } } - fun toCleanString(): String { - return "$x $y $z" - } + fun toCleanString(): String = "$x $y $z" - fun length(): Double { - return sqrt(x * x + y * y + z * z) - } + fun length(): Double = sqrt(x * x + y * y + z * z) fun isZero(): Boolean = x == 0.0 && y == 0.0 && z == 0.0 fun clone(): LorenzVec = LorenzVec(x, y, z) - fun toDoubleArray(): Array { - return arrayOf(x, y, z) - } + fun toDoubleArray(): Array = arrayOf(x, y, z) fun equalsIgnoreY(other: LorenzVec) = x == other.x && z == other.z @@ -163,9 +157,7 @@ data class LorenzVec( fun boundingToOffset(offX: Double, offY: Double, offZ: Double) = AxisAlignedBB(x, y, z, x + offX, y + offY, z + offZ) - fun scale(scalar: Double): LorenzVec { - return LorenzVec(scalar * x, scalar * y, scalar * z) - } + fun scale(scalar: Double): LorenzVec = LorenzVec(scalar * x, scalar * y, scalar * z) fun applyTranslationToGL() { GlStateManager.translate(x, y, z) @@ -173,9 +165,7 @@ data class LorenzVec( fun axisAlignedTo(other: LorenzVec) = AxisAlignedBB(x, y, z, other.x, other.y, other.z) - fun up(offset: Double): LorenzVec { - return copy(y = y + offset) - } + fun up(offset: Double): LorenzVec = copy(y = y + offset) fun interpolate(other: LorenzVec, factor: Double): LorenzVec { require(factor in 0.0..1.0) { "Percentage must be between 0 and 1: $factor" } -- cgit