aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/BestiaryData.kt17
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/ChestValue.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt26
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt3
5 files changed, 12 insertions, 43 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/BestiaryData.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/BestiaryData.kt
index 626d24f03..76a46b320 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/BestiaryData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/BestiaryData.kt
@@ -5,12 +5,13 @@ import at.hannibal2.skyhanni.events.GuiContainerEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.InventoryCloseEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
-import at.hannibal2.skyhanni.utils.*
+import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
+import at.hannibal2.skyhanni.utils.LorenzColor
+import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.LorenzUtils.addButton
-import at.hannibal2.skyhanni.utils.LorenzUtils.toBoolean
-import at.hannibal2.skyhanni.utils.LorenzUtils.toInt
+import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber
import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNeeded
@@ -320,17 +321,17 @@ object BestiaryData {
newDisplay.addButton(
prefix = "§7Number Type: ",
- getName = NumberType.entries[config.replaceRoman.toInt()].type,
+ getName = NumberType.entries[if (config.replaceRoman) 1 else 0].type,
onChange = {
- config.replaceRoman = ((config.replaceRoman.toInt() + 1) % 2).toBoolean()
+ config.replaceRoman = !config.replaceRoman
update()
}
)
newDisplay.addButton(
prefix = "§7Hide Maxed: ",
- getName = HideMaxed.entries[config.hideMaxed.toInt()].b,
+ getName = HideMaxed.entries[if (config.hideMaxed) 1 else 0].type,
onChange = {
- config.hideMaxed = ((config.hideMaxed.toInt() + 1) % 2).toBoolean()
+ config.hideMaxed = !config.hideMaxed
update()
}
)
@@ -405,7 +406,7 @@ object BestiaryData {
HIGHEST_NEEDED_TIER("Highest kills needed to next tier"),
}
- enum class HideMaxed(val b: String) {
+ enum class HideMaxed(val type: String) {
NO("Show"),
YES("Hide")
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ChestValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ChestValue.kt
index 37f1d7c6e..b0228642b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/ChestValue.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ChestValue.kt
@@ -8,8 +8,6 @@ import at.hannibal2.skyhanni.utils.*
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.LorenzUtils.addButton
-import at.hannibal2.skyhanni.utils.LorenzUtils.toBoolean
-import at.hannibal2.skyhanni.utils.LorenzUtils.toInt
import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.RenderUtils.highlight
@@ -155,9 +153,9 @@ class ChestValue {
})
newDisplay.addButton("§7Display Type: ",
- getName = DisplayType.entries[config.alignedDisplay.toInt()].type,
+ getName = DisplayType.entries[if (config.alignedDisplay) 1 else 0].type,
onChange = {
- config.alignedDisplay = ((config.alignedDisplay.toInt() + 1) % 2).toBoolean()
+ config.alignedDisplay = !config.alignedDisplay
update()
})
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index a2bcc4020..71dfb1edb 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -474,7 +474,4 @@ object LorenzUtils {
javaClass.getDeclaredField("modifiers").makeAccessible().set(this, modifiers and (Modifier.FINAL.inv()))
return this
}
-
- fun Int.toBoolean() = this != 0
- fun Boolean.toInt() = if (!this) 0 else 1
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
index 3ad3e7a4d..d76251ddf 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
@@ -66,32 +66,6 @@ object NumberUtil {
}
}
- @JvmStatic
- fun format3(value: Number, digit: Int): String {
- @Suppress("NAME_SHADOWING")
- val value = value.toLong()
- //Long.MIN_VALUE == -Long.MIN_VALUE so we need an adjustment here
- if (value == Long.MIN_VALUE) return format3(Long.MIN_VALUE + 1, digit)
- if (value < 0) return "-" + format3(-value, digit)
- if (value < 1000) return value.toString() //deal with small numbers
-
- val (divideBy, suffix) = suffixes.floorEntry(value)
-
- var truncated = value / (divideBy / 10) //the number part of the output times 10
-
- val truncatedAt = if (suffix == "M") 1000 else if (suffix == "B") 1000000 else 100
-
- val hasDecimal = truncated < truncatedAt && truncated / 10.0 != (truncated / 10).toDouble()
-
- // Add check for value greater than 1000000000 (1 Billion)
- return if (value > 1000000000 && hasDecimal) {
- val decimalPart = (value % 1000000000) / 1000000 // Extract 3 digits after the decimal point
- "${(truncated / 10).toDouble().toString().take(digit + 2)}$suffix"
- } else {
- if (hasDecimal) (truncated / 10.0).toString().take(digit + 2) + suffix else (truncated / 10).toString() + suffix
- }
- }
-
/**
* This code was unmodified and taken under CC BY-SA 3.0 license
* @link https://stackoverflow.com/a/22186845
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt
index dabf428d4..7407d5c6b 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt
@@ -212,5 +212,4 @@ interface Renderable {
}
}
}
-}
-
+} \ No newline at end of file