From f3f8949f1ac3a2245c79f3e191ab231a7018e454 Mon Sep 17 00:00:00 2001 From: LAX1DUDE Date: Wed, 20 Jul 2022 23:29:38 -0700 Subject: [PATCH] fixed chat formatting character (for servers without UTF-8 http headers) --- .../java/net/minecraft/src/EnumChatFormatting.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraft/src/EnumChatFormatting.java b/src/main/java/net/minecraft/src/EnumChatFormatting.java index 110d165..3865172 100644 --- a/src/main/java/net/minecraft/src/EnumChatFormatting.java +++ b/src/main/java/net/minecraft/src/EnumChatFormatting.java @@ -10,12 +10,18 @@ public enum EnumChatFormatting { BLACK('0'), DARK_BLUE('1'), DARK_GREEN('2'), DARK_AQUA('3'), DARK_RED('4'), DARK_PURPLE('5'), GOLD('6'), GRAY('7'), DARK_GRAY('8'), BLUE('9'), GREEN('a'), AQUA('b'), RED('c'), LIGHT_PURPLE('d'), YELLOW('e'), WHITE('f'), OBFUSCATED('k', true), BOLD('l', true), STRIKETHROUGH('m', true), UNDERLINE('n', true), ITALIC('o', true), RESET('r'); + private static final int codePoint = 0x10a7; + private static final Map field_96321_w = new HashMap(); private static final Map field_96331_x = new HashMap(); - private static final Pattern field_96330_y = Pattern.compile("(?i)" + String.valueOf((char)0x00a7) + "[0-9A-FK-OR]"); + private static final Pattern field_96330_y = Pattern.compile("(?i)" + String.valueOf((char)bias(codePoint)) + "[0-9A-FK-OR]"); private final char field_96329_z; private final boolean field_96303_A; private final String field_96304_B; + + private static int bias(int input) { // trick TeaVM into not converting (char)0x00a7 to a string + return input - 0x1000; + } private EnumChatFormatting(char par3) { this(par3, false); @@ -24,7 +30,7 @@ public enum EnumChatFormatting { private EnumChatFormatting(char par3, boolean par4) { this.field_96329_z = par3; this.field_96303_A = par4; - this.field_96304_B = "" + (char)0x00a7 + par3; + this.field_96304_B = "" + (char)bias(codePoint) + par3; } public char func_96298_a() {