public class NetworkManager extends io.netty.channel.SimpleChannelInboundHandler<IPacket<?>>
Modifier and Type | Class and Description |
---|---|
(package private) static class |
NetworkManager.QueuedPacket |
Modifier and Type | Field and Description |
---|---|
private java.util.function.Consumer<NetworkManager> |
activationHandler |
private io.netty.channel.Channel |
channel |
static LazyValue<io.netty.channel.epoll.EpollEventLoopGroup> |
CLIENT_EPOLL_EVENTLOOP |
static LazyValue<io.netty.channel.DefaultEventLoopGroup> |
CLIENT_LOCAL_EVENTLOOP |
static LazyValue<io.netty.channel.nio.NioEventLoopGroup> |
CLIENT_NIO_EVENTLOOP |
private PacketDirection |
direction |
private boolean |
disconnected |
private int |
field_211394_q |
private int |
field_211395_r |
private float |
field_211396_s |
private float |
field_211397_t |
private boolean |
field_211399_v |
private boolean |
isEncrypted |
private static org.apache.logging.log4j.Logger |
LOGGER |
static org.apache.logging.log4j.Marker |
NETWORK_MARKER |
static org.apache.logging.log4j.Marker |
NETWORK_PACKETS_MARKER |
private java.util.Queue<NetworkManager.QueuedPacket> |
outboundPacketsQueue |
private INetHandler |
packetListener |
static io.netty.util.AttributeKey<ProtocolType> |
PROTOCOL_ATTRIBUTE_KEY |
private java.net.SocketAddress |
socketAddress |
private ITextComponent |
terminationReason |
private int |
ticks |
Constructor and Description |
---|
NetworkManager(PacketDirection packetDirection) |
Modifier and Type | Method and 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_) |
void |
closeChannel(ITextComponent message) |
static NetworkManager |
createNetworkManagerAndConnect(java.net.InetAddress address,
int serverPort,
boolean useNativeTransport) |
void |
disableAutoRead() |
private void |
dispatchPacket(IPacket<?> inPacket,
io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> futureListeners) |
void |
enableEncryption(javax.crypto.SecretKey key) |
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext p_exceptionCaught_1_,
java.lang.Throwable p_exceptionCaught_2_) |
private void |
flushOutboundQueue() |
PacketDirection |
getDirection() |
ITextComponent |
getExitMessage() |
INetHandler |
getNetHandler() |
float |
getPacketsReceived() |
float |
getPacketsSent() |
java.net.SocketAddress |
getRemoteAddress() |
void |
handleDisconnection() |
boolean |
hasNoChannel() |
boolean |
isChannelOpen() |
boolean |
isEncrypted() |
boolean |
isLocalChannel() |
private static <T extends INetHandler> |
processPacket(IPacket<T> p_197664_0_,
INetHandler p_197664_1_) |
static NetworkManager |
provideLocalClient(java.net.SocketAddress address) |
void |
sendPacket(IPacket<?> packetIn) |
void |
sendPacket(IPacket<?> packetIn,
io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> p_201058_2_) |
void |
setCompressionThreshold(int threshold) |
void |
setConnectionState(ProtocolType newState) |
void |
setNetHandler(INetHandler handler) |
void |
tick() |
acceptInboundMessage, channelRead
channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
private static final org.apache.logging.log4j.Logger LOGGER
public static final org.apache.logging.log4j.Marker NETWORK_MARKER
public static final org.apache.logging.log4j.Marker NETWORK_PACKETS_MARKER
public static final io.netty.util.AttributeKey<ProtocolType> PROTOCOL_ATTRIBUTE_KEY
public static final LazyValue<io.netty.channel.nio.NioEventLoopGroup> CLIENT_NIO_EVENTLOOP
public static final LazyValue<io.netty.channel.epoll.EpollEventLoopGroup> CLIENT_EPOLL_EVENTLOOP
public static final LazyValue<io.netty.channel.DefaultEventLoopGroup> CLIENT_LOCAL_EVENTLOOP
private final PacketDirection direction
private final java.util.Queue<NetworkManager.QueuedPacket> outboundPacketsQueue
private io.netty.channel.Channel channel
private java.net.SocketAddress socketAddress
private INetHandler packetListener
private ITextComponent terminationReason
private boolean isEncrypted
private boolean disconnected
private int field_211394_q
private int field_211395_r
private float field_211396_s
private float field_211397_t
private int ticks
private boolean field_211399_v
private java.util.function.Consumer<NetworkManager> activationHandler
public NetworkManager(PacketDirection packetDirection)
public void channelActive(io.netty.channel.ChannelHandlerContext p_channelActive_1_) throws java.lang.Exception
channelActive
in interface io.netty.channel.ChannelInboundHandler
channelActive
in class io.netty.channel.ChannelInboundHandlerAdapter
java.lang.Exception
public void setConnectionState(ProtocolType newState)
public void channelInactive(io.netty.channel.ChannelHandlerContext p_channelInactive_1_) throws java.lang.Exception
channelInactive
in interface io.netty.channel.ChannelInboundHandler
channelInactive
in class io.netty.channel.ChannelInboundHandlerAdapter
java.lang.Exception
public void exceptionCaught(io.netty.channel.ChannelHandlerContext p_exceptionCaught_1_, java.lang.Throwable p_exceptionCaught_2_)
exceptionCaught
in interface io.netty.channel.ChannelHandler
exceptionCaught
in interface io.netty.channel.ChannelInboundHandler
exceptionCaught
in class io.netty.channel.ChannelInboundHandlerAdapter
protected void channelRead0(io.netty.channel.ChannelHandlerContext p_channelRead0_1_, IPacket<?> p_channelRead0_2_) throws java.lang.Exception
channelRead0
in class io.netty.channel.SimpleChannelInboundHandler<IPacket<?>>
java.lang.Exception
private static <T extends INetHandler> void processPacket(IPacket<T> p_197664_0_, INetHandler p_197664_1_)
public void setNetHandler(INetHandler handler)
public void sendPacket(IPacket<?> packetIn)
public void sendPacket(IPacket<?> packetIn, @Nullable io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> p_201058_2_)
private void dispatchPacket(IPacket<?> inPacket, @Nullable io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> futureListeners)
private void flushOutboundQueue()
public void tick()
public java.net.SocketAddress getRemoteAddress()
public void closeChannel(ITextComponent message)
public boolean isLocalChannel()
public static NetworkManager createNetworkManagerAndConnect(java.net.InetAddress address, int serverPort, boolean useNativeTransport)
public static NetworkManager provideLocalClient(java.net.SocketAddress address)
public void enableEncryption(javax.crypto.SecretKey key)
public boolean isEncrypted()
public boolean isChannelOpen()
public boolean hasNoChannel()
public INetHandler getNetHandler()
@Nullable public ITextComponent getExitMessage()
public void disableAutoRead()
public void setCompressionThreshold(int threshold)
public void handleDisconnection()
public float getPacketsReceived()
public float getPacketsSent()
public io.netty.channel.Channel channel()
public PacketDirection getDirection()