Class ModdedPacketRegistrar
- All Implemented Interfaces:
- IPayloadRegistrar
IPayloadRegistrar for modded packets.- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate final Map<ResourceLocation,ConfigurationRegistration<?>> private final Stringprivate booleanprivate final Map<ResourceLocation,PlayRegistration<?>> private boolean
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescription<T extends CustomPacketPayload>
 IPayloadRegistrarcommon(ResourceLocation id, FriendlyByteBuf.Reader<T> reader, Consumer<IDirectionAwarePayloadHandlerBuilder<T, IPayloadHandler<T>>> handler) Registers a new payload type for all supported phases.<T extends CustomPacketPayload>
 IPayloadRegistrarconfiguration(ResourceLocation id, FriendlyByteBuf.Reader<T> reader, Consumer<IDirectionAwarePayloadHandlerBuilder<T, IConfigurationPayloadHandler<T>>> handler) Registers a new payload type for the configuration phase.<T extends CustomPacketPayload>
 IPayloadRegistrarconfiguration(ResourceLocation id, FriendlyByteBuf.Reader<T> reader, IConfigurationPayloadHandler<T> handler) Registers a new payload type for the configuration phase.private voidconfiguration(ResourceLocation id, ConfigurationRegistration<?> registration) voidoptional()Defines that the payloads registered by this registrar are optional.<T extends CustomPacketPayload>
 IPayloadRegistrarplay(ResourceLocation id, FriendlyByteBuf.Reader<T> reader, Consumer<IDirectionAwarePayloadHandlerBuilder<T, IPlayPayloadHandler<T>>> handler) Registers a new payload type for the play phase.<T extends CustomPacketPayload>
 IPayloadRegistrarplay(ResourceLocation id, FriendlyByteBuf.Reader<T> reader, IPlayPayloadHandler<T> handler) Registers a new payload type for the play phase.private voidplay(ResourceLocation id, PlayRegistration<?> registration) private voidvalidatePayload(ResourceLocation id, Map<ResourceLocation, ?> payloads) Defines that the payloads registered by this registrar have a specific version associated with them.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.neoforged.neoforge.network.registration.IPayloadRegistrarcommon
- 
Field Details- 
modId
- 
configurationPayloads
- 
playPayloads
- 
version
- 
optionalprivate boolean optional
- 
validprivate boolean valid
 
- 
- 
Constructor Details- 
ModdedPacketRegistrar
- 
ModdedPacketRegistrar
 
- 
- 
Method Details- 
getConfigurationRegistrations
- 
getPlayRegistrations
- 
playpublic <T extends CustomPacketPayload> IPayloadRegistrar play(ResourceLocation id, FriendlyByteBuf.Reader<T> reader, IPlayPayloadHandler<T> handler) Description copied from interface:IPayloadRegistrarRegisters a new payload type for the play phase.- Specified by:
- playin interface- IPayloadRegistrar
- Type Parameters:
- T- The type of the payload.
- Parameters:
- id- The id of the payload.
- reader- The reader for the payload.
- handler- The handler for the payload.
- Returns:
- The registrar.
 
- 
configurationpublic <T extends CustomPacketPayload> IPayloadRegistrar configuration(ResourceLocation id, FriendlyByteBuf.Reader<T> reader, IConfigurationPayloadHandler<T> handler) Description copied from interface:IPayloadRegistrarRegisters a new payload type for the configuration phase.- Specified by:
- configurationin interface- IPayloadRegistrar
- Type Parameters:
- T- The type of the payload.
- Parameters:
- id- The id of the payload.
- reader- The reader for the payload.
- handler- The handler for the payload.
- Returns:
- The registrar.
 
- 
playpublic <T extends CustomPacketPayload> IPayloadRegistrar play(ResourceLocation id, FriendlyByteBuf.Reader<T> reader, Consumer<IDirectionAwarePayloadHandlerBuilder<T, IPlayPayloadHandler<T>>> handler) Description copied from interface:IPayloadRegistrarRegisters a new payload type for the play phase.This method allows different handlers to be registered for different packet-flows. 
 In practice this means that you can register a different handler for clientbound and serverbound packets, which allows you to handle them differently on the client and server side.- Specified by:
- playin interface- IPayloadRegistrar
- Type Parameters:
- T- The type of the payload.
- Parameters:
- id- The id of the payload.
- reader- The reader for the payload.
- handler- The handler for the payload.
- Returns:
- The registrar.
 
- 
configurationpublic <T extends CustomPacketPayload> IPayloadRegistrar configuration(ResourceLocation id, FriendlyByteBuf.Reader<T> reader, Consumer<IDirectionAwarePayloadHandlerBuilder<T, IConfigurationPayloadHandler<T>>> handler) Description copied from interface:IPayloadRegistrarRegisters a new payload type for the configuration phase.This method allows different handlers to be registered for different packet-flows. 
 In practice this means that you can register a different handler for clientbound and serverbound packets, which allows you to handle them differently on the client and server side.- Specified by:
- configurationin interface- IPayloadRegistrar
- Type Parameters:
- T- The type of the payload.
- Parameters:
- id- The id of the payload.
- reader- The reader for the payload.
- handler- The handler for the payload.
- Returns:
- The registrar.
 
- 
commonpublic <T extends CustomPacketPayload> IPayloadRegistrar common(ResourceLocation id, FriendlyByteBuf.Reader<T> reader, Consumer<IDirectionAwarePayloadHandlerBuilder<T, IPayloadHandler<T>>> handler) Description copied from interface:IPayloadRegistrarRegisters a new payload type for all supported phases.This method allows different handlers to be registered for different packet-flows. 
 In practice this means that you can register a different handler for clientbound and serverbound packets, which allows you to handle them differently on the client and server side.- Specified by:
- commonin interface- IPayloadRegistrar
- Type Parameters:
- T- The type of the payload.
- Parameters:
- id- The id of the payload.
- reader- The reader for the payload.
- handler- The handler for the payload.
- Returns:
- The registrar.
 
- 
configuration
- 
play
- 
validatePayload
- 
versionedDescription copied from interface:IPayloadRegistrarDefines that the payloads registered by this registrar have a specific version associated with them. Clients connecting to a server with these payloads, will only be able to connect if they have the same version.- Specified by:
- versionedin interface- IPayloadRegistrar
- Parameters:
- version- The version to use.
- Returns:
- A new registrar, ready to configure payloads with that version.
 
- 
optionalDescription copied from interface:IPayloadRegistrarDefines that the payloads registered by this registrar are optional. Clients connecting to a server which do not have the payloads registered, will still be able to connect.If clients have also a version set, and a version mismatch occurs (so both client and server have the payloads registered, yet have different versions), the connection attempt will fail. In other words, marking a payload as optional does not exempt it from versioning, if it has that configured. - Specified by:
- optionalin interface- IPayloadRegistrar
- Returns:
- A new registrar, ready to configure payloads as optional.
 
- 
invalidatepublic void invalidate()
 
-