diff --git a/src/client/kotlin/com/bibireden/playerex/ui/components/AttributeComponent.kt b/src/client/kotlin/com/bibireden/playerex/ui/components/AttributeComponent.kt index 4e206494..b1ea0704 100644 --- a/src/client/kotlin/com/bibireden/playerex/ui/components/AttributeComponent.kt +++ b/src/client/kotlin/com/bibireden/playerex/ui/components/AttributeComponent.kt @@ -21,6 +21,7 @@ import io.wispforest.owo.ui.container.FlowLayout import io.wispforest.owo.ui.core.* import net.minecraft.entity.attribute.EntityAttribute import net.minecraft.entity.player.PlayerEntity +import net.minecraft.text.Style import net.minecraft.text.Text import net.minecraft.util.Formatting @@ -48,10 +49,12 @@ class AttributeComponent(private val attribute: EntityAttribute, private val pla append(Text.translatable(childAttribute.translationKey).styled { it.withColor(Colors.SATURATED_BLUE) }) append(" (") append(Text.literal(function.behavior.symbol).styled { it.withColor(Colors.DARK_GREEN) }) - append(Text.literal("${function.value}:")) + append(Text.literal("${function.value}")) + append(Text.literal(":").fillStyle(Style.EMPTY.withColor(Colors.DARK_GRAY))) append(Text.literal(formula.name.lowercase()).styled { it.withColor(if (formula == StackingFormula.Flat) Colors.SANDY else Colors.IMPISH_RED) }) append(")") - append(Text.literal(" (%.2f)\n".format(DataAttributesAPI.getValue(childAttribute, player).orElse(0.0))).formatted(Formatting.GRAY)) + val decLength = function.value.toString().substringAfter('.').length + append(Text.literal(" (%.${decLength}f)\n".format(DataAttributesAPI.getValue(childAttribute, player).orElse(0.0))).formatted(Formatting.GRAY)) formatted(Formatting.ITALIC) } } diff --git a/src/client/kotlin/com/bibireden/playerex/ui/util/Colors.kt b/src/client/kotlin/com/bibireden/playerex/ui/util/Colors.kt index ae79a8db..03a381a7 100644 --- a/src/client/kotlin/com/bibireden/playerex/ui/util/Colors.kt +++ b/src/client/kotlin/com/bibireden/playerex/ui/util/Colors.kt @@ -2,6 +2,7 @@ package com.bibireden.playerex.ui.util object Colors { const val GRAY = 0x9C9C9C + const val DARK_GRAY = 0x5F5F5F const val GOLD = 0xF0C25E const val SATURATED_BLUE = 0x6EBAE5 const val SANDY = 0xEDCD76