diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-23 14:37:48 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-23 14:37:48 +0100 |
commit | 9b8b9c442e51c471f85361f79341ce998f8da2eb (patch) | |
tree | 1403bc700e84fc86f3fa22318485b58e8dc71a38 /src/main/java/at/hannibal2/skyhanni/data | |
parent | e7c8613f2bfbf5c93479e63c5d6fca78b525cfc4 (diff) | |
download | skyhanni-9b8b9c442e51c471f85361f79341ce998f8da2eb.tar.gz skyhanni-9b8b9c442e51c471f85361f79341ce998f8da2eb.tar.bz2 skyhanni-9b8b9c442e51c471f85361f79341ce998f8da2eb.zip |
Created CropType
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt index dcdf4360d..ba0d8d863 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.CropMilestoneUpdateEvent import at.hannibal2.skyhanni.events.InventoryOpenEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent +import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNeeded @@ -31,16 +32,9 @@ class GardenCropMilestones { @SubscribeEvent fun onProfileJoin(event: ProfileJoinEvent) { if (cropCounter.isEmpty()) { - cropCounter["Wheat"] = 0 - cropCounter["Carrot"] = 0 - cropCounter["Potato"] = 0 - cropCounter["Pumpkin"] = 0 - cropCounter["Sugar Cane"] = 0 - cropCounter["Melon"] = 0 - cropCounter["Cactus"] = 0 - cropCounter["Cocoa Beans"] = 0 - cropCounter["Mushroom"] = 0 - cropCounter["Nether Wart"] = 0 + for (crop in CropType.values()) { + cropCounter[crop] = 0 + } } } @@ -50,6 +44,7 @@ class GardenCropMilestones { for ((_, stack) in event.inventoryItems) { val cropName = stack.name?.removeColor() ?: continue + val crop = CropType.getByName(cropName) ?: continue val lore = stack.getLore() var cropForTier = 0L @@ -70,7 +65,7 @@ class GardenCropMilestones { if (matcher.matches()) { val rawNumber = matcher.group(1) val overflow = rawNumber.formatNumber() - cropCounter[cropName] = cropForTier + overflow + cropCounter[crop] = cropForTier + overflow } next = false } @@ -81,7 +76,7 @@ class GardenCropMilestones { } companion object { - val cropCounter: MutableMap<String, Long> get() = SkyHanniMod.feature.hidden.gardenCropCounter + val cropCounter: MutableMap<CropType, Long> get() = SkyHanniMod.feature.hidden.gardenCropCounter fun getTierForCrops(crops: Long): Int { var tier = 0 |