diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2024-04-22 23:29:51 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-22 15:29:51 +0200 |
commit | 698655174421c94e332aadb18d0df3fcd7f20ca3 (patch) | |
tree | f7543f019aca19abdd1c5f9e20eeeddc0b55ea61 /src/main/java/at/hannibal2/skyhanni | |
parent | e36598057b2d09ff90c0c16421878bd384e301ee (diff) | |
download | skyhanni-698655174421c94e332aadb18d0df3fcd7f20ca3.tar.gz skyhanni-698655174421c94e332aadb18d0df3fcd7f20ca3.tar.bz2 skyhanni-698655174421c94e332aadb18d0df3fcd7f20ca3.zip |
Fix: Use recalculating value for all egglocator (#1499)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
2 files changed, 6 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/HoppityEggLocator.kt b/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/HoppityEggLocator.kt index eee3abc34..ff271b2b4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/HoppityEggLocator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/HoppityEggLocator.kt @@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName +import at.hannibal2.skyhanni.utils.RecalculatingValue import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -207,7 +208,10 @@ object HoppityEggLocator { && ChocolateFactoryAPI.isHoppityEvent() private val ItemStack.isLocatorItem get() = getInternalName() == locatorItem - fun hasLocatorInInventory() = InventoryUtils.getItemsInOwnInventory().any { it.isLocatorItem } + + fun hasLocatorInInventory() = RecalculatingValue(1.seconds) { + LorenzUtils.inSkyBlock && InventoryUtils.getItemsInOwnInventory().any { it.isLocatorItem } + }.getValue() private fun LorenzVec.getEggLocationWeight(firstPoint: LorenzVec, secondPoint: LorenzVec): Double { val distToLine = this.distanceToLine(firstPoint, secondPoint) diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/HoppityEggsManager.kt b/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/HoppityEggsManager.kt index caaabc8c5..f11fb426d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/HoppityEggsManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/HoppityEggsManager.kt @@ -10,7 +10,6 @@ import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.RecalculatingValue import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.fromNow import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -94,17 +93,13 @@ object HoppityEggsManager { } } - private val hasLocatorInInventory = RecalculatingValue(1.seconds) { - LorenzUtils.inSkyBlock && HoppityEggLocator.hasLocatorInInventory() - } - @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!LorenzUtils.inSkyBlock) return if (!config.showClaimedEggs) return if (ReminderUtils.isBusy()) return if (!ChocolateFactoryAPI.isHoppityEvent()) return - if (!hasLocatorInInventory.getValue()) return + if (!HoppityEggLocator.hasLocatorInInventory()) return val displayList = HoppityEggType.entries .filter { !it.isClaimed() } |