aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-01-31 19:01:53 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-01-31 19:01:53 +0100
commitfe00857ce42a8b829d72b2515c4f940c68c67a19 (patch)
tree34f4a438a59b17eb65cc8db45693be05b0712c14
parent892602a0aadb1c6fc2a582068b617bb7027d2ce4 (diff)
downloadskyhanni-fe00857ce42a8b829d72b2515c4f940c68c67a19.tar.gz
skyhanni-fe00857ce42a8b829d72b2515c4f940c68c67a19.tar.bz2
skyhanni-fe00857ce42a8b829d72b2515c4f940c68c67a19.zip
code cleanup
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt25
1 files changed, 13 insertions, 12 deletions
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 a4a326ad2..c0ce6e821 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt
@@ -97,19 +97,20 @@ class GardenOptimalSpeed {
private fun CropType.getOptimalSpeed() = getConfig().get().toInt()
- private fun CropType.getConfig(): Property<Float> =
- when (this) {
- CropType.WHEAT -> configCustomSpeed.wheat
- CropType.CARROT -> configCustomSpeed.carrot
- CropType.POTATO -> configCustomSpeed.potato
- CropType.NETHER_WART -> configCustomSpeed.netherWart
- CropType.PUMPKIN -> configCustomSpeed.pumpkin
- CropType.MELON -> configCustomSpeed.melon
- CropType.COCOA_BEANS -> configCustomSpeed.cocoaBeans
- CropType.SUGAR_CANE -> configCustomSpeed.sugarCane
- CropType.CACTUS -> configCustomSpeed.cactus
- CropType.MUSHROOM -> configCustomSpeed.mushroom
+ private fun CropType.getConfig(): Property<Float> = with(configCustomSpeed) {
+ when (this@getConfig) {
+ CropType.WHEAT -> wheat
+ CropType.CARROT -> carrot
+ CropType.POTATO -> potato
+ CropType.NETHER_WART -> netherWart
+ CropType.PUMPKIN -> pumpkin
+ CropType.MELON -> melon
+ CropType.COCOA_BEANS -> cocoaBeans
+ CropType.SUGAR_CANE -> sugarCane
+ CropType.CACTUS -> cactus
+ CropType.MUSHROOM -> mushroom
}
+ }
@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {