diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-28 00:21:03 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-28 00:21:03 +0200 |
commit | 26e34bc9a93760da738dfcb8aecba3c5d3357199 (patch) | |
tree | 9ed08ccf307e734283c14f6b39566bc17726f7fc | |
parent | 38281ab4b46527bd0d519ed96618337fc0f3a67c (diff) | |
download | skyhanni-26e34bc9a93760da738dfcb8aecba3c5d3357199.tar.gz skyhanni-26e34bc9a93760da738dfcb8aecba3c5d3357199.tar.bz2 skyhanni-26e34bc9a93760da738dfcb8aecba3c5d3357199.zip |
code cleanup in LorenzVec
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt | 2 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt | 12 |
2 files changed, 4 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt index 0e31c45bb..ec8b61b5f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt @@ -154,5 +154,5 @@ object EntityUtils { if (Minecraft.getMinecraft().isCallingFromMinecraftThread) it else it.toMutableList() }?.asSequence() ?: emptySequence() - fun Entity.canBeSeen(radius: Double = 150.0) = getLorenzVec().add(0.0, 0.5, 0.0).canBeSeen(radius) + fun Entity.canBeSeen(radius: Double = 150.0) = getLorenzVec().add(y = 0.5).canBeSeen(radius) } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt index d665fa3a0..bdab17b3b 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt @@ -48,17 +48,11 @@ data class LorenzVec( return (dx * dx + dz * dz) } - fun add(x: Double, y: Double, z: Double): LorenzVec = LorenzVec(this.x + x, this.y + y, this.z + z) + fun add(x: Double = 0.0, y: Double = 0.0, z: Double = 0.0): LorenzVec = LorenzVec(this.x + x, this.y + y, this.z + z) fun add(x: Int, y: Int, z: Int): LorenzVec = LorenzVec(this.x + x, this.y + y, this.z + z) - override fun toString(): String { - return "LorenzVec{" + - "x=" + x + - ", y=" + y + - ", z=" + z + - '}' - } + override fun toString() = "LorenzVec{x=$x, y=$y, z=$z}" fun multiply(d: Double): LorenzVec = LorenzVec(x multiplyZeroSave d, y multiplyZeroSave d, z multiplyZeroSave d) @@ -174,4 +168,4 @@ fun S2APacketParticles.toLorenzVec() = LorenzVec(xCoordinate, yCoordinate, zCoor fun Array<Double>.toLorenzVec(): LorenzVec { return LorenzVec(this[0], this[1], this[2]) -}
\ No newline at end of file +} |