From 1f60038bd6513a74aef9a8455c2d5b95bad49f3f Mon Sep 17 00:00:00 2001 From: fzzyhmstrs Date: Mon, 14 Oct 2024 16:02:36 -0400 Subject: [PATCH 1/2] 0.5.4 (2) --- .../fzzy_config/validation/misc/ValidatedAny.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/me/fzzyhmstrs/fzzy_config/validation/misc/ValidatedAny.kt b/src/main/kotlin/me/fzzyhmstrs/fzzy_config/validation/misc/ValidatedAny.kt index 30600f98040..94d9fc824dc 100644 --- a/src/main/kotlin/me/fzzyhmstrs/fzzy_config/validation/misc/ValidatedAny.kt +++ b/src/main/kotlin/me/fzzyhmstrs/fzzy_config/validation/misc/ValidatedAny.kt @@ -209,19 +209,19 @@ open class ValidatedAny(defaultValue: T): ValidatedField(defaultValue } override fun translationKey(): String { - return (storedValue as? Translatable)?.hasTranslation()?.let { (storedValue as? Translatable)?.translationKey() } ?: super.translationKey() + return (storedValue as? Translatable)?.translationKey()?.takeIf { (storedValue as? Translatable)?.hasTranslation() == true } ?: super.translationKey() } override fun descriptionKey(): String { - return (storedValue as? Translatable)?.hasDescription()?.let { (storedValue as? Translatable)?.descriptionKey() } ?: super.descriptionKey() + return (storedValue as? Translatable)?.descriptionKey()?.takeIf { (storedValue as? Translatable)?.hasDescription() == true } ?: super.descriptionKey() } override fun translation(fallback: String?): MutableText { - return (storedValue as? Translatable)?.hasTranslation()?.let { (storedValue as? Translatable)?.translation(fallback) } ?: super.translation(fallback) + return (storedValue as? Translatable)?.translation(fallback)?.takeIf { (storedValue as? Translatable)?.hasTranslation() == true } ?: super.translation(fallback) } override fun description(fallback: String?): MutableText { - return (storedValue as? Translatable)?.hasDescription()?.let { (storedValue as? Translatable)?.description(fallback) } ?: super.description(fallback) + return (storedValue as? Translatable)?.description(fallback)?.takeIf { (storedValue as? Translatable)?.hasDescription() == true } ?: super.description(fallback) } override fun hasTranslation(): Boolean { From 1be8a8f941ac22e6118e53504843b4cd5b831f5d Mon Sep 17 00:00:00 2001 From: fzzyhmstrs Date: Mon, 14 Oct 2024 16:33:40 -0400 Subject: [PATCH 2/2] 0.5.4 (3) --- changelog.md | 2 +- .../fzzy_config/screen/entry/BaseConfigEntry.kt | 9 +++++++++ .../resources/assets/fzzy_config_test/lang/en_us.json | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 0e88736637e..9e2eab69b75 100644 --- a/changelog.md +++ b/changelog.md @@ -2,7 +2,7 @@ * None. ### Changes -* None. +* Config settings with names that don't fit into the row (truncated with ellipses) will now have the full name appear in the tooltip ### Fixes * Translatable things now properly have their translations respected if they are wrapped with automatic validation. \ No newline at end of file diff --git a/src/main/kotlin/me/fzzyhmstrs/fzzy_config/screen/entry/BaseConfigEntry.kt b/src/main/kotlin/me/fzzyhmstrs/fzzy_config/screen/entry/BaseConfigEntry.kt index 8a62b70ab50..fec652ca87c 100644 --- a/src/main/kotlin/me/fzzyhmstrs/fzzy_config/screen/entry/BaseConfigEntry.kt +++ b/src/main/kotlin/me/fzzyhmstrs/fzzy_config/screen/entry/BaseConfigEntry.kt @@ -127,6 +127,11 @@ internal open class BaseConfigEntry( private fun createTooltip(): List { val list: MutableList = mutableListOf() + if (truncatedName != name) { + list.addAll(MinecraftClient.getInstance().textRenderer.wrapLines(name, 190)) + if (description.string != "") + list.add(FcText.empty().asOrderedText()) + } if (description.string != "") { list.addAll(MinecraftClient.getInstance().textRenderer.wrapLines(description, 190)) } @@ -135,6 +140,10 @@ internal open class BaseConfigEntry( private fun createFullTooltip(): List { val list: MutableList = mutableListOf() + if (truncatedName != name) { + list.addAll(MinecraftClient.getInstance().textRenderer.wrapLines(name, 190)) + list.add(FcText.empty().asOrderedText()) + } if (description.string != "") { list.addAll(MinecraftClient.getInstance().textRenderer.wrapLines(description, 190)) } diff --git a/src/testmod/resources/assets/fzzy_config_test/lang/en_us.json b/src/testmod/resources/assets/fzzy_config_test/lang/en_us.json index 34bdcb14665..8148fd2736a 100644 --- a/src/testmod/resources/assets/fzzy_config_test/lang/en_us.json +++ b/src/testmod/resources/assets/fzzy_config_test/lang/en_us.json @@ -22,6 +22,7 @@ "fzzy_config_test.test_config.EPSILON" : "Epsilon", "fzzy_config_test.test_config.EPSILON.desc" : "The fifth choice", "fzzy_config_test.test_config.list1" : "Very Wow Long List Name For Testing", + "fzzy_config_test.test_config.list1.desc" : "such description. much tip.", "fzzy_config_test.test_config2.int1" : "Test integer", "fzzy_config_test.test_config2.int1.desc" : "Integers have cool descriptions",