Record Class ModdedPlayPayloadRegistration<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
java.lang.Object
java.lang.Record
net.neoforged.neoforge.network.registration.ModdedPlayPayloadRegistration<T>
- Type Parameters:
T
- The type of payload.- Record Components:
id
- The id of the payload.type
- The type of payload.handler
- The handler for the payload.reader
- The reader for the payload.
@Internal
public record ModdedPlayPayloadRegistration<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>(net.minecraft.resources.ResourceLocation id, Class<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> type, IPayloadHandler<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> handler, net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> reader)
extends Record
Registration for a custom packet payload.
This type holds the negotiated preferredVersion of the payload to use, and the handler for it.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final IPayloadHandler
<T> The field for thehandler
record component.private final net.minecraft.resources.ResourceLocation
The field for theid
record component.private final net.minecraft.network.codec.StreamCodec
<net.minecraft.network.RegistryFriendlyByteBuf, T> The field for thereader
record component.The field for thetype
record component. -
Constructor Summary
ConstructorsConstructorDescriptionModdedPlayPayloadRegistration
(net.minecraft.resources.ResourceLocation id, Class<T> type, IPayloadHandler<T> handler, net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, T> reader) Creates an instance of aModdedPlayPayloadRegistration
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.handler()
Returns the value of thehandler
record component.final int
hashCode()
Returns a hash code value for this object.net.minecraft.resources.ResourceLocation
id()
Returns the value of theid
record component.net.minecraft.network.codec.StreamCodec
<net.minecraft.network.RegistryFriendlyByteBuf, T> reader()
Returns the value of thereader
record component.final String
toString()
Returns a string representation of this record class.type()
Returns the value of thetype
record component.
-
Field Details
-
id
private final net.minecraft.resources.ResourceLocation idThe field for theid
record component. -
type
private final Class<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> typeThe field for thetype
record component. -
handler
private final IPayloadHandler<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> handlerThe field for thehandler
record component. -
reader
private final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> readerThe field for thereader
record component.
-
-
Constructor Details
-
ModdedPlayPayloadRegistration
public ModdedPlayPayloadRegistration(net.minecraft.resources.ResourceLocation id, Class<T> type, IPayloadHandler<T> handler, net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, T> reader) Creates an instance of aModdedPlayPayloadRegistration
record class.
-
-
Method Details
-
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)
. -
id
public net.minecraft.resources.ResourceLocation id()Returns the value of theid
record component.- Returns:
- the value of the
id
record component
-
type
Returns the value of thetype
record component.- Returns:
- the value of the
type
record component
-
handler
Returns the value of thehandler
record component.- Returns:
- the value of the
handler
record component
-
reader
public net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,T> reader()Returns the value of thereader
record component.- Returns:
- the value of the
reader
record component
-