Make cooldownPercent be property
This commit is contained in:
parent
df683477d1
commit
5a8a3e375d
@ -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)
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user