Package net.minecraft.network
Class ClientConnection
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<Packet<?>>
net.minecraft.network.ClientConnection
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
- Direct Known Subclasses:
RateLimitedConnection
public class ClientConnection extends io.netty.channel.SimpleChannelInboundHandler<Packet<?>>
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classClientConnection.QueuedPacketNested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Field Summary
Fields Modifier and Type Field Description private SocketAddressaddressstatic io.netty.util.AttributeKey<NetworkState>ATTR_KEY_PROTOCOLprivate floatavgPacketsReceivedprivate floatavgPacketsSentprivate io.netty.channel.Channelchannelstatic Lazy<io.netty.channel.nio.NioEventLoopGroup>CLIENT_IO_GROUPstatic Lazy<io.netty.channel.epoll.EpollEventLoopGroup>CLIENT_IO_GROUP_EPOLLstatic Lazy<io.netty.channel.DefaultEventLoopGroup>CLIENT_IO_GROUP_LOCALprivate booleandisconnectedprivate TextdisconnectReasonprivate booleanencryptedprivate booleanerroredprivate static LoggerLOGGERstatic MarkerMARKER_NETWORKstatic MarkerMARKER_NETWORK_PACKETSprivate PacketListenerpacketListenerprivate Queue<ClientConnection.QueuedPacket>packetQueueprivate intpacketsReceivedCounterprivate intpacketsSentCounterprivate NetworkSidesideprivate intticks -
Constructor Summary
Constructors Constructor Description ClientConnection(NetworkSide side) -
Method Summary
Modifier and Type Method Description voidchannelActive(io.netty.channel.ChannelHandlerContext channelHandlerContext)voidchannelInactive(io.netty.channel.ChannelHandlerContext channelHandlerContext)protected voidchannelRead0(io.netty.channel.ChannelHandlerContext channelHandlerContext, Packet<?> packet)static ClientConnectionconnect(InetAddress address, int port, boolean shouldUseNativeTransport)static ClientConnectionconnectLocal(SocketAddress address)voiddisableAutoRead()voiddisconnect(Text disconnectReason)voidexceptionCaught(io.netty.channel.ChannelHandlerContext channelHandlerContext, Throwable throwable)SocketAddressgetAddress()floatgetAveragePacketsReceived()floatgetAveragePacketsSent()TextgetDisconnectReason()PacketListenergetPacketListener()voidhandleDisconnection()private static <T extends PacketListener>
voidhandlePacket(Packet<T> packet, PacketListener listener)booleanhasChannel()booleanisEncrypted()booleanisLocal()booleanisOpen()private NetworkStatemethod_32306()voidsend(Packet<?> packet)voidsend(Packet<?> packet, io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super Void>> callback)private voidsendImmediately(Packet<?> packet, io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super Void>> callback)private voidsendQueuedPackets()voidsetCompressionThreshold(int compressionThreshold)voidsetPacketListener(PacketListener listener)voidsetState(NetworkState state)voidsetupEncryption(Cipher cipher, Cipher cipher2)voidtick()protected voidupdateStats()Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelReadMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Field Details
-
LOGGER
-
MARKER_NETWORK
-
MARKER_NETWORK_PACKETS
-
ATTR_KEY_PROTOCOL
-
CLIENT_IO_GROUP
-
CLIENT_IO_GROUP_EPOLL
-
CLIENT_IO_GROUP_LOCAL
-
side
-
packetQueue
-
channel
private io.netty.channel.Channel channel -
address
-
packetListener
-
disconnectReason
-
encrypted
private boolean encrypted -
disconnected
private boolean disconnected -
packetsReceivedCounter
private int packetsReceivedCounter -
packetsSentCounter
private int packetsSentCounter -
avgPacketsReceived
private float avgPacketsReceived -
avgPacketsSent
private float avgPacketsSent -
ticks
private int ticks -
errored
private boolean errored
-
-
Constructor Details
-
ClientConnection
-
-
Method Details
-
channelActive
public void channelActive(io.netty.channel.ChannelHandlerContext channelHandlerContext) throws Exception- Specified by:
channelActivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelActivein classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
setState
-
channelInactive
public void channelInactive(io.netty.channel.ChannelHandlerContext channelHandlerContext)- Specified by:
channelInactivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelInactivein classio.netty.channel.ChannelInboundHandlerAdapter
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext channelHandlerContext, Throwable throwable)- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter
-
channelRead0
protected void channelRead0(io.netty.channel.ChannelHandlerContext channelHandlerContext, Packet<?> packet)- Specified by:
channelRead0in classio.netty.channel.SimpleChannelInboundHandler<Packet<?>>
-
handlePacket
private static <T extends PacketListener> void handlePacket(Packet<T> packet, PacketListener listener) -
setPacketListener
-
send
-
send
-
sendImmediately
-
method_32306
-
sendQueuedPackets
private void sendQueuedPackets() -
tick
public void tick() -
updateStats
protected void updateStats() -
getAddress
-
disconnect
-
isLocal
public boolean isLocal() -
connect
@Environment(CLIENT) public static ClientConnection connect(InetAddress address, int port, boolean shouldUseNativeTransport) -
connectLocal
-
setupEncryption
-
isEncrypted
@Environment(CLIENT) public boolean isEncrypted() -
isOpen
public boolean isOpen() -
hasChannel
public boolean hasChannel() -
getPacketListener
-
getDisconnectReason
-
disableAutoRead
public void disableAutoRead() -
setCompressionThreshold
public void setCompressionThreshold(int compressionThreshold) -
handleDisconnection
public void handleDisconnection() -
getAveragePacketsReceived
public float getAveragePacketsReceived() -
getAveragePacketsSent
@Environment(CLIENT) public float getAveragePacketsSent()
-