Search in sources :

Example 21 with UserConnection

use of com.viaversion.viaversion.api.connection.UserConnection in project ViaFabric by ViaVersion.

the class MixinServerNetworkIoChInit method onInitChannel.

@Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
private void onInitChannel(Channel channel, CallbackInfo ci) {
    if (channel instanceof SocketChannel) {
        UserConnection user = new UserConnectionImpl(channel);
        new ProtocolPipelineImpl(user);
        channel.pipeline().addBefore("encoder", CommonTransformer.HANDLER_ENCODER_NAME, new FabricEncodeHandler(user));
        channel.pipeline().addBefore("decoder", CommonTransformer.HANDLER_DECODER_NAME, new FabricDecodeHandler(user));
    }
}
Also used : SocketChannel(io.netty.channel.socket.SocketChannel) UserConnectionImpl(com.viaversion.viaversion.connection.UserConnectionImpl) ProtocolPipelineImpl(com.viaversion.viaversion.protocol.ProtocolPipelineImpl) FabricDecodeHandler(com.viaversion.fabric.common.handler.FabricDecodeHandler) UserConnection(com.viaversion.viaversion.api.connection.UserConnection) FabricEncodeHandler(com.viaversion.fabric.common.handler.FabricEncodeHandler) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 22 with UserConnection

use of com.viaversion.viaversion.api.connection.UserConnection in project ViaFabric by ViaVersion.

the class MixinClientConnectionChInit method onInitChannel.

@Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
private void onInitChannel(Channel channel, CallbackInfo ci) {
    if (channel instanceof SocketChannel) {
        UserConnection user = new UserConnectionImpl(channel, true);
        new ProtocolPipelineImpl(user).add(HostnameParserProtocol.INSTANCE);
        channel.pipeline().addBefore("encoder", CommonTransformer.HANDLER_ENCODER_NAME, new FabricEncodeHandler(user)).addBefore("decoder", CommonTransformer.HANDLER_DECODER_NAME, new FabricDecodeHandler(user));
    }
}
Also used : SocketChannel(io.netty.channel.socket.SocketChannel) UserConnectionImpl(com.viaversion.viaversion.connection.UserConnectionImpl) ProtocolPipelineImpl(com.viaversion.viaversion.protocol.ProtocolPipelineImpl) FabricDecodeHandler(com.viaversion.fabric.common.handler.FabricDecodeHandler) UserConnection(com.viaversion.viaversion.api.connection.UserConnection) FabricEncodeHandler(com.viaversion.fabric.common.handler.FabricEncodeHandler) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 23 with UserConnection

use of com.viaversion.viaversion.api.connection.UserConnection in project ViaFabric by ViaVersion.

the class MixinClientConnectionChInit method onInitChannel.

@Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
private void onInitChannel(Channel channel, CallbackInfo ci) {
    if (channel instanceof SocketChannel) {
        UserConnection user = new UserConnectionImpl(channel, true);
        new ProtocolPipelineImpl(user).add(HostnameParserProtocol.INSTANCE);
        channel.pipeline().addBefore("encoder", CommonTransformer.HANDLER_ENCODER_NAME, new FabricEncodeHandler(user)).addBefore("decoder", CommonTransformer.HANDLER_DECODER_NAME, new FabricDecodeHandler(user));
    }
}
Also used : SocketChannel(io.netty.channel.socket.SocketChannel) UserConnectionImpl(com.viaversion.viaversion.connection.UserConnectionImpl) ProtocolPipelineImpl(com.viaversion.viaversion.protocol.ProtocolPipelineImpl) FabricDecodeHandler(com.viaversion.fabric.common.handler.FabricDecodeHandler) UserConnection(com.viaversion.viaversion.api.connection.UserConnection) FabricEncodeHandler(com.viaversion.fabric.common.handler.FabricEncodeHandler) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 24 with UserConnection

use of com.viaversion.viaversion.api.connection.UserConnection in project ViaFabric by ViaVersion.

the class MixinServerNetworkIoChInit method onInitChannel.

@Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
private void onInitChannel(Channel channel, CallbackInfo ci) {
    if (channel instanceof SocketChannel) {
        UserConnection user = new UserConnectionImpl(channel);
        new ProtocolPipelineImpl(user);
        channel.pipeline().addBefore("encoder", CommonTransformer.HANDLER_ENCODER_NAME, new FabricEncodeHandler(user));
        channel.pipeline().addBefore("decoder", CommonTransformer.HANDLER_DECODER_NAME, new FabricDecodeHandler(user));
    }
}
Also used : SocketChannel(io.netty.channel.socket.SocketChannel) UserConnectionImpl(com.viaversion.viaversion.connection.UserConnectionImpl) ProtocolPipelineImpl(com.viaversion.viaversion.protocol.ProtocolPipelineImpl) FabricDecodeHandler(com.viaversion.fabric.common.handler.FabricDecodeHandler) UserConnection(com.viaversion.viaversion.api.connection.UserConnection) FabricEncodeHandler(com.viaversion.fabric.common.handler.FabricEncodeHandler) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 25 with UserConnection

use of com.viaversion.viaversion.api.connection.UserConnection in project ViaFabric by ViaVersion.

the class MixinClientConnectionChInit method onInitChannel.

@Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
private void onInitChannel(Channel channel, CallbackInfo ci) {
    if (channel instanceof SocketChannel) {
        UserConnection user = new UserConnectionImpl(channel, true);
        new ProtocolPipelineImpl(user).add(HostnameParserProtocol.INSTANCE);
        channel.pipeline().addBefore("encoder", CommonTransformer.HANDLER_ENCODER_NAME, new FabricEncodeHandler(user)).addBefore("decoder", CommonTransformer.HANDLER_DECODER_NAME, new FabricDecodeHandler(user));
    }
}
Also used : SocketChannel(io.netty.channel.socket.SocketChannel) UserConnectionImpl(com.viaversion.viaversion.connection.UserConnectionImpl) ProtocolPipelineImpl(com.viaversion.viaversion.protocol.ProtocolPipelineImpl) FabricDecodeHandler(com.viaversion.fabric.common.handler.FabricDecodeHandler) UserConnection(com.viaversion.viaversion.api.connection.UserConnection) FabricEncodeHandler(com.viaversion.fabric.common.handler.FabricEncodeHandler) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

UserConnection (com.viaversion.viaversion.api.connection.UserConnection)37 UserConnectionImpl (com.viaversion.viaversion.connection.UserConnectionImpl)20 ProtocolPipelineImpl (com.viaversion.viaversion.protocol.ProtocolPipelineImpl)20 SocketChannel (io.netty.channel.socket.SocketChannel)16 Inject (org.spongepowered.asm.mixin.injection.Inject)15 FabricDecodeHandler (com.viaversion.fabric.common.handler.FabricDecodeHandler)14 FabricEncodeHandler (com.viaversion.fabric.common.handler.FabricEncodeHandler)14 PacketWrapper (com.viaversion.viaversion.api.protocol.packet.PacketWrapper)5 ProtocolInfo (com.viaversion.viaversion.api.connection.ProtocolInfo)3 EventHandler (net.md_5.bungee.event.EventHandler)3 CompoundTag (com.github.steveice10.opennbt.tag.builtin.CompoundTag)2 Tag (com.github.steveice10.opennbt.tag.builtin.Tag)2 Via (com.viaversion.viaversion.api.Via)2 StorableObject (com.viaversion.viaversion.api.connection.StorableObject)2 BlockChangeRecord (com.viaversion.viaversion.api.minecraft.BlockChangeRecord)2 Chunk (com.viaversion.viaversion.api.minecraft.chunks.Chunk)2 ChunkSection (com.viaversion.viaversion.api.minecraft.chunks.ChunkSection)2 ProtocolPathEntry (com.viaversion.viaversion.api.protocol.ProtocolPathEntry)2 ClientboundPacketType (com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType)2 PacketRemapper (com.viaversion.viaversion.api.protocol.remapper.PacketRemapper)2