diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-20 02:47:29 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-20 03:57:21 +0200 |
commit | 526b46963732ba525c098ca5cd194d8b4889e22a (patch) | |
tree | 469af39db48495d8a1747e48c0a18df7fb46315d /src/main | |
parent | b6a4614e91c74f748fabae832b8ef1f1b75c4410 (diff) | |
download | skyhanni-526b46963732ba525c098ca5cd194d8b4889e22a.tar.gz skyhanni-526b46963732ba525c098ca5cd194d8b4889e22a.tar.bz2 skyhanni-526b46963732ba525c098ca5cd194d8b4889e22a.zip |
Hide Not Rift-transferable items in Rift Transfer Chest as part of hide not clickable items feature
Diffstat (limited to 'src/main')
3 files changed, 44 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..9b93e5293 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,8 @@ 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.isRiftExportable +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 +175,34 @@ 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 + } + if (RiftAPI.inRift()) { + val riftExportable = stack.isRiftExportable() ?: return true + if (riftExportable) { + 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..b9beea397 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/CachedItemData.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/CachedItemData.kt @@ -4,4 +4,6 @@ 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, + /** null = not loaded */ var riftExportable: 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..af0f26bcc 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,22 @@ 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 + } + + fun ItemStack.isRiftExportable(): Boolean? { + val data = cachedData + if (data.riftExportable == null) { + data.riftExportable = getLore().any { it == "§5§kX§5 Rift-Exportable §kX" } + } + return data.riftExportable + } + private fun ItemStack.getPetInfo() = ConfigManager.gson.fromJson(getExtraAttributes()?.getString("petInfo"), JsonObject::class.java) @@ -210,7 +227,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" |