From 5f292895cb89d42b9a5d12922c80541874e0bf39 Mon Sep 17 00:00:00 2001 From: cpw Date: Mon, 12 Oct 2020 14:10:24 -0400 Subject: [PATCH] Fix RCON multipacket responses not actually understanding UTF8. Signed-off-by: cpw --- .../network/rcon/ClientThread.java.patch | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 patches/minecraft/net/minecraft/network/rcon/ClientThread.java.patch diff --git a/patches/minecraft/net/minecraft/network/rcon/ClientThread.java.patch b/patches/minecraft/net/minecraft/network/rcon/ClientThread.java.patch new file mode 100644 index 000000000..bed456bcb --- /dev/null +++ b/patches/minecraft/net/minecraft/network/rcon/ClientThread.java.patch @@ -0,0 +1,22 @@ +--- a/net/minecraft/network/rcon/ClientThread.java ++++ b/net/minecraft/network/rcon/ClientThread.java +@@ -115,13 +115,14 @@ + } + + private void func_72655_a(int p_72655_1_, String p_72655_2_) throws IOException { +- int i = p_72655_2_.length(); +- ++ byte[] whole = p_72655_2_.getBytes(StandardCharsets.UTF_8); ++ int i = whole.length; ++ int start = 0; + do { + int j = 4096 <= i ? 4096 : i; +- this.func_72654_a(p_72655_1_, 0, p_72655_2_.substring(0, j)); +- p_72655_2_ = p_72655_2_.substring(j); +- i = p_72655_2_.length(); ++ this.func_72654_a(p_72655_1_, 0, new String(java.util.Arrays.copyOfRange(whole, start, j+start), StandardCharsets.UTF_8)); ++ i -= j; ++ start += j; + } while(0 != i); + + }