mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-09-07 01:18:00 +02:00
Fixed ViaBedrock implementation not working
This commit is contained in:
parent
0f4a042ed6
commit
b3bd7c16f7
@ -36,7 +36,7 @@ public class MixinClientConnection_1 {
|
|||||||
@Shadow
|
@Shadow
|
||||||
ClientConnection field_11663;
|
ClientConnection field_11663;
|
||||||
|
|
||||||
@Inject(method = "initChannel", at = @At("TAIL"))
|
@Inject(method = "initChannel", at = @At("RETURN"))
|
||||||
public void hackNettyPipeline(Channel channel, CallbackInfo ci) {
|
public void hackNettyPipeline(Channel channel, CallbackInfo ci) {
|
||||||
if (channel instanceof SocketChannel) {
|
if (channel instanceof SocketChannel) {
|
||||||
ProtocolHack.injectVLBPipeline(field_11663, channel, ((IClientConnection) field_11663).viafabricplus_capturedAddress());
|
ProtocolHack.injectVLBPipeline(field_11663, channel, ((IClientConnection) field_11663).viafabricplus_capturedAddress());
|
||||||
|
@ -26,9 +26,6 @@ import io.netty.channel.socket.nio.NioDatagramChannel;
|
|||||||
import io.netty.handler.timeout.ReadTimeoutHandler;
|
import io.netty.handler.timeout.ReadTimeoutHandler;
|
||||||
import net.minecraft.network.ClientConnection;
|
import net.minecraft.network.ClientConnection;
|
||||||
import net.minecraft.network.NetworkSide;
|
import net.minecraft.network.NetworkSide;
|
||||||
import net.minecraft.network.handler.PacketSizeLogger;
|
|
||||||
import net.minecraft.util.Lazy;
|
|
||||||
import net.minecraft.util.profiler.PerformanceLog;
|
|
||||||
import org.cloudburstmc.netty.channel.raknet.RakChannelFactory;
|
import org.cloudburstmc.netty.channel.raknet.RakChannelFactory;
|
||||||
import org.cloudburstmc.netty.channel.raknet.config.RakChannelOption;
|
import org.cloudburstmc.netty.channel.raknet.config.RakChannelOption;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -45,6 +42,10 @@ public class RakNetClientConnection {
|
|||||||
final Bootstrap nettyBoostrap = new Bootstrap().group(eventLoopGroup).handler(new ChannelInitializer<>() {
|
final Bootstrap nettyBoostrap = new Bootstrap().group(eventLoopGroup).handler(new ChannelInitializer<>() {
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(@NotNull Channel channel) {
|
protected void initChannel(@NotNull Channel channel) {
|
||||||
|
// Mojang Code start
|
||||||
|
ClientConnection.setHandlers(channel);
|
||||||
|
// Mojang Code end
|
||||||
|
|
||||||
try {
|
try {
|
||||||
channel.config().setOption(RakChannelOption.RAK_PROTOCOL_VERSION, 11);
|
channel.config().setOption(RakChannelOption.RAK_PROTOCOL_VERSION, 11);
|
||||||
channel.config().setOption(RakChannelOption.RAK_CONNECT_TIMEOUT, 4_000L);
|
channel.config().setOption(RakChannelOption.RAK_CONNECT_TIMEOUT, 4_000L);
|
||||||
@ -52,10 +53,12 @@ public class RakNetClientConnection {
|
|||||||
channel.config().setOption(RakChannelOption.RAK_GUID, ThreadLocalRandom.current().nextLong());
|
channel.config().setOption(RakChannelOption.RAK_GUID, ThreadLocalRandom.current().nextLong());
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mojang Code start
|
||||||
ChannelPipeline channelPipeline = channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30));
|
ChannelPipeline channelPipeline = channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30));
|
||||||
ClientConnection.addHandlers(channelPipeline, NetworkSide.CLIENTBOUND, clientConnection.packetSizeLogger);
|
ClientConnection.addHandlers(channelPipeline, NetworkSide.CLIENTBOUND, clientConnection.packetSizeLogger);
|
||||||
|
clientConnection.addFlowControlHandler(channelPipeline);
|
||||||
channelPipeline.addLast("packet_handler", clientConnection);
|
// Mojang Code end
|
||||||
|
|
||||||
ProtocolHack.injectVLBPipeline(clientConnection, channel, address);
|
ProtocolHack.injectVLBPipeline(clientConnection, channel, address);
|
||||||
}
|
}
|
||||||
|
@ -31,20 +31,14 @@ import io.netty.channel.epoll.Epoll;
|
|||||||
import io.netty.channel.epoll.EpollSocketChannel;
|
import io.netty.channel.epoll.EpollSocketChannel;
|
||||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||||
import io.netty.handler.timeout.ReadTimeoutHandler;
|
import io.netty.handler.timeout.ReadTimeoutHandler;
|
||||||
import net.minecraft.SharedConstants;
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.network.ClientConnection;
|
import net.minecraft.network.ClientConnection;
|
||||||
import net.minecraft.network.NetworkSide;
|
import net.minecraft.network.NetworkSide;
|
||||||
import net.minecraft.network.NetworkState;
|
|
||||||
import net.minecraft.network.handler.PacketSizeLogger;
|
|
||||||
import net.minecraft.network.listener.ClientQueryPacketListener;
|
import net.minecraft.network.listener.ClientQueryPacketListener;
|
||||||
import net.minecraft.network.packet.c2s.handshake.ConnectionIntent;
|
|
||||||
import net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket;
|
|
||||||
import net.minecraft.network.packet.c2s.query.QueryRequestC2SPacket;
|
import net.minecraft.network.packet.c2s.query.QueryRequestC2SPacket;
|
||||||
import net.minecraft.network.packet.s2c.query.PingResultS2CPacket;
|
import net.minecraft.network.packet.s2c.query.PingResultS2CPacket;
|
||||||
import net.minecraft.network.packet.s2c.query.QueryResponseS2CPacket;
|
import net.minecraft.network.packet.s2c.query.QueryResponseS2CPacket;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.profiler.PerformanceLog;
|
|
||||||
import net.raphimc.vialoader.util.VersionEnum;
|
import net.raphimc.vialoader.util.VersionEnum;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user