highlight selected enum in tooltips

This commit is contained in:
YuRaNnNzZZ 2023-07-19 05:06:33 +03:00
parent 5c2791c30c
commit 824d75a680
Signed by: YuRaNnNzZZ
GPG Key ID: 5F71738C85A6006D
2 changed files with 6 additions and 6 deletions

View File

@ -797,6 +797,8 @@ private fun gui(provider: MatteryLanguageProvider) {
gui("slot_filter.filtered", "This slot is filtered for automation")
gui("slot_filter.forbidden", "This slot is forbidden for automation mechanisms")
gui("slot_filter.hint", "To remove slot filter press Ctrl + LMB")
gui("tooltip.enum.active", "> %s")
}
}

View File

@ -11,12 +11,8 @@ import ru.dbotthepony.mc.otm.client.render.AbstractMatterySprite
import ru.dbotthepony.mc.otm.client.render.IGUIRenderable
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
import ru.dbotthepony.mc.otm.core.GetterSetter
import ru.dbotthepony.mc.otm.core.TextComponent
import ru.dbotthepony.mc.otm.core.next
import ru.dbotthepony.mc.otm.core.prev
import ru.dbotthepony.mc.otm.core.*
import ru.dbotthepony.mc.otm.core.util.EnumValueCodec
import ru.dbotthepony.mc.otm.core.value
import ru.dbotthepony.mc.otm.menu.input.IPlayerInputWithFeedback
import java.util.*
import java.util.function.Predicate
@ -164,7 +160,9 @@ abstract class EnumRectangleButtonPanel<out S : Screen, T : Enum<T>>(
for ((k, entry) in enumMapping) {
if (entry.tooltip != null && predicate.test(k)) {
listing.add(entry.tooltip.copy().withStyle(if (entry.key == prop.get()) ChatFormatting.WHITE else ChatFormatting.GRAY))
val active = entry.key == prop.get()
val tooltip = entry.tooltip.copy().withStyle(if (active) ChatFormatting.WHITE else ChatFormatting.GRAY)
listing.add(if (active) TranslatableComponent("otm.gui.tooltip.enum.active", tooltip) else tooltip)
}
}