aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/gui/config/EnumRenderer.kt
blob: 3b80b7eb5acbcd3486aac000d6e62ee6eb76cf06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package moe.nea.firmament.gui.config

import net.minecraft.text.Text

interface EnumRenderer<E : Any> {
	fun getName(option: ManagedOption<E>, value: E): Text

	companion object {
		fun <E : Enum<E>> default() = object : EnumRenderer<E> {
			override fun getName(option: ManagedOption<E>, value: E): Text {
				return Text.translatable(option.rawLabelText + ".choice." + value.name.lowercase())
			}
		}
	}
}