From 7de9bc604a971c9766e8a689a37c7728b69641b7 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 6 Dec 2023 09:41:49 +0100 Subject: [PATCH] Handle configuration tags packet Fixes #3549 --- .../protocol1_20_3to1_20_2/Protocol1_20_3To1_20_2.java | 1 + .../java/com/viaversion/viaversion/rewriter/TagRewriter.java | 5 +++++ gradle.properties | 2 +- .../viaversion/template/protocols/Protocol1_99To_98.java | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/Protocol1_20_3To1_20_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/Protocol1_20_3To1_20_2.java index 93f975312..af61ec57f 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/Protocol1_20_3To1_20_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/Protocol1_20_3To1_20_2.java @@ -100,6 +100,7 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol tagRewriter = new TagRewriter<>(this); tagRewriter.registerGeneric(ClientboundPackets1_20_2.TAGS); + tagRewriter.registerGeneric(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.UPDATE_TAGS); final SoundRewriter soundRewriter = new SoundRewriter<>(this); soundRewriter.register1_19_3Sound(ClientboundPackets1_20_2.SOUND); diff --git a/common/src/main/java/com/viaversion/viaversion/rewriter/TagRewriter.java b/common/src/main/java/com/viaversion/viaversion/rewriter/TagRewriter.java index 190b4d2e9..990f43bb1 100644 --- a/common/src/main/java/com/viaversion/viaversion/rewriter/TagRewriter.java +++ b/common/src/main/java/com/viaversion/viaversion/rewriter/TagRewriter.java @@ -24,6 +24,7 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.protocol.Protocol; import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; +import com.viaversion.viaversion.api.protocol.packet.State; import com.viaversion.viaversion.api.protocol.remapper.PacketHandler; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.util.Key; @@ -149,6 +150,10 @@ public class TagRewriter { protocol.registerClientbound(packetType, getGenericHandler()); } + public void registerGeneric(State state, ClientboundPacketType packetType) { + protocol.registerClientbound(state, packetType, getGenericHandler()); + } + public PacketHandler getHandler(@Nullable RegistryType readUntilType) { return wrapper -> { for (RegistryType type : RegistryType.getValues()) { diff --git a/gradle.properties b/gradle.properties index ec1fcdf69..7f7dd22aa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ projectVersion=4.9.2-SNAPSHOT # Smile emoji -mcVersions=1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10, 1.9.4, 1.9.3, 1.9.2, 1.9.1, 1.9, 1.8.9 +mcVersions=1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10, 1.9.4, 1.9.3, 1.9.2, 1.9.1, 1.9, 1.8.9 mcVersionRange=1.8-1.20.3 waterfallVersion=1.20 velocityVersion=3.2 diff --git a/template/src/main/java/com/viaversion/viaversion/template/protocols/Protocol1_99To_98.java b/template/src/main/java/com/viaversion/viaversion/template/protocols/Protocol1_99To_98.java index 3273a84cc..ad86b1cbd 100644 --- a/template/src/main/java/com/viaversion/viaversion/template/protocols/Protocol1_99To_98.java +++ b/template/src/main/java/com/viaversion/viaversion/template/protocols/Protocol1_99To_98.java @@ -24,6 +24,7 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_3; import com.viaversion.viaversion.api.protocol.AbstractProtocol; import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType; import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType; +import com.viaversion.viaversion.api.protocol.packet.State; import com.viaversion.viaversion.data.entity.EntityTrackerBase; import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundConfigurationPackets1_20_2; import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPackets1_20_2; @@ -61,6 +62,7 @@ public final class Protocol1_99To_98 extends AbstractProtocol tagRewriter = new TagRewriter<>(this); tagRewriter.registerGeneric(ClientboundPackets1_20_2.TAGS); + tagRewriter.registerGeneric(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.UPDATE_TAGS); // Registers sound id changes final SoundRewriter soundRewriter = new SoundRewriter<>(this);