1
0
mirror of https://github.com/ViaVersion/ViaFabric.git synced 2024-12-25 16:57:53 +01:00

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