aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-09 15:28:39 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-09 15:28:39 +0200
commit9cd32579cfec4fbfdd710442841c6e712a786c53 (patch)
tree3afedcefc59316259c3012cbdb1589bf9af36069 /src/main/java/at/hannibal2/skyhanni/utils
parent0efd1b797bbca2eb144b3ec795217ee2e9077c23 (diff)
downloadskyhanni-9cd32579cfec4fbfdd710442841c6e712a786c53.tar.gz
skyhanni-9cd32579cfec4fbfdd710442841c6e712a786c53.tar.bz2
skyhanni-9cd32579cfec4fbfdd710442841c6e712a786c53.zip
Using NEUInternalName for all bazaar data cases
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt3
3 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
index c055ff42b..d90c16ded 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
@@ -226,4 +226,11 @@ object ItemUtils {
fun NEUInternalName.getItemNameOrNull() = getItemStack().name
fun NEUInternalName.getItemName() = getItemNameOrNull() ?: error("No item name found for $this")
+
+ fun NEUInternalName.getNameWithEnchantment(): String {
+ if (equals("WISP_POTION")) {
+ return "§fWisp's Ice-Flavored Water"
+ }
+ return getItemStack().nameWithEnchantment ?: error("Could not find item name for $this")
+ }
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index 9c02fc1cd..6a2dd34fc 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.data.HypixelData
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.features.dungeon.DungeonData
import at.hannibal2.skyhanni.test.TestBingo
+import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.StringUtils.toDashlessUUID
import at.hannibal2.skyhanni.utils.renderables.Renderable
@@ -196,7 +197,7 @@ object LorenzUtils {
}
// (key -> value) -> (sorting value -> key item icon)
- fun fillTable(list: MutableList<List<Any>>, data: MutableMap<Pair<String, String>, Pair<Double, String>>) {
+ fun fillTable(list: MutableList<List<Any>>, data: MutableMap<Pair<String, String>, Pair<Double, NEUInternalName>>) {
val keys = data.mapValues { (_, v) -> v.first }.sortedDesc().keys
val renderer = Minecraft.getMinecraft().fontRendererObj
val longest = keys.map { it.first }.maxOfOrNull { renderer.getStringWidth(it.removeColor()) } ?: 0
@@ -208,7 +209,7 @@ object LorenzUtils {
displayName += " "
}
- NEUItems.getItemStackOrNull(data[pair]!!.second)?.let {
+ data[pair]!!.second.getItemStackOrNull()?.let {
list.add(listOf(it, "$displayName $second"))
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
index d530e79df..ce44e3d64 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
@@ -83,9 +83,6 @@ object NEUItems {
return map
}
- // TODO remove
- fun getRawInternalNameOrNull(itemName: String) = getInternalNameOrNull(itemName)?.asString()
-
fun getInternalNameOrNull(itemName: String): NEUInternalName? {
val lowercase = itemName.lowercase()
if (itemNameCache.containsKey(lowercase)) {