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 fr.username404.snowygui.gui.feature.riskyCheats
 | 
				
			||||||
import net.minecraft.client.gui.screens.Screen
 | 
					import net.minecraft.client.gui.screens.Screen
 | 
				
			||||||
import net.minecraft.network.chat.Component
 | 
					import net.minecraft.network.chat.Component
 | 
				
			||||||
 | 
					import net.minecraft.network.chat.TextComponent
 | 
				
			||||||
import net.minecraft.network.chat.TranslatableComponent
 | 
					import net.minecraft.network.chat.TranslatableComponent
 | 
				
			||||||
import java.util.*
 | 
					import java.util.Optional
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private const val confPrefix: String = "screen.snowy.config"
 | 
					private const val confPrefix: String = "screen.snowy.config"
 | 
				
			||||||
private val translationComponent = TranslatableComponent(confPrefix)
 | 
					private val translationComponent = TranslatableComponent(confPrefix)
 | 
				
			||||||
@ -58,7 +59,9 @@ val SnowyConfigScreen: Screen = object: Screen(translationComponent) {
 | 
				
			|||||||
                            .requireRestart()
 | 
					                            .requireRestart()
 | 
				
			||||||
                            .setSaveConsumer {
 | 
					                            .setSaveConsumer {
 | 
				
			||||||
                                riskyCheats = it
 | 
					                                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 ->
 | 
					                    ).addEntry(startSubCategory(TranslatableComponent("$confPrefix.colors")).also { builder ->
 | 
				
			||||||
                        builder.addAll(
 | 
					                        builder.addAll(
 | 
				
			||||||
                            ClickGui.clickBoxes.map { box ->
 | 
					                            ClickGui.clickBoxes.map { box ->
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,7 @@
 | 
				
			|||||||
package fr.username404.snowygui.gui.feature
 | 
					package fr.username404.snowygui.gui.feature
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import net.minecraft.network.chat.TextColor
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum class Colors(val hexValue: Int) {
 | 
					enum class Colors(val hexValue: Int) {
 | 
				
			||||||
    TRANSPARENT(-0x1),
 | 
					    TRANSPARENT(-0x1),
 | 
				
			||||||
    BLACK(0x000000),
 | 
					    BLACK(0x000000),
 | 
				
			||||||
@ -10,5 +12,6 @@ enum class Colors(val hexValue: Int) {
 | 
				
			|||||||
    RED(0x660000),
 | 
					    RED(0x660000),
 | 
				
			||||||
    GREEN(0x00FF7F),
 | 
					    GREEN(0x00FF7F),
 | 
				
			||||||
    ORANGE(0xf18e33),
 | 
					    ORANGE(0xf18e33),
 | 
				
			||||||
    PURPLE(0xA97BFF)
 | 
					    PURPLE(0xA97BFF);
 | 
				
			||||||
 | 
					    fun asTextColor(): TextColor = TextColor.fromRgb(hexValue)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user