aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-20 02:47:29 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-20 02:47:29 +0200
commit31f446d3dbfe3551f35a885b913b4c5a1a1a5329 (patch)
tree39b525c7fbac2d8212129768c883983fd56418db /src/main/java
parentb6a4614e91c74f748fabae832b8ef1f1b75c4410 (diff)
downloadskyhanni-31f446d3dbfe3551f35a885b913b4c5a1a1a5329.tar.gz
skyhanni-31f446d3dbfe3551f35a885b913b4c5a1a1a5329.tar.bz2
skyhanni-31f446d3dbfe3551f35a885b913b4c5a1a1a5329.zip
Hide Not Rift-transferable items in Rift Transfer Chest as part of hide not clickable items feature
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt19
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/CachedItemData.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt11
3 files changed, 28 insertions, 3 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 f51b625e6..d3cd1eb93 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt
@@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.features.bazaar.BazaarApi
import at.hannibal2.skyhanni.features.garden.composter.ComposterOverlay
import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorFeatures
+import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI
import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI.motesNpcPrice
import at.hannibal2.skyhanni.utils.*
import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName
@@ -16,6 +17,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.isEnchanted
import at.hannibal2.skyhanni.utils.ItemUtils.isVanilla
+import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isRiftTransferable
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import com.google.gson.JsonObject
import net.minecraft.client.Minecraft
@@ -172,15 +174,28 @@ class HideNotClickableItems {
hideYourEquipment(chestName, stack) -> true
hideComposter(chestName, stack) -> true
hideRiftMotesGrubber(chestName, stack) -> true
+ hideRiftTransferChest(chestName, stack) -> true
else -> {
false
}
}
}
- private fun hideRiftMotesGrubber(chestName: String, stack: ItemStack): Boolean {
-// if (!RiftAPI.inRift()) return false
+ private fun hideRiftTransferChest(chestName: String, stack: ItemStack): Boolean {
+ if (chestName != "Rift Transfer Chest") return false
+
+ reverseColor = true
+ val riftTransferable = stack.isRiftTransferable() ?: return true
+ if (riftTransferable) {
+ return false
+ }
+ hideReason = "Not Rift-Transferable!"
+ return true
+ }
+
+ private fun hideRiftMotesGrubber(chestName: String, stack: ItemStack): Boolean {
+ if (!RiftAPI.inRift()) return false
if (chestName != "Motes Grubber") return false
reverseColor = true
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/CachedItemData.kt b/src/main/java/at/hannibal2/skyhanni/utils/CachedItemData.kt
index b6cf391b7..449859639 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/CachedItemData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/CachedItemData.kt
@@ -4,4 +4,5 @@ data class CachedItemData(
/** -1 = not loaded */ var petCandies: Int? = -1,
/** "" = not loaded */ var heldItem: String? = "",
/** -1 = not loaded */ var sackInASack: Int? = -1,
+ /** null = not loaded */ var riftTransferable: Boolean? = null,
) \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
index 6292bf7e0..a8e23f8d8 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
@@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.utils
import at.hannibal2.skyhanni.config.ConfigManager
import at.hannibal2.skyhanni.mixins.hooks.ItemStackCachedData
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
+import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import com.google.gson.JsonObject
@@ -59,6 +60,14 @@ object SkyBlockItemModifierUtils {
return data.heldItem
}
+ fun ItemStack.isRiftTransferable(): Boolean? {
+ val data = cachedData
+ if (data.riftTransferable == null) {
+ data.riftTransferable = getLore().any { it == "§5§kX§5 Rift-Transferable §kX" }
+ }
+ return data.riftTransferable
+ }
+
private fun ItemStack.getPetInfo() =
ConfigManager.gson.fromJson(getExtraAttributes()?.getString("petInfo"), JsonObject::class.java)
@@ -210,7 +219,7 @@ object SkyBlockItemModifierUtils {
return getExtraAttributes()?.hasKey(label) ?: false
}
- private fun ItemStack.getExtraAttributes() = tagCompound?.getCompoundTag("ExtraAttributes")
+ fun ItemStack.getExtraAttributes() = tagCompound?.getCompoundTag("ExtraAttributes")
class GemstoneSlot(val type: GemstoneType, val quality: GemstoneQuality) {
fun getInternalName() = "${quality}_${type}_GEM"