Add a asTextColor() method to the Colors.kt enum class
This commit is contained in:
parent
34de53beee
commit
2a87787b21
|
@ -12,8 +12,9 @@ import fr.username404.snowygui.gui.feature.Macro
|
|||
import fr.username404.snowygui.gui.feature.riskyCheats
|
||||
import net.minecraft.client.gui.screens.Screen
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.network.chat.TextComponent
|
||||
import net.minecraft.network.chat.TranslatableComponent
|
||||
import java.util.*
|
||||
import java.util.Optional
|
||||
|
||||
private const val confPrefix: String = "screen.snowy.config"
|
||||
private val translationComponent = TranslatableComponent(confPrefix)
|
||||
|
@ -58,7 +59,9 @@ val SnowyConfigScreen: Screen = object: Screen(translationComponent) {
|
|||
.requireRestart()
|
||||
.setSaveConsumer {
|
||||
riskyCheats = it
|
||||
}.setTooltip(Component.nullToEmpty("WARNING: Do not use this on servers or you might get banned.")).build()
|
||||
}.setTooltip(TextComponent("WARNING: Do not use this on servers or you might get banned.").apply {
|
||||
style = style.withColor(Colors.RED.asTextColor())
|
||||
}).build()
|
||||
).addEntry(startSubCategory(TranslatableComponent("$confPrefix.colors")).also { builder ->
|
||||
builder.addAll(
|
||||
ClickGui.clickBoxes.map { box ->
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package fr.username404.snowygui.gui.feature
|
||||
|
||||
import net.minecraft.network.chat.TextColor
|
||||
|
||||
enum class Colors(val hexValue: Int) {
|
||||
TRANSPARENT(-0x1),
|
||||
BLACK(0x000000),
|
||||
|
@ -10,5 +12,6 @@ enum class Colors(val hexValue: Int) {
|
|||
RED(0x660000),
|
||||
GREEN(0x00FF7F),
|
||||
ORANGE(0xf18e33),
|
||||
PURPLE(0xA97BFF)
|
||||
PURPLE(0xA97BFF);
|
||||
fun asTextColor(): TextColor = TextColor.fromRgb(hexValue)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue