Skip to content

Commit a4611ec

Browse files
committed
"fixed" duplicate setting names
1 parent cd43b59 commit a4611ec

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

src/main/kotlin/com/lambda/config/groups/FormatterSettings.kt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,22 @@ import java.time.ZonedDateTime
3232

3333
class FormatterSettings(
3434
owner: Configurable,
35-
vararg baseGroup: NamedEnum,
36-
vis: () -> Boolean = { true }
35+
baseGroup: NamedEnum,
3736
) : FormatterConfig, SettingGroup() {
38-
val localeEnum by owner.setting("Locale", FormatterConfig.Locales.US, "The regional formatting used for numbers", vis).group(*baseGroup)
37+
val localeEnum by owner.setting("Locale", FormatterConfig.Locales.US, "The regional formatting used for numbers").group(baseGroup).index()
3938
override val locale get() = localeEnum.locale
4039

41-
val sep by owner.setting("Separator", FormatterConfig.TupleSeparator.Comma, "Separator for string serialization of tuple data structures", vis).group(*baseGroup)
42-
val customSep by owner.setting("Custom Separator", "") { vis() && sep == FormatterConfig.TupleSeparator.Custom }.group(*baseGroup)
40+
val sep by owner.setting("Separator", FormatterConfig.TupleSeparator.Comma, "Separator for string serialization of tuple data structures").group(baseGroup).index()
41+
val customSep by owner.setting("Custom Separator", "") { sep == FormatterConfig.TupleSeparator.Custom }.group(baseGroup).index()
4342
override val separator get() = if (sep == FormatterConfig.TupleSeparator.Custom) customSep else sep.separator
4443

45-
val group by owner.setting("Tuple Prefix", FormatterConfig.TupleGrouping.Parentheses) { vis() }.group(*baseGroup)
44+
val group by owner.setting("Tuple Prefix", FormatterConfig.TupleGrouping.Parentheses).group(baseGroup).index()
4645
override val prefix get() = group.prefix
4746
override val postfix get() = group.postfix
4847

49-
val floatingPrecision by owner.setting("Floating Precision", 3, 0..6, 1, "Precision for floating point numbers") { vis() }.group(*baseGroup)
48+
val floatingPrecision by owner.setting("Floating Precision", 3, 0..6, 1, "Precision for floating point numbers").group(baseGroup).index()
5049
override val precision get() = floatingPrecision
5150

52-
val timeFormat by owner.setting("Time Format", FormatterConfig.Time.IsoDateTime) { vis() }.group(*baseGroup)
51+
val timeFormat by owner.setting("Time Format", FormatterConfig.Time.IsoDateTime).group(baseGroup).index()
5352
override val format get() = timeFormat.format
5453
}

src/main/kotlin/com/lambda/module/hud/Coordinates.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ object Coordinates : HudModule(
4141
private val showDimension by setting("Show Dimension", true)
4242

4343
private val formatter = FormatterSettings(this, Page.CurrentDimension).apply { ::timeFormat.edit { hide() } }
44-
private val otherFormatter = FormatterSettings(this, Page.OtherDimension).apply {
45-
::timeFormat.edit { hide() }
46-
::group.edit { defaultValue(FormatterConfig.TupleGrouping.SquareBrackets) }
47-
}
44+
// private val otherFormatter = FormatterSettings(this, Page.OtherDimension).apply {
45+
// ::timeFormat.edit { hide() }
46+
// ::group.edit { defaultValue(FormatterConfig.TupleGrouping.SquareBrackets) }
47+
// }
4848

4949
override fun ImGuiBuilder.buildLayout() {
5050
runSafe {
5151
val position = player.pos.format(formatter)
52-
val otherDimensionPos =
53-
if (world.isNether) player.overworldCoord.let { Vec2d(it.x, it.z) }.format(otherFormatter)
54-
else player.netherCoord.let { Vec2d(it.x, it.z) }.format(otherFormatter)
52+
val otherDimensionPos = // ToDo: The system has forced my hand, too bad!. We need to find a way to allow duplicate setting names.
53+
if (world.isNether) player.overworldCoord.let { Vec2d(it.x, it.z) }.format(formatter.locale, formatter.separator, "[", "]", formatter.precision)
54+
else player.netherCoord.let { Vec2d(it.x, it.z) }.format(formatter.locale, formatter.separator, "[", "]", formatter.precision)
5555

5656
val text = "$position $otherDimensionPos"
5757

0 commit comments

Comments
 (0)