diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-23 14:52:46 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-23 14:52:46 +0100 |
commit | d385aee524e9c9c5178a1c8c7bd34fc4efc9befc (patch) | |
tree | c3629843816d2b6446d887a5a49182bc2f5da6f4 /src/main/java/at/hannibal2 | |
parent | 39855af4fe066fb4b1b11672aec635157d783e45 (diff) | |
download | skyhanni-d385aee524e9c9c5178a1c8c7bd34fc4efc9befc.tar.gz skyhanni-d385aee524e9c9c5178a1c8c7bd34fc4efc9befc.tar.bz2 skyhanni-d385aee524e9c9c5178a1c8c7bd34fc4efc9befc.zip |
Added CropType.getSpeed
Diffstat (limited to 'src/main/java/at/hannibal2')
4 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt index d0d1f7f8d..4e7853c38 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GardenToolChangeEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.features.bazaar.BazaarApi +import at.hannibal2.skyhanni.features.garden.GardenAPI.Companion.getSpeed import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc @@ -107,7 +108,7 @@ class CropMoneyDisplay { for ((internalName, amount) in multipliers) { val price = NEUItems.getPrice(internalName) val cropName = cropNames[internalName]!! - val speed = GardenAPI.getCropsPerSecond(cropName) + val speed = cropName.getSpeed() // No speed data for item in hand if (speed == -1) continue diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt index 29bfd84b1..d94735ba7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.HyPixelData import at.hannibal2.skyhanni.events.GardenToolChangeEvent import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.features.garden.GardenAPI.Companion.getSpeed import at.hannibal2.skyhanni.utils.APIUtil import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.round @@ -194,7 +195,7 @@ class EliteFarmingWeight { } private fun updateWeightPerSecond(crop: CropType, before: Double, after: Double, diff: Int) { - val speed = GardenAPI.cropsPerSecond[crop]!! + val speed = crop.getSpeed() if (speed != -1) { val weightDiff = (after - before) * 1000 weightPerSecond = weightDiff / diff * speed / 1000 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 b23387010..45cb2f0ab 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt @@ -101,9 +101,7 @@ class GardenAPI { return -1 } - fun getCropsPerSecond(crop: CropType): Int { - return cropsPerSecond[crop]!! - } + fun CropType.getSpeed() = cropsPerSecond[this]!! fun itemNameToCropName(itemName: String): CropType? { if (itemName == "Red Mushroom" || itemName == "Brown Mushroom") { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt index 989186679..f66697e6a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.ScoreboardData.Companion.sidebarLinesFormatted import at.hannibal2.skyhanni.data.SendTitleHelper import at.hannibal2.skyhanni.events.* +import at.hannibal2.skyhanni.features.garden.GardenAPI.Companion.getSpeed import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName @@ -234,7 +235,7 @@ class GardenVisitorFeatures { val multiplier = NEUItems.getMultiplier(internalName) val rawName = NEUItems.getItemStack(multiplier.first).name?.removeColor() ?: continue CropType.getByName(rawName)?.let { - val speed = GardenAPI.getCropsPerSecond(it) + val speed = it.getSpeed() val cropAmount = multiplier.second.toLong() * amount val formatAmount = LorenzUtils.formatInteger(cropAmount) val formatName = "§e$formatAmount§7x ${it.cropName} " |