From 5772ee4a9320302be7d9d242dcee3a9506fb70d6 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sun, 17 Nov 2024 11:43:19 +0100 Subject: [PATCH] Only send tags early for 1.20.5+ clients, track early send properly in 1.20->1.20.2 --- .../v1_12_2to1_13/Protocol1_12_2To1_13.java | 4 ++-- .../Protocol1_20_2To1_20_3.java | 2 +- .../v1_20to1_20_2/Protocol1_20To1_20_2.java | 24 +++++++++++++------ .../v1_20to1_20_2/storage/LastTags.java | 9 +++++++ 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/Protocol1_12_2To1_13.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/Protocol1_12_2To1_13.java index 2a7e1b24a..cc64e402c 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/Protocol1_12_2To1_13.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/Protocol1_12_2To1_13.java @@ -166,8 +166,8 @@ public class Protocol1_12_2To1_13 extends AbstractProtocol soundRewriter = new SoundRewriter<>(this); soundRewriter.registerSound1_19_3(ClientboundPackets1_20_2.SOUND); @@ -307,7 +308,6 @@ public final class Protocol1_20_2To1_20_3 extends AbstractProtocol { - tagRewriter.handleGeneric(wrapper); - wrapper.resetReader(); - wrapper.user().put(new LastTags(wrapper)); - }); + registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.UPDATE_TAGS, this::handleConfigTags); registerClientbound(ClientboundPackets1_19_4.SET_DISPLAY_OBJECTIVE, wrapper -> { final byte slot = wrapper.read(Types.BYTE); @@ -229,6 +225,15 @@ public final class Protocol1_20To1_20_2 extends AbstractProtocol registryTags = new ArrayList<>(); + private boolean sentDuringConfigPhase; public LastTags(final PacketWrapper wrapper) { final int length = wrapper.passthrough(Types.VAR_INT); @@ -65,6 +66,14 @@ public class LastTags implements StorableObject { packet.send(Protocol1_20To1_20_2.class); } + public void setSentDuringConfigPhase(final boolean sentDuringConfigPhase) { + this.sentDuringConfigPhase = sentDuringConfigPhase; + } + + public boolean sentDuringConfigPhase() { + return sentDuringConfigPhase; + } + private record RegistryTags(String registryKey, List tags) { } }