Handle 1.20->1.20.2 tags

This commit is contained in:
Nassim Jahnke 2024-01-09 17:19:19 +01:00
parent 2889daed61
commit 6c2d43d7f9
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F

View File

@ -43,6 +43,7 @@ import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.Clientbou
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPackets1_20_2;
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundConfigurationPackets1_20_2;
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundPackets1_20_2;
import com.viaversion.viaversion.rewriter.TagRewriter;
import java.util.UUID;
public final class Protocol1_20To1_20_2 extends BackwardsProtocol<ClientboundPackets1_20_2, ClientboundPackets1_19_4, ServerboundPackets1_20_2, ServerboundPackets1_19_4> {
@ -59,6 +60,9 @@ public final class Protocol1_20To1_20_2 extends BackwardsProtocol<ClientboundPac
protected void registerPackets() {
super.registerPackets();
final TagRewriter<ClientboundPackets1_20_2> tagRewriter = new TagRewriter<>(this);
tagRewriter.registerGeneric(ClientboundPackets1_20_2.TAGS);
final SoundRewriter<ClientboundPackets1_20_2> soundRewriter = new SoundRewriter<>(this);
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_2.SOUND);
soundRewriter.registerSound(ClientboundPackets1_20_2.ENTITY_SOUND);
@ -148,6 +152,7 @@ public final class Protocol1_20To1_20_2 extends BackwardsProtocol<ClientboundPac
wrapper.cancel();
});
registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.UPDATE_TAGS.getId(), -1, wrapper -> {
tagRewriter.getGenericHandler().handle(wrapper);
wrapper.user().get(ConfigurationPacketStorage.class).addRawPacket(wrapper, ClientboundPackets1_19_4.TAGS);
wrapper.cancel();
});