diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-08-13 21:28:01 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-08-13 21:28:01 +0200 |
commit | 586a7cf962abded29d4be0da6d3050c0062f4e76 (patch) | |
tree | deab232d299e3db11dd501ee335a455047e2b923 /src/main/java/at/hannibal2/skyhanni/features/fishing | |
parent | eadb0b8044d844216e598984eb654ca06338c826 (diff) | |
download | skyhanni-586a7cf962abded29d4be0da6d3050c0062f4e76.tar.gz skyhanni-586a7cf962abded29d4be0da6d3050c0062f4e76.tar.bz2 skyhanni-586a7cf962abded29d4be0da6d3050c0062f4e76.zip |
Fixed sea creature timer not working on barn
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/fishing')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt index 5eff79532..557a1a508 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt @@ -33,8 +33,7 @@ class BarnFishingTimer { if (event.isMod(5)) checkMobs() if (event.isMod(7)) tryPlaySound() - val key = if (Keyboard.getEventKey() == 0) Keyboard.getEventCharacter().code + 256 else Keyboard.getEventKey() - if (key == config.manualResetTimer) startTime = System.currentTimeMillis() + if (Keyboard.isKeyDown(config.manualResetTimer)) startTime = System.currentTimeMillis() } private fun tryPlaySound() { @@ -48,7 +47,8 @@ class BarnFishingTimer { } private fun checkMobs() { - val newCount = if (inHollows) countHollowsMobs() else countMobs() + // We ignore sea creatures more than 10 blocks away in crystal hollows + val newCount = if (inHollows) countMobs(10) else countMobs(40) if (currentCount == 0 && newCount > 0) { startTime = System.currentTimeMillis() @@ -64,13 +64,9 @@ class BarnFishingTimer { } } - private fun countHollowsMobs() = EntityUtils.getEntitiesNextToPlayer<EntityArmorStand>(10.0) + private fun countMobs(radius: Int) = EntityUtils.getEntitiesNextToPlayer<EntityArmorStand>(radius.toDouble()) .count { entity -> SeaCreatureManager.allFishingMobNames.any { entity.name.contains(it) } } - private fun countMobs() = EntityUtils.getEntities<EntityArmorStand>() - .map { it.name } - .count { it.endsWith("§c❤") } - private fun isRightLocation(): Boolean { if (config.barnTimerCrystalHollows && IslandType.CRYSTAL_HOLLOWS.isInIsland()) { inHollows = true @@ -78,7 +74,7 @@ class BarnFishingTimer { } inHollows = false - if (IslandType.THE_FARMING_ISLANDS.isInIsland()) { + if (!IslandType.THE_FARMING_ISLANDS.isInIsland()) { return LocationUtils.playerLocation().distance(barnLocation) < 50 } |