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 Summary
FieldsModifier and TypeFieldDescriptionprivate final io.netty.channel.ChannelHandlerContext
The field for thechannelHandlerContext
record component.private final PacketFlow
The field for theflow
record component.private final IPacketHandler
The field for thepacketHandler
record component.The field for theplayer
record component.private final IReplyHandler
The field for thereplyHandler
record component.private final ISynchronizedWorkHandler
The field for theworkHandler
record component. -
Constructor Summary
ConstructorsConstructorDescriptionPlayPayloadContext
(IReplyHandler replyHandler, IPacketHandler packetHandler, ISynchronizedWorkHandler workHandler, PacketFlow flow, io.netty.channel.ChannelHandlerContext channelHandlerContext, Optional<Player> player) Creates an instance of aPlayPayloadContext
record class. -
Method Summary
Modifier and TypeMethodDescriptionio.netty.channel.ChannelHandlerContext
Returns the value of thechannelHandlerContext
record component.final boolean
Indicates whether some other object is "equal to" this one.flow()
Returns the value of theflow
record component.final int
hashCode()
Returns a hash code value for this object.Returns the value of thepacketHandler
record component.player()
Returns the value of theplayer
record component.protocol()
Returns the protocol of the connection.Returns the value of thereplyHandler
record component.final String
toString()
Returns a string representation of this record class.Returns the value of theworkHandler
record component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.neoforged.neoforge.network.handling.IPayloadContext
level
-
Field Details
-
replyHandler
The field for thereplyHandler
record component. -
packetHandler
The field for thepacketHandler
record component. -
workHandler
The field for theworkHandler
record component. -
flow
The field for theflow
record component. -
channelHandlerContext
private final io.netty.channel.ChannelHandlerContext channelHandlerContextThe field for thechannelHandlerContext
record component. -
player
The field for theplayer
record component.
-
-
Constructor Details
-
PlayPayloadContext
public PlayPayloadContext(IReplyHandler replyHandler, IPacketHandler packetHandler, ISynchronizedWorkHandler workHandler, PacketFlow flow, io.netty.channel.ChannelHandlerContext channelHandlerContext, Optional<Player> player) Creates an instance of aPlayPayloadContext
record class.- Parameters:
replyHandler
- the value for thereplyHandler
record componentpacketHandler
- the value for thepacketHandler
record componentworkHandler
- the value for theworkHandler
record componentflow
- the value for theflow
record componentchannelHandlerContext
- the value for thechannelHandlerContext
record componentplayer
- the value for theplayer
record component
-
-
Method Details
-
protocol
Description copied from interface:IPayloadContext
Returns the protocol of the connection.- Specified by:
protocol
in interfaceIPayloadContext
- Returns:
- the protocol of the connection
-
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. -
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. -
equals
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 withObjects::equals(Object,Object)
. -
replyHandler
Returns the value of thereplyHandler
record component.- Specified by:
replyHandler
in interfaceIPayloadContext
- Returns:
- the value of the
replyHandler
record component
-
packetHandler
Returns the value of thepacketHandler
record component.- Specified by:
packetHandler
in interfaceIPayloadContext
- Returns:
- the value of the
packetHandler
record component
-
workHandler
Returns the value of theworkHandler
record component.- Specified by:
workHandler
in interfaceIPayloadContext
- Returns:
- the value of the
workHandler
record component
-
flow
Returns the value of theflow
record component.- Specified by:
flow
in interfaceIPayloadContext
- Returns:
- the value of the
flow
record component
-
channelHandlerContext
public io.netty.channel.ChannelHandlerContext channelHandlerContext()Returns the value of thechannelHandlerContext
record component.- Specified by:
channelHandlerContext
in interfaceIPayloadContext
- Returns:
- the value of the
channelHandlerContext
record component
-
player
Returns the value of theplayer
record component.- Specified by:
player
in interfaceIPayloadContext
- Returns:
- the value of the
player
record component
-