aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt2
3 files changed, 4 insertions, 16 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt
index b71633122..2e549313c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt
@@ -39,6 +39,7 @@ import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.RenderUtils.drawBorder
import at.hannibal2.skyhanni.utils.RenderUtils.highlight
import at.hannibal2.skyhanni.utils.SimpleTimeMark
+import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.hasAttributes
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isMuseumDonated
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isRiftExportable
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isRiftTransferable
@@ -330,7 +331,7 @@ object HideNotClickableItems {
showGreenLine = true
- if (ItemUtils.hasAttributes(stack)) return false
+ if (stack.hasAttributes()) return false
hideReason = "This item has no attributes!"
return true
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
index 580ee2a95..95dad660c 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
@@ -14,8 +14,6 @@ import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getEnchantments
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isRecombobulated
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.StringUtils.removeResets
-import com.google.gson.GsonBuilder
-import com.google.gson.JsonObject
import io.github.moulberry.notenoughupdates.recipes.NeuRecipe
import net.minecraft.client.Minecraft
import net.minecraft.init.Items
@@ -78,19 +76,6 @@ object ItemUtils {
return list
}
- fun hasAttributes(stack: ItemStack): Boolean {
- if (!stack.hasTagCompound()) return false
- val tagCompound = stack.tagCompound
- if (!tagCompound.hasKey("ExtraAttributes")) return false
- val extraAttributes = tagCompound.getCompoundTag("ExtraAttributes")
- try {
- val json = GsonBuilder().create().fromJson(extraAttributes.toString(), JsonObject::class.java)
- return json.has("attributes")
- } catch (_: Exception) {
- return false
- }
- }
-
fun ItemStack.getInternalName() = getInternalNameOrNull() ?: NEUInternalName.NONE
fun ItemStack.getInternalNameOrNull(): NEUInternalName? {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
index 2b3ece2c7..7d38fa58b 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
@@ -151,6 +151,8 @@ object SkyBlockItemModifierUtils {
}.sortedBy { it.first }
}
+ fun ItemStack.hasAttributes() = getAttributes() != null
+
fun ItemStack.getReforgeName() = getAttributeString("modifier")?.let {
when {
it == "pitchin" -> "pitchin_koi"