diff options
| author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-12 22:31:06 +0200 |
|---|---|---|
| committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-12 22:31:06 +0200 |
| commit | 70dfeb1e6b3f241731063d7014207b02b074bd8e (patch) | |
| tree | 6486c17c272cb72108676b9804753c979c8905c4 /src/main/java/at/hannibal2/skyhanni/features | |
| parent | 1a824ba175cbb3b31af86892e571fed9dc9ccf1b (diff) | |
| download | skyhanni-70dfeb1e6b3f241731063d7014207b02b074bd8e.tar.gz skyhanni-70dfeb1e6b3f241731063d7014207b02b074bd8e.tar.bz2 skyhanni-70dfeb1e6b3f241731063d7014207b02b074bd8e.zip | |
Added mayor election data and added Finnegan Farming Simulator support for crop milestone display
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt index 18b408666..78f3bf836 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.data.ClickType import at.hannibal2.skyhanni.data.GardenCropMilestones import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.getCounter import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.setCounter +import at.hannibal2.skyhanni.data.MayorElectionData import at.hannibal2.skyhanni.data.SendTitleHelper import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.features.garden.CropType.Companion.getCropType @@ -25,6 +26,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.* import kotlin.concurrent.fixedRateTimer +import kotlin.random.Random class GardenCropMilestoneDisplay { private var progressDisplay = listOf<List<Any>>() @@ -127,7 +129,8 @@ class GardenCropMilestoneDisplay { val crop = item.getCropType() ?: return if (cultivatingData.containsKey(crop)) { val old = cultivatingData[crop]!! - val addedCounter = counter - old + val finneganPerkFactor = if (finneganPerkActive() && Random.nextDouble() <= 0.25) 0.5 else 1.0 + val addedCounter = ((counter - old) * finneganPerkFactor).toInt() if (GardenCropMilestones.cropCounter.isEmpty()) { for (innerCrop in CropType.values()) { @@ -154,6 +157,9 @@ class GardenCropMilestoneDisplay { } } + private fun finneganPerkActive() = + config.forcefullyEnabledAlwaysFinnegan || MayorElectionData.isPerkActive("Finnegan", "Farming Simulator") + @SubscribeEvent fun onBlockClick(event: BlockClickEvent) { if (!isEnabled()) return |
