Class ConnectionUtils

java.lang.Object
net.neoforged.neoforge.network.connection.ConnectionUtils

public class ConnectionUtils extends Object
Utility class for storing and retrieving Connection objects from ChannelHandlerContext objects.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static io.netty.util.AttributeKey<net.minecraft.network.Connection>
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.network.Connection
    getConnection(io.netty.channel.ChannelHandlerContext connection)
    Gets the Connection object from the ChannelHandlerContext object.
    static void
    removeConnection(io.netty.channel.ChannelHandlerContext connection)
    Removes the Connection object from the ChannelHandlerContext object.
    static void
    setConnection(io.netty.channel.ChannelHandlerContext connection, net.minecraft.network.Connection value)
    Sets the Connection object to the ChannelHandlerContext object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 the Connection object from the ChannelHandlerContext object.
      Parameters:
      connection - The ChannelHandlerContext object.
      Returns:
      The Connection object.
    • setConnection

      @Internal public static void setConnection(io.netty.channel.ChannelHandlerContext connection, net.minecraft.network.Connection value)
      Sets the Connection object to the ChannelHandlerContext object.
      Parameters:
      connection - The ChannelHandlerContext object.
      value - The Connection object.
    • removeConnection

      @Internal public static void removeConnection(io.netty.channel.ChannelHandlerContext connection)
      Removes the Connection object from the ChannelHandlerContext object.
      Parameters:
      connection - The ChannelHandlerContext object.