summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/event
diff options
context:
space:
mode:
authorEmpa <42304516+ItsEmpa@users.noreply.github.com>2024-07-15 19:54:04 +0200
committerGitHub <noreply@github.com>2024-07-15 19:54:04 +0200
commitba091f8c3cfa665e83c789e1a5845d1ae0f26b6b (patch)
treef52c6c37addc52c27452e0a161ee0b54485e093d /src/main/java/at/hannibal2/skyhanni/features/event
parent2de249337b48f5de439afd16c6793abbe3084a25 (diff)
downloadskyhanni-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.kt8
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)