Don't rely on deprecated Via API

This commit is contained in:
FlorianMichael 2024-01-21 10:54:24 +01:00
parent 1f9cbd2853
commit 08f153f434
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126

View File

@ -3,19 +3,20 @@ package com.viaversion.fabric.common.protocol;
import com.viaversion.fabric.common.AddressParser;
import com.viaversion.viaversion.api.protocol.AbstractSimpleProtocol;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.protocols.base.ServerboundHandshakePackets;
public class HostnameParserProtocol extends AbstractSimpleProtocol {
public static final HostnameParserProtocol INSTANCE = new HostnameParserProtocol();
@Override
protected void registerPackets() {
registerServerbound(State.HANDSHAKE, 0, 0, new PacketRemapper() {
registerServerbound(State.HANDSHAKE, ServerboundHandshakePackets.CLIENT_INTENTION.getId(), ServerboundHandshakePackets.CLIENT_INTENTION.getId(), new PacketHandlers() {
@Override
public void registerMap() {
protected void register() {
map(Type.VAR_INT); // Protocol version
map(Type.STRING, new ValueTransformer<String, String>(Type.STRING) {
@Override