fixed chat formatting character (for servers without UTF-8 http headers)

This commit is contained in:
LAX1DUDE 2022-07-20 23:29:38 -07:00
parent 81fb43e910
commit f3f8949f1a

View file

@ -10,13 +10,19 @@ 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'), 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'); 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_96321_w = new HashMap();
private static final Map field_96331_x = 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 char field_96329_z;
private final boolean field_96303_A; private final boolean field_96303_A;
private final String field_96304_B; 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) { private EnumChatFormatting(char par3) {
this(par3, false); this(par3, false);
} }
@ -24,7 +30,7 @@ public enum EnumChatFormatting {
private EnumChatFormatting(char par3, boolean par4) { private EnumChatFormatting(char par3, boolean par4) {
this.field_96329_z = par3; this.field_96329_z = par3;
this.field_96303_A = par4; 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() { public char func_96298_a() {