Record Class PlayPayloadContext

java.lang.Object
java.lang.Record
net.neoforged.neoforge.network.handling.PlayPayloadContext
Record Components:
replyHandler - A reply replyHandler that can be used to send a reply to the player.
packetHandler - The packet replyHandler that can be used to immediately process other packets.
workHandler - A work replyHandler that can be used to schedule work to be done on the main thread.
flow - The flow of the packet.
channelHandlerContext - The channel replyHandler context.
player - The player of the payload.
All Implemented Interfaces:
IPayloadContext

public record PlayPayloadContext(IReplyHandler replyHandler, IPacketHandler packetHandler, ISynchronizedWorkHandler workHandler, PacketFlow flow, io.netty.channel.ChannelHandlerContext channelHandlerContext, Optional<Player> player) extends Record implements IPayloadContext
The context that is passed to a replyHandler for a payload that arrives during the configuration phase of the connection.
Implementation Note:
The player() will be filled with the current client side player if the payload was sent by the server, the server will only populate this field if it is not configuring the client.
  • Field Details

  • Constructor Details

  • Method Details

    • protocol

      public ConnectionProtocol protocol()
      Description copied from interface: IPayloadContext
      Returns the protocol of the connection.
      Specified by:
      protocol in interface IPayloadContext
      Returns:
      the protocol of the connection
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • replyHandler

      public IReplyHandler replyHandler()
      Returns the value of the replyHandler record component.
      Specified by:
      replyHandler in interface IPayloadContext
      Returns:
      the value of the replyHandler record component
    • packetHandler

      public IPacketHandler packetHandler()
      Returns the value of the packetHandler record component.
      Specified by:
      packetHandler in interface IPayloadContext
      Returns:
      the value of the packetHandler record component
    • workHandler

      public ISynchronizedWorkHandler workHandler()
      Returns the value of the workHandler record component.
      Specified by:
      workHandler in interface IPayloadContext
      Returns:
      the value of the workHandler record component
    • flow

      public PacketFlow flow()
      Returns the value of the flow record component.
      Specified by:
      flow in interface IPayloadContext
      Returns:
      the value of the flow record component
    • channelHandlerContext

      public io.netty.channel.ChannelHandlerContext channelHandlerContext()
      Returns the value of the channelHandlerContext record component.
      Specified by:
      channelHandlerContext in interface IPayloadContext
      Returns:
      the value of the channelHandlerContext record component
    • player

      public Optional<Player> player()
      Returns the value of the player record component.
      Specified by:
      player in interface IPayloadContext
      Returns:
      the value of the player record component