diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidSwitchableFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidSwitchableFeature.kt index 06aaddd96..10611e63c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidSwitchableFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidSwitchableFeature.kt @@ -28,7 +28,7 @@ abstract class AndroidSwitchableFeature(type: AndroidFeatureType<*>, android: Ma val isOnCooldown: Boolean get() = maxCooldown > 0 && cooldown > 0 - fun getCooldownPercent(): Float { + val cooldownPercent: Float get() { if (maxCooldown <= 0) return 0.0f return (cooldown.toFloat() / maxCooldown.toFloat()).coerceIn(0.0f, 1.0f) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt index 0d4f9bd3e..d3ae061e9 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt @@ -66,7 +66,7 @@ object AndroidAbilityKeyMapping : KeyMapping("key.otm.android_ability", KeyConfl if (feature.isOnCooldown) { RGBAColor.WHITE.setSystemColor() - val cooldownPct = feature.getCooldownPercent() + val cooldownPct = feature.cooldownPercent if (cooldownPct > 0.0f) { RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt index 9b72b2fcd..b75aed850 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt @@ -237,9 +237,9 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon minecraft.font.drawAligned(event.poseStack, feature.type.displayName, TextAlign.CENTER_CENTER, shift * cos + 1f, -shift * sin - iconSize / 1.5f + 1f, 0) minecraft.font.drawAligned(event.poseStack, feature.type.displayName, TextAlign.CENTER_CENTER, shift * cos, -shift * sin - iconSize / 1.5f, if (feature.isActive) RGBAColor.DARK_GREEN else RGBAColor.DARK_RED) - if (feature.isOnCooldown && feature.getCooldownPercent() > 0.0f) { + if (feature.isOnCooldown && feature.cooldownPercent > 0.0f) { RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f) - drawArc(event.poseStack, shift * cos, -shift * sin, iconSize / 2f, 0f, PI / 2.0, PI / 2.0 + PI * 2.0 * feature.getCooldownPercent().toDouble()) + drawArc(event.poseStack, shift * cos, -shift * sin, iconSize / 2f, 0f, PI / 2.0, PI / 2.0 + PI * 2.0 * feature.cooldownPercent.toDouble()) RenderSystem.setShaderColor(1f, 1f, 1f, 1f) minecraft.font.drawAligned(event.poseStack, formatTickDuration(feature.cooldown), TextAlign.CENTER_CENTER, shift * cos, -shift * sin + iconSize / 1.5f, RGBAColor.WHITE)