diff options
author | Lorenz <lo.scherf@gmail.com> | 2022-09-08 18:11:29 +0200 |
---|---|---|
committer | Lorenz <lo.scherf@gmail.com> | 2022-09-08 18:11:29 +0200 |
commit | 133f6a9bef6317bb9e6c2b54a7b17e0907c30f6a (patch) | |
tree | 55a4d8c73484a71657f9ea1e6dfa8f08fbbad43f /src/main/java/at/hannibal2/skyhanni/utils/ChromaUtils.kt | |
parent | f0407686615a430f19c57cb4ffe12ebd6235cc2b (diff) | |
download | skyhanni-133f6a9bef6317bb9e6c2b54a7b17e0907c30f6a.tar.gz skyhanni-133f6a9bef6317bb9e6c2b54a7b17e0907c30f6a.tar.bz2 skyhanni-133f6a9bef6317bb9e6c2b54a7b17e0907c30f6a.zip |
updated config structure from neu
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/ChromaUtils.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/ChromaUtils.kt | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ChromaUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ChromaUtils.kt new file mode 100644 index 000000000..c1326fe8e --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/ChromaUtils.kt @@ -0,0 +1,61 @@ +//package at.hannibal2.skyhanni.utils +// +//import at.hannibal2.skyhanni.utils.StringUtils.removeColor +//import net.minecraft.client.Minecraft +//import net.minecraft.util.EnumChatFormatting +//import java.util.regex.Matcher +//import java.util.regex.Pattern +// +//object ChromaUtils { +// +// private val CHROMA_REPLACE_PATTERN = Pattern.compile("\u00a7z(.+?)(?=\u00a7|$)") +// private val startTime = 0 +// +// fun chromaStringByColourCode(str: String): String? { +// var str = str +// if (str.contains("\u00a7z")) { +// val matcher: Matcher = CHROMA_REPLACE_PATTERN.matcher(str) +// val sb = StringBuffer() +// while (matcher.find()) { +// matcher.appendReplacement( +// sb, +// chromaString(matcher.group(1)) +// .replace("\\", "\\\\") +// .replace("$", "\\$") +// ) +// } +// matcher.appendTail(sb) +// str = sb.toString() +// } +// return str +// } +// +// fun chromaString(str: String): String? { +// return chromaString(str, 0f, false) +// } +// +// fun chromaString(str: String, offset: Float, bold: Boolean): String { +// var str = str +// str = str.removeColor() +// val currentTimeMillis = System.currentTimeMillis() +// if (startTime == 0L) startTime = +// currentTimeMillis +// var chromaSpeed: Int = NotEnoughUpdates.INSTANCE.config.misc.chromaSpeed +// if (chromaSpeed < 10) chromaSpeed = 10 +// if (chromaSpeed > 5000) chromaSpeed = 5000 +// val rainbowText = java.lang.StringBuilder() +// var len = 0 +// for (i in 0 until str.length) { +// val c = str[i] +// var index: Int = +// (offset + len / 12f - (currentTimeMillis - startTime) / chromaSpeed).toInt() % io..Utils.rainbow.size +// len += Minecraft.getMinecraft().fontRendererObj.getCharWidth(c) +// if (bold) len++ +// if (index < 0) index += io.github.moulberry.notenoughupdates.util.Utils.rainbow.size +// rainbowText.append(io.github.moulberry.notenoughupdates.util.Utils.rainbow.get(index)) +// if (bold) rainbowText.append(EnumChatFormatting.BOLD) +// rainbowText.append(c) +// } +// return rainbowText.toString() +// } +//}
\ No newline at end of file |