diff options
| author | Empa <42304516+ItsEmpa@users.noreply.github.com> | 2024-07-15 19:54:04 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-15 19:54:04 +0200 |
| commit | ba091f8c3cfa665e83c789e1a5845d1ae0f26b6b (patch) | |
| tree | f52c6c37addc52c27452e0a161ee0b54485e093d /src/main/java/at/hannibal2/skyhanni/features/event | |
| parent | 2de249337b48f5de439afd16c6793abbe3084a25 (diff) | |
| download | skyhanni-ba091f8c3cfa665e83c789e1a5845d1ae0f26b6b.tar.gz skyhanni-ba091f8c3cfa665e83c789e1a5845d1ae0f26b6b.tar.bz2 skyhanni-ba091f8c3cfa665e83c789e1a5845d1ae0f26b6b.zip | |
Backend: RecalculatingValue as a ReadOnlyProperty (#2151)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/event')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt index 419cd115c..aa291eb92 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt @@ -166,7 +166,7 @@ object HoppityEggLocator { } private fun shouldShowAllEggs() = - config.showAllWaypoints && !hasLocatorInHotbar() && HoppityEggType.eggsRemaining() + config.showAllWaypoints && !locatorInHotbar && HoppityEggType.eggsRemaining() fun eggFound() { resetData() @@ -175,7 +175,7 @@ object HoppityEggLocator { @SubscribeEvent fun onReceiveParticle(event: ReceiveParticleEvent) { if (!isEnabled()) return - if (!hasLocatorInHotbar()) return + if (!locatorInHotbar) return if (!event.isVillagerParticle() && !event.isEnchantmentParticle()) return val lastParticlePosition = lastParticlePosition ?: run { @@ -281,9 +281,9 @@ object HoppityEggLocator { private val ItemStack.isLocatorItem get() = getInternalName() == locatorItem - private fun hasLocatorInHotbar() = RecalculatingValue(1.seconds) { + private val locatorInHotbar by RecalculatingValue(1.seconds) { LorenzUtils.inSkyBlock && InventoryUtils.getItemsInHotbar().any { it.isLocatorItem } - }.getValue() + } private fun LorenzVec.getEggLocationWeight(firstPoint: LorenzVec, secondPoint: LorenzVec): Double { val distToLine = this.distanceToLine(firstPoint, secondPoint) |
