aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/mobs/ArachneSpawnTimer.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/MineshaftWaypoints.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt6
8 files changed, 14 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt
index 386167123..96f228a6b 100644
--- a/src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt
+++ b/src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt
@@ -11,7 +11,7 @@ class PlaySoundEvent(val soundName: String, val location: LorenzVec, val pitch:
val distanceToPlayer by lazy { location.distanceToPlayer() }
override fun toString(): String {
- return "PlaySoundEvent(soundName='$soundName', pitch=$pitch, volume=$volume, location=${location.round(1)}, distanceToPlayer=${
+ return "PlaySoundEvent(soundName='$soundName', pitch=$pitch, volume=$volume, location=${location.roundTo(1)}, distanceToPlayer=${
distanceToPlayer.roundTo(1)
})"
}
diff --git a/src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt
index 7c695c7ee..75fe8af8a 100644
--- a/src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt
+++ b/src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt
@@ -21,8 +21,8 @@ class ReceiveParticleEvent(
val distanceToPlayer by lazy { location.distanceToPlayer() }
override fun toString(): String {
- return "ReceiveParticleEvent(type='$type', location=${location.round(1)}, count=$count, speed=$speed, offset=${
- offset.round(
+ return "ReceiveParticleEvent(type='$type', location=${location.roundTo(1)}, count=$count, speed=$speed, offset=${
+ offset.roundTo(
1
)
}, longDistance=$longDistance, particleArgs=${particleArgs.contentToString()}, distanceToPlayer=${
diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/ArachneSpawnTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/ArachneSpawnTimer.kt
index 2fee0577e..d2e6f7ed6 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/ArachneSpawnTimer.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/ArachneSpawnTimer.kt
@@ -99,7 +99,7 @@ object ArachneSpawnTimer {
val packet = event.packet
if (packet is S2APacketParticles) {
- val location = packet.toLorenzVec().round(2)
+ val location = packet.toLorenzVec().roundTo(2)
if (arachneAltarLocation.distance(location) > 30) return
if (packet.particleType == EnumParticleTypes.REDSTONE && packet.particleSpeed == 1.0f) {
particleCounter += 1
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt
index 23ead6f91..d07e55816 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt
@@ -86,7 +86,7 @@ object PestParticleWaypoint {
val yellow = LorenzVec(0.8, 0.8, 0.0)
val redPest = LorenzVec(0.8, 0.4, 0.0)
val redPlot = LorenzVec(0.8, 0.0, 0.0)
- isPointingToPest = when (event.offset.round(5)) {
+ isPointingToPest = when (event.offset.roundTo(5)) {
redPlot -> false
redPest, yellow, darkYellow -> true
else -> return
@@ -150,7 +150,7 @@ object PestParticleWaypoint {
waypoint,
color,
3,
- false
+ false,
)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/MineshaftWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/MineshaftWaypoints.kt
index 7476e212b..ae17e783b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/MineshaftWaypoints.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/MineshaftWaypoints.kt
@@ -38,7 +38,7 @@ object MineshaftWaypoints {
fun onIslandChange(event: IslandChangeEvent) {
if (event.newIsland != IslandType.MINESHAFT) return
- val playerLocation = LocationUtils.playerLocation().round(0).add(y = -1)
+ val playerLocation = LocationUtils.playerLocation().roundTo(0).add(y = -1)
if (config.mineshaftWaypoints.entranceLocation) {
waypoints.add(MineshaftWaypoint(waypointType = MineshaftWaypointType.ENTRANCE, location = playerLocation))
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt
index 2188cb174..94fefbdf8 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt
@@ -29,7 +29,7 @@ object TrevorSolver {
var averageHeight = (minHeight + maxHeight) / 2
fun findMobHeight(height: Int, above: Boolean) {
- val playerPosition = LocationUtils.playerLocation().round(2)
+ val playerPosition = LocationUtils.playerLocation().roundTo(2)
val mobHeight = if (above) playerPosition.y + height else playerPosition.y - height
if (maxHeight == 0.0) {
diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt
index 156ce82a3..cac3349e1 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt
@@ -606,7 +606,7 @@ object SkyHanniDebugsAndTests {
@SubscribeEvent
fun onReceiveParticle(event: ReceiveParticleEvent) {
// val particleType = event.type
-// val distance = LocationUtils.playerLocation().distance(event.location).round(2)
+// val distance = LocationUtils.playerLocation().distance(event.location).roundTo(2)
//
// println("")
// println("particleType: $particleType")
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt
index 2e5748c6c..6769210ef 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt
@@ -153,7 +153,10 @@ data class LorenzVec(
return result
}
- fun round(decimals: Int) = LorenzVec(x.roundTo(decimals), y.roundTo(decimals), z.roundTo(decimals))
+ @Deprecated("Use roundTo instead", ReplaceWith("this.roundTo(precision)"))
+ fun round(precision: Int) = roundTo(precision)
+
+ fun roundTo(precision: Int) = LorenzVec(x.roundTo(precision), y.roundTo(precision), z.roundTo(precision))
fun roundLocationToBlock(): LorenzVec {
val x = (x - .499999).roundTo(0)
@@ -164,6 +167,7 @@ data class LorenzVec(
fun slope(other: LorenzVec, factor: Double) = this + (other - this).scale(factor)
+ // TODO better name. dont confuse with roundTo()
fun roundLocation(): LorenzVec {
val x = if (this.x < 0) x.toInt() - 1 else x.toInt()
val y = y.toInt() - 1