From 255536e9d0507a198c798c5fa45bb5ab25b867cb Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 6 Dec 2023 09:47:11 +0100 Subject: [PATCH] Handle tags packet --- .../Protocol1_20_2To1_20_3.java | 15 +++++---------- .../template/protocol/Protocol1_98To_99.java | 6 +++--- .../rewriter/EntityPacketRewriter1_99.java | 4 ++-- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java index fa9174a1..b47d3c9f 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java @@ -46,6 +46,7 @@ import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.Clientb import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPackets1_20_3; import com.viaversion.viaversion.rewriter.ComponentRewriter.ReadType; import com.viaversion.viaversion.rewriter.StatisticsRewriter; +import com.viaversion.viaversion.rewriter.TagRewriter; import java.util.BitSet; import java.util.UUID; @@ -64,6 +65,9 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol tagRewriter = new TagRewriter<>(this); + tagRewriter.registerGeneric(ClientboundPackets1_20_3.TAGS); + final SoundRewriter soundRewriter = new SoundRewriter<>(this); soundRewriter.register1_19_3Sound(ClientboundPackets1_20_3.SOUND); soundRewriter.registerEntitySound(ClientboundPackets1_20_3.ENTITY_SOUND); @@ -305,24 +309,15 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol { final ResourcepackIDStorage storage = wrapper.user().get(ResourcepackIDStorage.class); wrapper.write(Type.UUID, storage != null ? storage.uuid() : UUID.randomUUID()); - - final int action = wrapper.read(Type.VAR_INT); - if (action == 4) { // Downloaded - wrapper.cancel(); - } else if (action > 4) { // Invalid url, failed reload, and discarded - wrapper.write(Type.VAR_INT, 2); // Failed download - } else { - wrapper.write(Type.VAR_INT, action); - } }; } diff --git a/template/src/main/java/com/viaversion/viabackwards/template/protocol/Protocol1_98To_99.java b/template/src/main/java/com/viaversion/viabackwards/template/protocol/Protocol1_98To_99.java index c8ec6f5e..9d126d06 100644 --- a/template/src/main/java/com/viaversion/viabackwards/template/protocol/Protocol1_98To_99.java +++ b/template/src/main/java/com/viaversion/viabackwards/template/protocol/Protocol1_98To_99.java @@ -28,9 +28,9 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_3; import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType; import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType; 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.ServerboundConfigurationPackets1_20_2; import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.Protocol1_20_3To1_20_2; +import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundConfigurationPackets1_20_3; import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3; import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPackets1_20_3; import com.viaversion.viaversion.rewriter.ComponentRewriter.ReadType; @@ -43,7 +43,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; // Protocol1_20_3To1_20_2 (the ViaVersion protocol class the mappings depend on) // ClientboundPackets1_20_3 // ServerboundPackets1_20_3 -// ClientboundConfigurationPackets1_20_2 +// ClientboundConfigurationPackets1_20_3 // ServerboundConfigurationPackets1_20_2 // EntityTypes1_19_4 (UNMAPPED type) // 1.99, 1.98 @@ -114,7 +114,7 @@ public final class Protocol1_98To_99 extends BackwardsProtocol