aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/garden
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-07 23:37:18 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-07 23:37:18 +0200
commit02ac961b3f1a371302963559e875698de8eb7a1d (patch)
tree6432f510a74cc9381610466442ca023de6498a8a /src/main/java/at/hannibal2/skyhanni/features/garden
parent8b2bc18775d69d4ab854eed7e3e10e36085043fd (diff)
downloadskyhanni-02ac961b3f1a371302963559e875698de8eb7a1d.tar.gz
skyhanni-02ac961b3f1a371302963559e875698de8eb7a1d.tar.bz2
skyhanni-02ac961b3f1a371302963559e875698de8eb7a1d.zip
replace enum.getEntries() to enum.entries and using .addSelector<Enum>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/CropPage.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneAverage.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt2
22 files changed, 48 insertions, 44 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt
index 4c5f30ad3..1a761f0ae 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt
@@ -32,7 +32,7 @@ class AnitaMedalProfit {
;
}
- private fun getMedal(name: String) = MedalType.values().firstOrNull { it.displayName == name }
+ private fun getMedal(name: String) = MedalType.entries.firstOrNull { it.displayName == name }
@SubscribeEvent
fun onInventoryClose(event: InventoryCloseEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt
index b895c6511..c4269ce2e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt
@@ -8,7 +8,7 @@ enum class CropAccessory(val internalName: String, private val affectedCrops: Se
setOf(CropType.WHEAT, CropType.POTATO, CropType.CARROT, CropType.COCOA_BEANS, CropType.MELON, CropType.PUMPKIN),
20.0, Pair("SQUASH", 128)
),
- FERMENTO("FERMENTO_ARTIFACT", CropType.values().toSet(), 30.0, Pair("CONDENSED_FERMENTO", 8)),
+ FERMENTO("FERMENTO_ARTIFACT", CropType.entries.toSet(), 30.0, Pair("CONDENSED_FERMENTO", 8)),
;
fun getFortune(cropType: CropType): Double {
@@ -16,6 +16,6 @@ enum class CropAccessory(val internalName: String, private val affectedCrops: Se
}
companion object {
- fun getByName(internalName: String) = values().firstOrNull { it.internalName == internalName }
+ fun getByName(internalName: String) = entries.firstOrNull { it.internalName == internalName }
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt
index ed6138082..084c8d9e9 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt
@@ -36,7 +36,7 @@ enum class CropType(
fun getByNameOrNull(itemName: String): CropType? {
if (itemName == "Red Mushroom" || itemName == "Brown Mushroom") return MUSHROOM
if (itemName == "Seeds") return WHEAT
- return values().firstOrNull { it.cropName == itemName }
+ return entries.firstOrNull { it.cropName == itemName }
}
fun getByName(name: String) = getByNameOrNull(name) ?: throw RuntimeException("No valid crop type '$name'")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt
index 72d1d1dc6..64952a625 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt
@@ -127,7 +127,7 @@ object GardenAPI {
fun ItemStack.getCropType(): CropType? {
val internalName = getInternalName()
- return CropType.values().firstOrNull { internalName.startsWith(it.toolName) }
+ return CropType.entries.firstOrNull { internalName.startsWith(it.toolName) }
}
fun readCounter(itemStack: ItemStack): Long = itemStack.getHoeCounter() ?: itemStack.getCultivatingCounter() ?: -1L
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt
index 7905890ec..6f5e9abe0 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt
@@ -38,7 +38,7 @@ class GardenOptimalSpeed {
@SubscribeEvent
fun onGuiOpen(event: GuiOpenEvent) {
- rancherOverlayList = CropType.values().map { crop ->
+ rancherOverlayList = CropType.entries.map { crop ->
listOf(crop.icon, Renderable.link("${crop.cropName} - ${crop.getOptimalSpeed()}") {
LorenzUtils.setTextIntoSign("${crop.getOptimalSpeed()}")
})
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt
index 9b06240ad..38132e8b6 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt
@@ -117,7 +117,7 @@ class ComposterDisplay {
}
if (next) {
if (line == "") break
- for (type in DataType.values()) {
+ for (type in DataType.entries) {
type.pattern.matchMatcher(line) {
newData[type] = group(1)
}
@@ -125,7 +125,7 @@ class ComposterDisplay {
}
}
- for (type in DataType.values()) {
+ for (type in DataType.entries) {
if (!newData.containsKey(type)) {
tabListData = emptyMap()
return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
index 8943a2092..76825184a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
@@ -122,7 +122,7 @@ class ComposterOverlay {
fun onTooltip(event: ItemTooltipEvent) {
if (inComposterUpgrades) {
update()
- for (upgrade in ComposterUpgrade.values()) {
+ for (upgrade in ComposterUpgrade.entries) {
event.itemStack?.name?.let {
if (it.contains(upgrade.displayName)) {
maxLevel = ComposterUpgrade.regex.matchMatcher(it) {
@@ -276,13 +276,15 @@ class ComposterOverlay {
val fuelItem = currentFuelItem ?: return
if (organicMatterItem == "" || fuelItem == "") return
- newList.addSelector("§7Per ", TimeType.values(),
+ newList.addSelector<TimeType>(
+ "§7Per ",
getName = { type -> type.display },
isCurrent = { it == currentTimeType },
onChange = {
currentTimeType = it
update()
- })
+ }
+ )
val list = mutableListOf<Any>()
list.add("§7Using: ")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt
index d0a22dc25..e0b0961be 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt
@@ -104,7 +104,7 @@ object FarmingContestAPI {
cropPattern.matchMatcher(it) { CropType.getByName(group("crop")) }
} ?: error("Crop not found in lore!")
- val brackets = ContestBracket.values().associateWith { bracket ->
+ val brackets = ContestBracket.entries.associateWith { bracket ->
lore.firstNotNullOfOrNull {
bracket.pattern.matchMatcher(it) {
group("amount").replace(",", "").toInt()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt
index a2b5c10a8..a6ef0d4f1 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt
@@ -59,14 +59,14 @@ class JacobContestFFNeededDisplay {
val crop = contest.crop
add(listOf("§7For this ", crop.icon, "§7${crop.cropName} contest:"))
- for (bracket in ContestBracket.values()) {
+ for (bracket in ContestBracket.entries) {
addAsSingletonList(getLine(bracket, contest.brackets, crop))
}
addAsSingletonList("")
val (size, averages) = FarmingContestAPI.calculateAverages(crop)
add(listOf("§7For the last §e$size ", crop.icon, "§7${crop.cropName} contests:"))
- for (bracket in ContestBracket.values()) {
+ for (bracket in ContestBracket.entries) {
addAsSingletonList(getLine(bracket, averages, crop))
}
addAsSingletonList("")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt
index 09167dd76..7b0f01015 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt
@@ -34,7 +34,7 @@ class JacobContestTimeNeeded {
private fun update() {
val sorted = mutableMapOf<CropType, Double>()
val map = mutableMapOf<CropType, Renderable>()
- for (crop in CropType.values()) {
+ for (crop in CropType.entries) {
val speed = crop.getSpeed()
if (speed == null) {
sorted[crop] = Double.MAX_VALUE
@@ -98,13 +98,15 @@ class JacobContestTimeNeeded {
this.display = buildList {
addAsSingletonList("§e§lTime Needed for ${currentBracket.displayName} §eMedal!")
- addSelector("§7Bracket: ", ContestBracket.values(),
+ addSelector<ContestBracket>(
+ "§7Bracket: ",
getName = { type -> type.name.lowercase() },
isCurrent = { it == currentBracket },
onChange = {
currentBracket = it
update()
- })
+ }
+ )
addAsSingletonList("")
for (crop in sorted.sorted().keys) {
val text = map[crop]!!
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt
index b079782a8..08882db71 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt
@@ -75,7 +75,7 @@ class CropSpeedMeter {
fun onCropMilestoneUpdate(event: CropMilestoneUpdateEvent) {
if (!isEnabled()) return
val counters = mutableMapOf<CropType, Long>()
- for (cropType in CropType.values()) {
+ for (cropType in CropType.entries) {
counters[cropType] = cropType.getCounter()
}
if (startCrops.isEmpty()) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt
index e4faf5f61..ea685338f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt
@@ -32,7 +32,7 @@ class FarmingArmorDrops {
@SubscribeEvent
fun onChat(event: LorenzChatEvent) {
- for (dropType in ArmorDropType.values()) {
+ for (dropType in ArmorDropType.entries) {
if (dropType.chatMessage == event.message) {
addDrop(dropType)
if (config.farmingArmorDropsHideChat) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt
index e2b5190c6..cbf4596c4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt
@@ -337,7 +337,7 @@ class FarmingWeightDisplay {
private fun calculateCollectionWeight(): MutableMap<CropType, Double> {
val weightPerCrop = mutableMapOf<CropType, Double>()
var totalWeight = 0.0
- for (crop in CropType.values()) {
+ for (crop in CropType.entries) {
val weight = crop.getLocalCounter() / crop.getFactor()
weightPerCrop[crop] = weight
totalWeight += weight
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt
index ad9f98e6e..efdf267ef 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt
@@ -26,7 +26,7 @@ class GardenBestCropTime {
}
fun updateTimeTillNextCrop() {
- for (crop in CropType.values()) {
+ for (crop in CropType.entries) {
val speed = crop.getSpeed() ?: continue
if (crop.isMaxed()) continue
@@ -50,7 +50,7 @@ class GardenBestCropTime {
fun drawBestDisplay(currentCrop: CropType?): List<List<Any>> {
val newList = mutableListOf<List<Any>>()
- if (timeTillNextCrop.size < CropType.values().size) {
+ if (timeTillNextCrop.size < CropType.entries.size) {
updateTimeTillNextCrop()
}
@@ -93,7 +93,7 @@ class GardenBestCropTime {
for (crop in sorted.keys) {
if (crop.isMaxed()) continue
val millis = timeTillNextCrop[crop]!!
- val biggestUnit = TimeUnit.values()[config.cropMilestoneHighestTimeFormat.get()]
+ val biggestUnit = TimeUnit.entries[config.cropMilestoneHighestTimeFormat.get()]
val duration = TimeUtils.formatDuration(millis, biggestUnit, maxUnits = 2)
val isCurrent = crop == currentCrop
number++
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 460908ccd..f6d0fe0b4 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
@@ -182,7 +182,7 @@ object GardenCropMilestoneDisplay {
val missingTimeSeconds = missing / farmingFortuneSpeed
val millis = missingTimeSeconds * 1000
GardenBestCropTime.timeTillNextCrop[crop] = millis
- val biggestUnit = TimeUnit.values()[config.cropMilestoneHighestTimeFormat.get()]
+ val biggestUnit = TimeUnit.entries[config.cropMilestoneHighestTimeFormat.get()]
val duration = TimeUtils.formatDuration(millis, biggestUnit)
tryWarn(millis, "§b${crop.cropName} $nextTier in $duration")
val speedText = "§7In §b$duration"
@@ -276,7 +276,7 @@ object GardenCropMilestoneDisplay {
val missingTimeSeconds = missing / blocksPerSecond
val millis = missingTimeSeconds * 1000
- val biggestUnit = TimeUnit.values()[config.cropMilestoneHighestTimeFormat.get()]
+ val biggestUnit = TimeUnit.entries[config.cropMilestoneHighestTimeFormat.get()]
val duration = TimeUtils.formatDuration(millis.toLong(), biggestUnit)
lineMap[3] = Collections.singletonList("§7In §b$duration")
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt
index 424bec2a6..c9c645429 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt
@@ -54,7 +54,7 @@ class CaptureFarmingGear {
//todo better fall back items
//todo Daedalus axe
} else {
- for (item in FarmingItems.values()) {
+ for (item in FarmingItems.entries) {
if (item.name == currentCrop.name) {
farmingItems[item] = itemStack
}
@@ -64,7 +64,7 @@ class CaptureFarmingGear {
if (armor == null) continue
val split = armor.getInternalName().split("_")
if (split.first() in farmingSets) {
- for (item in FarmingItems.values()) {
+ for (item in FarmingItems.entries) {
if (item.name == split.last()) {
farmingItems[item] = armor
}
@@ -94,7 +94,7 @@ class CaptureFarmingGear {
for ((_, slot) in event.inventoryItems) {
val split = slot.getInternalName().split("_")
if (split.first() == "LOTUS") {
- for (item in FarmingItems.values()) {
+ for (item in FarmingItems.entries) {
if (item.name == split.last()) {
farmingItems[item] = slot
outdatedItems[item] = false
@@ -208,7 +208,7 @@ class CaptureFarmingGear {
}
lotusUpgradePattern.matchMatcher(msg) {
val piece = group("piece").uppercase()
- for (item in FarmingItems.values()) {
+ for (item in FarmingItems.entries) {
if (item.name == piece) {
outdatedItems[item] = true
}
@@ -216,7 +216,7 @@ class CaptureFarmingGear {
}
petLevelUpPattern.matchMatcher(msg) {
val pet = group("pet").uppercase()
- for (item in FarmingItems.values()) {
+ for (item in FarmingItems.entries) {
if (item.name.contains(pet)) {
outdatedItems[item] = true
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt
index 78c4e0c59..032c97547 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt
@@ -67,7 +67,7 @@ open class FFGuideGUI : GuiScreen() {
pages[FortuneGuidePage.UPGRADES] = UpgradePage()
if (currentCrop != null) {
- for (item in FarmingItems.values()) {
+ for (item in FarmingItems.entries) {
if (item.name == currentCrop?.name) {
FFStats.getCropStats(currentCrop!!, item.getItem())
}
@@ -216,7 +216,7 @@ open class FFGuideGUI : GuiScreen() {
}
}
}
- for (crop in CropType.values()) {
+ for (crop in CropType.entries) {
x += 30
if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x, y, 25, 28)) {
SoundUtils.playClickSound()
@@ -225,7 +225,7 @@ open class FFGuideGUI : GuiScreen() {
if (selectedPage == FortuneGuidePage.OVERVIEW) {
selectedPage = FortuneGuidePage.CROP
}
- for (item in FarmingItems.values()) {
+ for (item in FarmingItems.entries) {
if (item.name == crop.name) {
FFStats.getCropStats(crop, item.getItem())
FortuneUpgrades.getCropSpecific(item.getItem())
@@ -234,14 +234,14 @@ open class FFGuideGUI : GuiScreen() {
} else {
if (selectedPage == FortuneGuidePage.CROP) {
selectedPage = FortuneGuidePage.UPGRADES
- for (item in FarmingItems.values()) {
+ for (item in FarmingItems.entries) {
if (item.name == crop.name) {
FortuneUpgrades.getCropSpecific(item.getItem())
}
}
} else {
selectedPage = FortuneGuidePage.CROP
- for (item in FarmingItems.values()) {
+ for (item in FarmingItems.entries) {
if (item.name == crop.name) {
FFStats.getCropStats(crop, item.getItem())
}
@@ -347,7 +347,7 @@ open class FFGuideGUI : GuiScreen() {
tooltipToDisplay.add("§eOverview")
}
- for (crop in CropType.values()) {
+ for (crop in CropType.entries) {
x += 30
drawRect(x, y, x + 25, y + 28, if (currentCrop == crop) 0x50555555 else 0x50000000)
GuiRenderUtils.renderItemStack(crop.icon, x + 5, y + 5)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt
index 1b062dc57..beda557e3 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt
@@ -71,7 +71,7 @@ object FortuneUpgrades {
private fun getTalismanUpgrade() {
val currentTalismanTier = CropAccessoryData.cropAccessory?.ordinal ?: return
if (currentTalismanTier < 3) {
- val nextTalisman = CropAccessory.values()[currentTalismanTier + 1]
+ val nextTalisman = CropAccessory.entries[currentTalismanTier + 1]
genericUpgrades.add(FortuneUpgrade("§7Upgrade your talisman to ${nextTalisman.internalName.replace("_", " ").lowercase()}",
null, nextTalisman.upgradeCost?.first!!, nextTalisman.upgradeCost.second, 10.0))
}
@@ -197,7 +197,7 @@ object FortuneUpgrades {
private fun recombobulateItem(item: ItemStack, list: MutableList<FortuneUpgrade>) {
if (item.isRecombobulated()) return
val reforge = item.getReforgeName()?.let {
- FarmingReforges.values().find { enumValue -> enumValue.name == it.uppercase()
+ FarmingReforges.entries.find { enumValue -> enumValue.name == it.uppercase()
}
} ?: return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/CropPage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/CropPage.kt
index fdaf6ea8e..7a5435393 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/CropPage.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/CropPage.kt
@@ -10,7 +10,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase
class CropPage: FFGuideGUI.FFGuidePage() {
override fun drawPage(mouseX: Int, mouseY: Int, partialTicks: Float) {
- for (item in FarmingItems.values()) {
+ for (item in FarmingItems.entries) {
if (item.name == FFGuideGUI.currentCrop?.name) {
GuiRenderUtils.renderItemAndTip(item.getItem(), FFGuideGUI.guiLeft + 172, FFGuideGUI.guiTop + 60, mouseX, mouseY)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneAverage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneAverage.kt
index 6f16e3f53..7ea8ff423 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneAverage.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneAverage.kt
@@ -18,12 +18,12 @@ class GardenCropMilestoneAverage {
if (!SkyHanniMod.feature.garden.numberAverageCropMilestone) return
val tiers = mutableListOf<Double>()
- for (cropType in CropType.values()) {
+ for (cropType in CropType.entries) {
val counter = cropType.getCounter()
val tier = GardenCropMilestones.getTierForCrops(counter)
tiers.add(tier.toDouble())
}
- average = (tiers.sum() / CropType.values().size).round(2)
+ average = (tiers.sum() / CropType.entries.size).round(2)
}
@SubscribeEvent
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt
index aee2c85de..eabae9ee0 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt
@@ -81,7 +81,7 @@ object GardenVisitorDropStatistics {
saveAndUpdate()
}
- for (reward in VisitorReward.values()) {
+ for (reward in VisitorReward.entries) {
reward.pattern.matchMatcher(message) {
val old = rewardsCount[reward] ?: 0
rewardsCount = rewardsCount.editCopy { this[reward] = old + 1 }
@@ -130,7 +130,7 @@ object GardenVisitorDropStatistics {
addAsSingletonList(format(coinsSpent, "Coins Spent", "§6", ""))
//9 – 14
- for (reward in VisitorReward.values()) {
+ for (reward in VisitorReward.entries) {
val count = rewardsCount[reward] ?: 0
if (config.displayIcons) {// Icons
val stack = NEUItems.getItemStack(reward.internalName, true)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
index 2040b479d..4a3568a9f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
@@ -141,7 +141,7 @@ class GardenVisitorFeatures {
private fun readReward(offerItem: ItemStack): VisitorReward? {
for (line in offerItem.getLore()) {
- for (reward in VisitorReward.values()) {
+ for (reward in VisitorReward.entries) {
if (line.contains(reward.displayName)) {
return reward
}