Package net.minecraft.network
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<?>>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
NetworkManager.QueuedPacket
-
Field Summary
Fields Modifier and Type Field Description private java.util.function.Consumer<NetworkManager>
activationHandler
private java.net.SocketAddress
address
static io.netty.util.AttributeKey<ProtocolType>
ATTRIBUTE_PROTOCOL
private float
averageReceivedPackets
private float
averageSentPackets
private io.netty.channel.Channel
channel
private ITextComponent
disconnectedReason
private boolean
disconnectionHandled
private boolean
encrypted
private boolean
handlingFault
static LazyValue<io.netty.channel.DefaultEventLoopGroup>
LOCAL_WORKER_GROUP
private static org.apache.logging.log4j.Logger
LOGGER
static LazyValue<io.netty.channel.epoll.EpollEventLoopGroup>
NETWORK_EPOLL_WORKER_GROUP
static LazyValue<io.netty.channel.nio.NioEventLoopGroup>
NETWORK_WORKER_GROUP
static org.apache.logging.log4j.Marker
PACKET_MARKER
private INetHandler
packetListener
private java.util.Queue<NetworkManager.QueuedPacket>
queue
private int
receivedPackets
private PacketDirection
receiving
static org.apache.logging.log4j.Marker
ROOT_MARKER
private int
sentPackets
private int
tickCount
-
Constructor Summary
Constructors Constructor Description NetworkManager(PacketDirection p_i46004_1_)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description io.netty.channel.Channel
channel()
void
channelActive(io.netty.channel.ChannelHandlerContext p_channelActive_1_)
void
channelInactive(io.netty.channel.ChannelHandlerContext p_channelInactive_1_)
protected void
channelRead0(io.netty.channel.ChannelHandlerContext p_channelRead0_1_, IPacket<?> p_channelRead0_2_)
static NetworkManager
connectToLocalServer(java.net.SocketAddress p_150722_0_)
static NetworkManager
connectToServer(java.net.InetAddress p_181124_0_, int p_181124_1_, boolean p_181124_2_)
void
disconnect(ITextComponent p_150718_1_)
void
exceptionCaught(io.netty.channel.ChannelHandlerContext p_exceptionCaught_1_, java.lang.Throwable p_exceptionCaught_2_)
private void
flushQueue()
private static <T extends INetHandler>
voidgenericsFtw(IPacket<T> p_197664_0_, INetHandler p_197664_1_)
float
getAverageReceivedPackets()
float
getAverageSentPackets()
PacketDirection
getDirection()
ITextComponent
getDisconnectedReason()
INetHandler
getPacketListener()
java.net.SocketAddress
getRemoteAddress()
void
handleDisconnection()
boolean
isConnected()
boolean
isConnecting()
boolean
isEncrypted()
boolean
isMemoryConnection()
void
send(IPacket<?> p_179290_1_)
void
send(IPacket<?> p_201058_1_, io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> p_201058_2_)
private void
sendPacket(IPacket<?> p_150732_1_, io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> p_150732_2_)
void
setEncryptionKey(javax.crypto.Cipher p_244777_1_, javax.crypto.Cipher p_244777_2_)
void
setListener(INetHandler p_150719_1_)
void
setProtocol(ProtocolType p_150723_1_)
void
setReadOnly()
void
setupCompression(int p_179289_1_)
void
tick()
protected void
tickSecond()
-
Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelRead
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
-
-
-
-
Field Detail
-
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 java.util.Queue<NetworkManager.QueuedPacket> queue
-
channel
private io.netty.channel.Channel channel
-
address
private java.net.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 java.util.function.Consumer<NetworkManager> activationHandler
-
-
Constructor Detail
-
NetworkManager
public NetworkManager(PacketDirection p_i46004_1_)
-
-
Method Detail
-
channelActive
public void channelActive(io.netty.channel.ChannelHandlerContext p_channelActive_1_) throws java.lang.Exception
- Specified by:
channelActive
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelActive
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
java.lang.Exception
-
setProtocol
public void setProtocol(ProtocolType p_150723_1_)
-
channelInactive
public void channelInactive(io.netty.channel.ChannelHandlerContext p_channelInactive_1_) throws java.lang.Exception
- Specified by:
channelInactive
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelInactive
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
java.lang.Exception
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext p_exceptionCaught_1_, java.lang.Throwable p_exceptionCaught_2_)
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelHandler
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
exceptionCaught
in classio.netty.channel.ChannelInboundHandlerAdapter
-
channelRead0
protected void channelRead0(io.netty.channel.ChannelHandlerContext p_channelRead0_1_, IPacket<?> p_channelRead0_2_) throws java.lang.Exception
- Specified by:
channelRead0
in classio.netty.channel.SimpleChannelInboundHandler<IPacket<?>>
- Throws:
java.lang.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 java.lang.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 java.lang.Void>> p_150732_2_)
-
flushQueue
private void flushQueue()
-
tick
public void tick()
-
tickSecond
protected void tickSecond()
-
getRemoteAddress
public java.net.SocketAddress getRemoteAddress()
-
disconnect
public void disconnect(ITextComponent p_150718_1_)
-
isMemoryConnection
public boolean isMemoryConnection()
-
connectToServer
public static NetworkManager connectToServer(java.net.InetAddress p_181124_0_, int p_181124_1_, boolean p_181124_2_)
-
connectToLocalServer
public static NetworkManager connectToLocalServer(java.net.SocketAddress p_150722_0_)
-
setEncryptionKey
public void setEncryptionKey(javax.crypto.Cipher p_244777_1_, javax.crypto.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()
-
-