Add statistics handler to 1.19.4->1.19.3 protocol

This commit is contained in:
Nassim Jahnke 2023-05-23 16:43:46 +02:00
parent d271d3d687
commit 4fb9fdab9b
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
2 changed files with 4 additions and 1 deletions

View File

@ -5,7 +5,7 @@ plugins {
allprojects {
group = "com.viaversion"
version = "4.7.0-1.20-pre3-SNAPSHOT"
version = "4.7.0-1.20-pre5-SNAPSHOT"
description = "Allow older clients to join newer server versions."
}

View File

@ -35,6 +35,7 @@ import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.ClientboundPac
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.Protocol1_19_4To1_19_3;
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.ServerboundPackets1_19_4;
import com.viaversion.viaversion.rewriter.CommandRewriter;
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
import com.viaversion.viaversion.rewriter.TagRewriter;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
@ -98,6 +99,8 @@ public final class Protocol1_19_3To1_19_4 extends BackwardsProtocol<ClientboundP
tagRewriter.removeTags("minecraft:damage_type");
tagRewriter.registerGeneric(ClientboundPackets1_19_4.TAGS);
new StatisticsRewriter<>(this).register(ClientboundPackets1_19_4.STATISTICS);
registerClientbound(ClientboundPackets1_19_4.SERVER_DATA, wrapper -> {
final JsonElement element = wrapper.read(Type.COMPONENT);
wrapper.write(Type.OPTIONAL_COMPONENT, element);