aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-01-26 13:07:18 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-01-26 13:07:18 +0100
commitae48ef854f96fe5a6d60d9a52f9db680de77fdf3 (patch)
tree22085e5a85d22f0b628911defde894c4b751c3e4 /src/main/java/at/hannibal2/skyhanni/features
parent53c653bfa52bc9a07a4308a1840ea9f2eafe0bcc (diff)
downloadskyhanni-ae48ef854f96fe5a6d60d9a52f9db680de77fdf3.tar.gz
skyhanni-ae48ef854f96fe5a6d60d9a52f9db680de77fdf3.tar.bz2
skyhanni-ae48ef854f96fe5a6d60d9a52f9db680de77fdf3.zip
New sort logic.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt17
6 files changed, 12 insertions, 22 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt
index 245fa85af..949b3c4e3 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt
@@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.event.diana
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.sorted
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.OSUtils.isActive
import net.minecraft.client.Minecraft
@@ -85,7 +86,7 @@ class BurrowWarpHelper {
private fun getNearestWarpPoint(location: LorenzVec): WarpPoint {
val map = WarpPoint.values().filter { it.enabled }.map { it to it.distance(location) }
- return map.toList().sortedBy { (_, value) -> value }.first().first
+ return map.sorted().first().first
}
fun resetDisabledWarps() {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt
index f8a9d5c7f..0666581d4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt
@@ -6,11 +6,11 @@ import at.hannibal2.skyhanni.events.BurrowDetectEvent
import at.hannibal2.skyhanni.events.BurrowDugEvent
import at.hannibal2.skyhanni.events.EntityMoveEvent
import at.hannibal2.skyhanni.events.SoopyGuessBurrowEvent
-import at.hannibal2.skyhanni.test.GriffinUtils.draw3DLine
import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzVec
+import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
import at.hannibal2.skyhanni.utils.RenderUtils.drawColor
import at.hannibal2.skyhanni.utils.RenderUtils.drawString
import net.minecraft.client.Minecraft
@@ -198,7 +198,7 @@ class GriffinBurrowHelper {
var vector = target.subtract(animation)
- event.draw3DLine(animation.add(0.5, 0.5, 0.5), target.add(0.5, 0.5, 0.5), LorenzColor.WHITE, 2, true)
+ event.draw3DLine(animation.add(0.5, 0.5, 0.5), target.add(0.5, 0.5, 0.5), LorenzColor.WHITE.toColor(), 2, true)
vector = vector.multiply(1 / vector.length())
vector = vector.multiply(0.18)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt
index 8ddf0eba7..f2b188787 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt
@@ -4,7 +4,6 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent
import at.hannibal2.skyhanni.features.bazaar.BazaarApi
import at.hannibal2.skyhanni.features.bazaar.BazaarData
-import at.hannibal2.skyhanni.test.GriffinJavaUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
@@ -95,11 +94,11 @@ class CollectionCounter {
}
private fun updateDisplay() {
- val format = GriffinJavaUtils.formatInteger(itemAmount)
+ val format = LorenzUtils.formatInteger(itemAmount)
var gainText = ""
if (recentGain != 0) {
- gainText = "§a+" + GriffinJavaUtils.formatInteger(recentGain)
+ gainText = "§a+" + LorenzUtils.formatInteger(recentGain)
}
display = "$itemName collection: §e$format $gainText"
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt
index 44e9332f4..5adafb6b4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt
@@ -64,7 +64,7 @@ class NonGodPotEffectDisplay {
totalEffectsCount = 0
checkFooter = true
}
- for (effect in GriffinJavaUtils.sortByValue(activeEffects)) {
+ for (effect in activeEffects.sorted()) {
val label = effect.key
val until = effect.value
val seconds = (until - now) / 1000
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt
index d846ac42b..a622fa02a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt
@@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.sorted
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
@@ -91,7 +92,7 @@ class TiaRelayHelper {
resultDisplay.clear()
var i = 1
- for (entry in pitchMap.toList().sortedBy { (_, value) -> value }.toMap()) {
+ for (entry in pitchMap.sorted()) {
resultDisplay[entry.key] = i
i++
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt
index dc5ac9691..d054ded6c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt
@@ -1,10 +1,10 @@
package at.hannibal2.skyhanni.features.summonings
import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.test.GriffinJavaUtils
import at.hannibal2.skyhanni.utils.EntityUtils.getNameTagWith
import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.sorted
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils.drawString
import at.hannibal2.skyhanni.utils.getLorenzVec
@@ -57,20 +57,9 @@ class SummoningSoulsName {
map[mob] = distance
}
- val nearestMob = GriffinJavaUtils.sortByValueAsc(map).firstNotNullOfOrNull { it.key }
+ val nearestMob = map.sorted().firstNotNullOfOrNull { it.key }
if (nearestMob != null) {
-// val mobDistance = nearestMob.getLorenzVec().add(0.0, -1.4375, 0.0)
-// val distance = mobDistance.distance(soulLocation)
-// val diff = mobDistance.add(soulLocation.multiply(-1))
-
-// println(" ")
-// println("mobDistance: $mobDistance")
-// println("soulLocation: $soulLocation")
-// println("diff: $diff")
-// LorenzUtils.chat("distance: $distance")
- val name = mobsName[nearestMob]!!
-// LorenzUtils.chat("maybe its $name")
- souls[entity] = name
+ souls[entity] = mobsName[nearestMob]!!
}
}