From 5ddccce30b3e285581b42eb1274d98b581635faa Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 23 Mar 2023 14:55:08 +0100 Subject: Added CropType.getOptimalSpeed --- .../java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden') 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 cad800cbe..271bab488 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt @@ -33,11 +33,11 @@ class GardenOptimalSpeed { fun onGardenToolChange(event: GardenToolChangeEvent) { cropInHand = event.crop if (isEnabled()) { - optimalSpeed = cropInHand.let { if (it != null) speedForCrop(it) else -1 } + optimalSpeed = cropInHand.let { it?.getOptimalSpeed() ?: -1 } } } - private fun speedForCrop(crop: CropType) = when (crop) { + private fun CropType.getOptimalSpeed() = when (this) { CropType.WHEAT -> 93 CropType.CARROT -> 93 CropType.POTATO -> 93 -- cgit