9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-29 20:09:17 +00:00
This commit is contained in:
hayanesuru
2025-07-27 17:06:01 +09:00
parent b43bda8fb7
commit cb4da1a644

View File

@@ -7,7 +7,7 @@ The JMH benchmark of this patch can be found in SunBox's JMH `OptimizeTextColorM
and nanoTime bench `OptimizeTextColor`.
diff --git a/net/minecraft/network/chat/TextColor.java b/net/minecraft/network/chat/TextColor.java
index a68e0999c7eb1f038a0da23b3417609443660809..35f1a3b542e5049bf00cd091b9c3c1069c188d6e 100644
index a68e0999c7eb1f038a0da23b3417609443660809..d943e621e21831b912980f470ffad63bf77465ee 100644
--- a/net/minecraft/network/chat/TextColor.java
+++ b/net/minecraft/network/chat/TextColor.java
@@ -15,9 +15,18 @@ import net.minecraft.ChatFormatting;
@@ -65,7 +65,7 @@ index a68e0999c7eb1f038a0da23b3417609443660809..35f1a3b542e5049bf00cd091b9c3c106
public static DataResult<TextColor> parseColor(String color) {
- if (color.startsWith("#")) {
+ if (color.charAt(0) == '#') { // Leaf - Optimise TextColor
+ if (!color.isEmpty() && color.charAt(0) == '#') { // Leaf - Optimise TextColor
try {
int i = Integer.parseInt(color.substring(1), 16);
return i >= 0 && i <= 16777215