Class NetworkManager

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<IPacket<?>>
net.minecraft.network.NetworkManager
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler
Direct Known Subclasses:
RateLimitedNetworkManager

public class NetworkManager extends io.netty.channel.SimpleChannelInboundHandler<IPacket<?>>
  • Field Details

    • LOGGER

      private static final org.apache.logging.log4j.Logger LOGGER
    • ROOT_MARKER

      public static final org.apache.logging.log4j.Marker ROOT_MARKER
    • PACKET_MARKER

      public static final org.apache.logging.log4j.Marker PACKET_MARKER
    • ATTRIBUTE_PROTOCOL

      public static final io.netty.util.AttributeKey<ProtocolType> ATTRIBUTE_PROTOCOL
    • NETWORK_WORKER_GROUP

      public static final LazyValue<io.netty.channel.nio.NioEventLoopGroup> NETWORK_WORKER_GROUP
    • NETWORK_EPOLL_WORKER_GROUP

      public static final LazyValue<io.netty.channel.epoll.EpollEventLoopGroup> NETWORK_EPOLL_WORKER_GROUP
    • LOCAL_WORKER_GROUP

      public static final LazyValue<io.netty.channel.DefaultEventLoopGroup> LOCAL_WORKER_GROUP
    • receiving

      private final PacketDirection receiving
    • queue

      private final Queue<NetworkManager.QueuedPacket> queue
    • channel

      private io.netty.channel.Channel channel
    • address

      private SocketAddress address
    • packetListener

      private INetHandler packetListener
    • disconnectedReason

      private ITextComponent disconnectedReason
    • encrypted

      private boolean encrypted
    • disconnectionHandled

      private boolean disconnectionHandled
    • receivedPackets

      private int receivedPackets
    • sentPackets

      private int sentPackets
    • averageReceivedPackets

      private float averageReceivedPackets
    • averageSentPackets

      private float averageSentPackets
    • tickCount

      private int tickCount
    • handlingFault

      private boolean handlingFault
    • activationHandler

      private Consumer<NetworkManager> activationHandler
  • Constructor Details

  • Method Details

    • channelActive

      public void channelActive(io.netty.channel.ChannelHandlerContext p_channelActive_1_) throws Exception
      Specified by:
      channelActive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelActive in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • setProtocol

      public void setProtocol(ProtocolType p_150723_1_)
    • channelInactive

      public void channelInactive(io.netty.channel.ChannelHandlerContext p_channelInactive_1_) throws Exception
      Specified by:
      channelInactive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelInactive in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • exceptionCaught

      public void exceptionCaught(io.netty.channel.ChannelHandlerContext p_exceptionCaught_1_, Throwable p_exceptionCaught_2_)
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelHandler
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      exceptionCaught in class io.netty.channel.ChannelInboundHandlerAdapter
    • channelRead0

      protected void channelRead0(io.netty.channel.ChannelHandlerContext p_channelRead0_1_, IPacket<?> p_channelRead0_2_) throws Exception
      Specified by:
      channelRead0 in class io.netty.channel.SimpleChannelInboundHandler<IPacket<?>>
      Throws:
      Exception
    • genericsFtw

      private static <T extends INetHandler> void genericsFtw(IPacket<T> p_197664_0_, INetHandler p_197664_1_)
    • setListener

      public void setListener(INetHandler p_150719_1_)
    • send

      public void send(IPacket<?> p_179290_1_)
    • send

      public void send(IPacket<?> p_201058_1_, @Nullable io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super Void>> p_201058_2_)
    • sendPacket

      private void sendPacket(IPacket<?> p_150732_1_, @Nullable io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super Void>> p_150732_2_)
    • flushQueue

      private void flushQueue()
    • tick

      public void tick()
    • tickSecond

      protected void tickSecond()
    • getRemoteAddress

      public SocketAddress getRemoteAddress()
    • disconnect

      public void disconnect(ITextComponent p_150718_1_)
    • isMemoryConnection

      public boolean isMemoryConnection()
    • connectToServer

      public static NetworkManager connectToServer(InetAddress p_181124_0_, int p_181124_1_, boolean p_181124_2_)
    • connectToLocalServer

      public static NetworkManager connectToLocalServer(SocketAddress p_150722_0_)
    • setEncryptionKey

      public void setEncryptionKey(Cipher p_244777_1_, Cipher p_244777_2_)
    • isEncrypted

      public boolean isEncrypted()
    • isConnected

      public boolean isConnected()
    • isConnecting

      public boolean isConnecting()
    • getPacketListener

      public INetHandler getPacketListener()
    • getDisconnectedReason

      @Nullable public ITextComponent getDisconnectedReason()
    • setReadOnly

      public void setReadOnly()
    • setupCompression

      public void setupCompression(int p_179289_1_)
    • handleDisconnection

      public void handleDisconnection()
    • getAverageReceivedPackets

      public float getAverageReceivedPackets()
    • getAverageSentPackets

      public float getAverageSentPackets()
    • channel

      public io.netty.channel.Channel channel()
    • getDirection

      public PacketDirection getDirection()