Class ConnectionUtils
java.lang.Object
net.neoforged.neoforge.network.connection.ConnectionUtils
Utility class for storing and retrieving
Connection
objects from ChannelHandlerContext
objects.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static io.netty.util.AttributeKey
<net.minecraft.network.Connection> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.network.Connection
getConnection
(io.netty.channel.ChannelHandlerContext connection) Gets theConnection
object from theChannelHandlerContext
object.static void
removeConnection
(io.netty.channel.ChannelHandlerContext connection) Removes theConnection
object from theChannelHandlerContext
object.static void
setConnection
(io.netty.channel.ChannelHandlerContext connection, net.minecraft.network.Connection value) Sets theConnection
object to theChannelHandlerContext
object.
-
Field Details
-
ATTRIBUTE_CONNECTION
private static io.netty.util.AttributeKey<net.minecraft.network.Connection> ATTRIBUTE_CONNECTION
-
-
Constructor Details
-
ConnectionUtils
private ConnectionUtils()
-
-
Method Details
-
getConnection
public static net.minecraft.network.Connection getConnection(io.netty.channel.ChannelHandlerContext connection) Gets theConnection
object from theChannelHandlerContext
object.- Parameters:
connection
- TheChannelHandlerContext
object.- Returns:
- The
Connection
object.
-
setConnection
@Internal public static void setConnection(io.netty.channel.ChannelHandlerContext connection, net.minecraft.network.Connection value) Sets theConnection
object to theChannelHandlerContext
object.- Parameters:
connection
- TheChannelHandlerContext
object.value
- TheConnection
object.
-
removeConnection
@Internal public static void removeConnection(io.netty.channel.ChannelHandlerContext connection) Removes theConnection
object from theChannelHandlerContext
object.- Parameters:
connection
- TheChannelHandlerContext
object.
-