Record Class PlayRegistration<T extends CustomPacketPayload>
java.lang.Object
java.lang.Record
net.neoforged.neoforge.network.registration.PlayRegistration<T>
- Type Parameters:
 T- The type of the payload- Record Components:
 reader- The reader for the payloadhandler- The handler for the payloadversion- The version of the payloadflow- The flow of the payloadoptional- Whether the payload is optional
- All Implemented Interfaces:
 Function<FriendlyByteBuf,,CustomPacketPayload> FriendlyByteBuf.Reader<CustomPacketPayload>,IPlayPayloadHandler<CustomPacketPayload>
@Internal
public record PlayRegistration<T extends CustomPacketPayload>(FriendlyByteBuf.Reader<T extends CustomPacketPayload> reader, IPlayPayloadHandler<T extends CustomPacketPayload> handler, Optional<String> version, Optional<PacketFlow> flow, boolean optional)
extends Record
implements IPlayPayloadHandler<CustomPacketPayload>, FriendlyByteBuf.Reader<CustomPacketPayload>
A record that holds the information needed to describe a registered play payload, its reader and handler.
- 
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Optional<PacketFlow>The field for theflowrecord component.private final IPlayPayloadHandler<T>The field for thehandlerrecord component.private final booleanThe field for theoptionalrecord component.private final FriendlyByteBuf.Reader<T>The field for thereaderrecord component.The field for theversionrecord component. - 
Constructor Summary
ConstructorsConstructorDescriptionPlayRegistration(FriendlyByteBuf.Reader<T> reader, IPlayPayloadHandler<T> handler, Optional<String> version, Optional<PacketFlow> flow, boolean optional) Creates an instance of aPlayRegistrationrecord class. - 
Method Summary
Modifier and TypeMethodDescriptionapply(FriendlyByteBuf buffer) final booleanIndicates whether some other object is "equal to" this one.flow()Returns the value of theflowrecord component.voidhandle(CustomPacketPayload payload, PlayPayloadContext context) Invoked to handle the given payload in the given context.handler()Returns the value of thehandlerrecord component.final inthashCode()Returns a hash code value for this object.booleanoptional()Returns the value of theoptionalrecord component.reader()Returns the value of thereaderrecord component.final StringtoString()Returns a string representation of this record class.version()Returns the value of theversionrecord component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.network.FriendlyByteBuf.Reader
asOptional 
- 
Field Details
 - 
Constructor Details
- 
PlayRegistration
public PlayRegistration(FriendlyByteBuf.Reader<T> reader, IPlayPayloadHandler<T> handler, Optional<String> version, Optional<PacketFlow> flow, boolean optional) Creates an instance of aPlayRegistrationrecord class. 
 - 
 - 
Method Details
- 
handle
Description copied from interface:IPlayPayloadHandlerInvoked to handle the given payload in the given context.- Specified by:
 handlein interfaceIPlayPayloadHandler<T extends CustomPacketPayload>- Parameters:
 payload- The payload.context- The context.
 - 
apply
- Specified by:
 applyin interfaceFunction<FriendlyByteBuf,CustomPacketPayload> 
 - 
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. - 
reader
Returns the value of thereaderrecord component.- Returns:
 - the value of the 
readerrecord component 
 - 
handler
Returns the value of thehandlerrecord component.- Returns:
 - the value of the 
handlerrecord component 
 - 
version
Returns the value of theversionrecord component.- Returns:
 - the value of the 
versionrecord component 
 - 
flow
Returns the value of theflowrecord component.- Returns:
 - the value of the 
flowrecord component 
 - 
optional
public boolean optional()Returns the value of theoptionalrecord component.- Returns:
 - the value of the 
optionalrecord component 
 
 -