aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
diff options
context:
space:
mode:
authorEmpa <42304516+ItsEmpa@users.noreply.github.com>2024-09-07 20:59:56 +0200
committerGitHub <noreply@github.com>2024-09-07 20:59:56 +0200
commitf40863a821218938b8f53f17a4441ad5c973d0e3 (patch)
tree7fad36578e589dafa9cc828c51088fae9cc4834e /src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
parente3b39759ad89a91dda2ef0549d0a62b58598ec1c (diff)
downloadskyhanni-f40863a821218938b8f53f17a4441ad5c973d0e3.tar.gz
skyhanni-f40863a821218938b8f53f17a4441ad5c973d0e3.tar.bz2
skyhanni-f40863a821218938b8f53f17a4441ad5c973d0e3.zip
Feature: Personal Compactor Overlay (#1869)
Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Co-authored-by: Cal <cwolfson58@gmail.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Co-authored-by: ItsEmpa <itsempa@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
index 82dbb7349..c271ef66c 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
@@ -16,6 +16,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.isInt
import at.hannibal2.skyhanni.utils.PrimitiveItemStack.Companion.makePrimitiveStack
import at.hannibal2.skyhanni.utils.json.BaseGsonBuilder
import at.hannibal2.skyhanni.utils.json.fromJson
+import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getItemId
import at.hannibal2.skyhanni.utils.system.PlatformUtils
import com.google.gson.JsonObject
import com.google.gson.JsonPrimitive
@@ -169,6 +170,16 @@ object NEUItems {
fun getInternalNameOrNull(nbt: NBTTagCompound): NEUInternalName? =
ItemResolutionQuery(manager).withItemNBT(nbt).resolveInternalName()?.asInternalName()
+ fun getInternalNameFromHypixelIdOrNull(hypixelId: String): NEUInternalName? {
+ val internalName = hypixelId.replace(':', '-')
+ return internalName.asInternalName().takeIf { it.getItemStackOrNull()?.getItemId() == internalName }
+ }
+
+ fun getInternalNameFromHypixelId(hypixelId: String): NEUInternalName =
+ getInternalNameFromHypixelIdOrNull(hypixelId)
+ ?: error("hypixel item id does not match internal name: $hypixelId")
+
+
@Deprecated("Moved to ItemPriceUtils", ReplaceWith(""))
fun NEUInternalName.getPrice(
priceSource: ItemPriceSource = ItemPriceSource.BAZAAR_INSTANT_BUY,