From 8a0e1876212fbd1371376476cd0ae44943467fa0 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sun, 24 Sep 2023 10:48:47 +1000 Subject: [PATCH] Drop custom payloads with non-alphanumerical brands For some reason the client errors only if it contains certain characters, needs further investigation. Mojang changed their string writing implementation, though the actual encoding does not seem to have changed, and this error does not occur anywhere else --- .../protocol1_20_2to1_20/Protocol1_20_2To1_20.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_2to1_20/Protocol1_20_2To1_20.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_2to1_20/Protocol1_20_2To1_20.java index 2b13b6731..d6a8ef76e 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_2to1_20/Protocol1_20_2To1_20.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_2to1_20/Protocol1_20_2To1_20.java @@ -70,6 +70,17 @@ public final class Protocol1_20_2To1_20 extends AbstractProtocol { + final String channel = wrapper.passthrough(Type.STRING); + if (channel.equals("minecraft:brand")) { + final String brand = wrapper.passthrough(Type.STRING); + // TODO No idea what's going on here + if (!brand.matches("[a-zA-Z0-9]+")) { + wrapper.cancel(); + } + } + }); + registerClientbound(ClientboundPackets1_19_4.RESOURCE_PACK, wrapper -> { final String url = wrapper.passthrough(Type.STRING); final String hash = wrapper.passthrough(Type.STRING);