aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-22 22:40:46 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-22 22:40:46 +0200
commit4dec8bdc1c8131c93e80f078d244790621b76f14 (patch)
tree57b010d0c21ec82b49c42e2682ae661df93dff58 /src/main
parent08a3ec8ec388835373b5363cd1219601bfdcc1ad (diff)
downloadskyhanni-4dec8bdc1c8131c93e80f078d244790621b76f14.tar.gz
skyhanni-4dec8bdc1c8131c93e80f078d244790621b76f14.tar.bz2
skyhanni-4dec8bdc1c8131c93e80f078d244790621b76f14.zip
using blocks per second to decide if the speed data should start
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt
index ab811b586..ed28d59f4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt
@@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.data.TitleUtils
import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.features.garden.CropType
import at.hannibal2.skyhanni.features.garden.CropType.Companion.getCropType
+import at.hannibal2.skyhanni.features.garden.FarmingFortuneDisplay
import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.features.garden.GardenAPI.addCropIcon
import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType
@@ -165,7 +166,6 @@ class GardenCropMilestoneDisplay {
private var currentSpeed = 0
private var averageSpeedPerSecond = 0
- private var countInLastSecond = 0
private val allCounters = mutableListOf<Int>()
private var lastItemInHand: ItemStack? = null
private var currentCrop: CropType? = null
@@ -175,7 +175,7 @@ class GardenCropMilestoneDisplay {
private fun resetSpeed() {
currentSpeed = 0
averageSpeedPerSecond = 0
- countInLastSecond = 0
+ blocksBroken = 0
allCounters.clear()
}
@@ -196,14 +196,16 @@ class GardenCropMilestoneDisplay {
currentSpeed = (currentSpeed.toDouble() * 0.8).toInt()
}
- if (countInLastSecond > 8) {
+ lastBlocksPerSecond = blocksBroken
+ blocksBroken = 0
+
+ if (lastBlocksPerSecond >= 5) {
allCounters.add(currentSpeed)
while (allCounters.size > 30) {
allCounters.removeFirst()
}
averageSpeedPerSecond = allCounters.average().toInt()
}
- countInLastSecond = 0
if (finneganPerkActive()) {
currentCrop?.let {
@@ -211,15 +213,11 @@ class GardenCropMilestoneDisplay {
}
}
currentSpeed = 0
-
- lastBlocksPerSecond = blocksBroken
- blocksBroken = 0
}
private fun calculateSpeed(addedCounter: Int) {
currentSpeed += addedCounter
- countInLastSecond++
}
@SubscribeEvent