aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-06-27 23:08:19 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-06-27 23:08:19 +0200
commit65a4842de7a306d45bdda99788a7925443932b39 (patch)
tree79210f041964a4db5b265a2aa064beb08993684f /src/main/java/at/hannibal2/skyhanni/utils
parentb455aea562059cb4eac1201b2f1b058fbc4c1691 (diff)
downloadskyhanni-65a4842de7a306d45bdda99788a7925443932b39.tar.gz
skyhanni-65a4842de7a306d45bdda99788a7925443932b39.tar.bz2
skyhanni-65a4842de7a306d45bdda99788a7925443932b39.zip
Code cleanup
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt40
1 files changed, 18 insertions, 22 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt
index 4199dd6d3..6fdfaa2af 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt
@@ -1,9 +1,7 @@
package at.hannibal2.skyhanni.utils
import at.hannibal2.skyhanni.test.command.CopyErrorCommand
-import net.minecraft.client.Minecraft
import net.minecraft.item.EnumDyeColor
-import net.minecraft.util.ChatComponentText
import java.awt.Color
enum class LorenzColor(private var chatColorCode: Char, private val color: Color) {
@@ -38,26 +36,24 @@ enum class LorenzColor(private var chatColorCode: Char, private val color: Color
}
companion object {
- fun getMatchingColor(enumDyeColor: EnumDyeColor): LorenzColor? {
- return when(enumDyeColor) {
- EnumDyeColor.WHITE -> WHITE
- EnumDyeColor.MAGENTA -> LIGHT_PURPLE
- EnumDyeColor.PINK -> LIGHT_PURPLE
- EnumDyeColor.RED -> RED
- EnumDyeColor.SILVER -> GRAY
- EnumDyeColor.GRAY -> GRAY
- EnumDyeColor.GREEN -> DARK_GREEN
- EnumDyeColor.LIME -> GREEN
- EnumDyeColor.BLUE -> BLUE
- EnumDyeColor.PURPLE -> DARK_PURPLE
- EnumDyeColor.YELLOW -> YELLOW
- else -> {
- CopyErrorCommand.logError(
- Exception("Unknown dye color: $enumDyeColor"),
- "Unknown dye color: $enumDyeColor"
- )
- return null
- }
+ fun EnumDyeColor.toLorenzColor() = when (this) {
+ EnumDyeColor.WHITE -> WHITE
+ EnumDyeColor.MAGENTA -> LIGHT_PURPLE
+ EnumDyeColor.PINK -> LIGHT_PURPLE
+ EnumDyeColor.RED -> RED
+ EnumDyeColor.SILVER -> GRAY
+ EnumDyeColor.GRAY -> GRAY
+ EnumDyeColor.GREEN -> DARK_GREEN
+ EnumDyeColor.LIME -> GREEN
+ EnumDyeColor.BLUE -> BLUE
+ EnumDyeColor.PURPLE -> DARK_PURPLE
+ EnumDyeColor.YELLOW -> YELLOW
+ else -> {
+ CopyErrorCommand.logError(
+ Exception("Unknown dye color: $this"),
+ "Unknown dye color: $this"
+ )
+ null
}
}
}