--- a/net/minecraft/network/NetworkManager.java
+++ b/net/minecraft/network/NetworkManager.java
@@ -74,6 +74,7 @@
    private float field_211397_t;
    private int field_211398_u;
    private boolean field_211399_v;
+   private java.util.function.Consumer<NetworkManager> activationHandler;
 
    public NetworkManager(PacketDirection p_i46004_1_) {
       this.field_179294_g = p_i46004_1_;
@@ -83,6 +84,7 @@
       super.channelActive(p_channelActive_1_);
       this.field_150746_k = p_channelActive_1_.channel();
       this.field_150743_l = this.field_150746_k.remoteAddress();
+      if (activationHandler != null) activationHandler.accept(this);
 
       try {
          this.func_150723_a(ProtocolType.HANDSHAKING);
@@ -171,7 +173,7 @@
       ++this.field_211395_r;
       if (protocoltype1 != protocoltype) {
          field_150735_g.debug("Disabled auto read");
-         this.field_150746_k.config().setAutoRead(false);
+         this.field_150746_k.eventLoop().execute(()->this.field_150746_k.config().setAutoRead(false));
       }
 
       if (this.field_150746_k.eventLoop().inEventLoop()) {
@@ -255,7 +257,9 @@
 
    @OnlyIn(Dist.CLIENT)
    public static NetworkManager func_181124_a(InetAddress p_181124_0_, int p_181124_1_, boolean p_181124_2_) {
+      if (p_181124_0_ instanceof java.net.Inet6Address) System.setProperty("java.net.preferIPv4Stack", "false");
       final NetworkManager networkmanager = new NetworkManager(PacketDirection.CLIENTBOUND);
+      networkmanager.activationHandler = net.minecraftforge.fml.network.NetworkHooks::registerClientLoginChannel;
       Class<? extends SocketChannel> oclass;
       LazyValue<? extends EventLoopGroup> lazyvalue;
       if (Epoll.isAvailable() && p_181124_2_) {
@@ -282,6 +286,7 @@
    @OnlyIn(Dist.CLIENT)
    public static NetworkManager func_150722_a(SocketAddress p_150722_0_) {
       final NetworkManager networkmanager = new NetworkManager(PacketDirection.CLIENTBOUND);
+      networkmanager.activationHandler = net.minecraftforge.fml.network.NetworkHooks::registerClientLoginChannel;
       (new Bootstrap()).group(field_179296_e.func_179281_c()).handler(new ChannelInitializer<Channel>() {
          protected void initChannel(Channel p_initChannel_1_) throws Exception {
             p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager);
@@ -373,6 +378,14 @@
       return this.field_211397_t;
    }
 
+   public Channel channel() {
+      return field_150746_k;
+   }
+
+   public PacketDirection getDirection() {
+      return this.field_179294_g;
+   }
+
    static class QueuedPacket {
       private final IPacket<?> field_150774_a;
       @Nullable
