mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2024-11-15 10:35:14 +01:00
fix version sent in 1.8/1.12 detector
This commit is contained in:
parent
bab35223bb
commit
9065c5260c
@ -224,6 +224,7 @@ modrinth {
|
||||
dependencies {
|
||||
optional.project "P7dR8mSH" // fabric api
|
||||
optional.project "9CJED7xi" // legacy fabric api
|
||||
embedded.project "P1OZGk5p" // viaversion
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
package com.viaversion.fabric.mc1122.mixin.pipeline.client;
|
||||
|
||||
import com.viaversion.fabric.mc1122.service.HandshakeInterceptor;
|
||||
import net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(HandshakeC2SPacket.class)
|
||||
public class MixinHandshakeC2SPacket implements HandshakeInterceptor {
|
||||
|
||||
@Shadow
|
||||
private int protocolVersion;
|
||||
|
||||
@Override
|
||||
public void viaFabric$setProtocolVersion(int version) {
|
||||
this.protocolVersion = version;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.viaversion.fabric.mc1122.mixin.pipeline.client;
|
||||
|
||||
import net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(HandshakeC2SPacket.class)
|
||||
public interface MixinHandshakeC2SPacketAccessor {
|
||||
@Accessor
|
||||
void setProtocolVersion(int version);
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
package com.viaversion.fabric.mc1122.service;
|
||||
|
||||
public interface HandshakeInterceptor {
|
||||
|
||||
void viaFabric$setProtocolVersion(final int version);
|
||||
}
|
@ -22,6 +22,7 @@ import com.viaversion.fabric.common.AddressParser;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.viaversion.fabric.mc1122.mixin.pipeline.client.MixinHandshakeC2SPacketAccessor;
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||
@ -34,6 +35,7 @@ import net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket;
|
||||
import net.minecraft.network.packet.c2s.query.QueryRequestC2SPacket;
|
||||
import net.minecraft.network.packet.s2c.query.QueryPongS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.query.QueryResponseS2CPacket;
|
||||
import net.minecraft.realms.RealmsSharedConstants;
|
||||
import net.minecraft.server.ServerMetadata;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
@ -113,8 +115,8 @@ public class ProtocolAutoDetector {
|
||||
|
||||
HandshakeC2SPacket handshakeC2SPacket = new HandshakeC2SPacket(address.getHostString(),
|
||||
address.getPort(), NetworkState.STATUS);
|
||||
((HandshakeInterceptor) handshakeC2SPacket).viaFabric$setProtocolVersion(
|
||||
Via.getAPI().getServerVersion().lowestSupportedVersion());
|
||||
((MixinHandshakeC2SPacketAccessor) handshakeC2SPacket).setProtocolVersion(
|
||||
RealmsSharedConstants.NETWORK_PROTOCOL_VERSION);
|
||||
clientConnection.send(handshakeC2SPacket);
|
||||
clientConnection.send(new QueryRequestC2SPacket());
|
||||
});
|
||||
|
@ -9,7 +9,7 @@
|
||||
"client": [
|
||||
"client.MixinClientConnection",
|
||||
"client.MixinClientConnectionChInit",
|
||||
"client.MixinHandshakeC2SPacket"
|
||||
"client.MixinHandshakeC2SPacketAccessor"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
@ -34,11 +34,11 @@ import net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket;
|
||||
import net.minecraft.network.packet.c2s.query.QueryRequestC2SPacket;
|
||||
import net.minecraft.network.packet.s2c.query.QueryPongS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.query.QueryResponseS2CPacket;
|
||||
import net.minecraft.realms.RealmsSharedConstants;
|
||||
import net.minecraft.server.ServerMetadata;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.UnknownHostException;
|
||||
@ -110,7 +110,7 @@ public class ProtocolAutoDetector {
|
||||
}
|
||||
});
|
||||
|
||||
clientConnection.send(new HandshakeC2SPacket(Via.getAPI().getServerVersion().lowestSupportedVersion(), address.getHostString(),
|
||||
clientConnection.send(new HandshakeC2SPacket(RealmsSharedConstants.NETWORK_PROTOCOL_VERSION, address.getHostString(),
|
||||
address.getPort(), NetworkState.STATUS));
|
||||
clientConnection.send(new QueryRequestC2SPacket());
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user