Class RegisterClientPayloadHandlersEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.client.network.event.RegisterClientPayloadHandlersEvent
- All Implemented Interfaces:
IModBusEvent
public class RegisterClientPayloadHandlersEvent
extends net.neoforged.bus.api.Event
implements IModBusEvent
Event fired on the mod event bus when the
ClientNetworkRegistry is being set up.
This event is used to assign payload handlers to clientbound payload types.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends CustomPacketPayload>
voidregister(CustomPacketPayload.Type<T> type, IPayloadHandler<T> handler) Registers the providedIPayloadHandleras the client handler to be invoked on the main thread for the providedCustomPacketPayload.Type<T extends CustomPacketPayload>
voidregister(CustomPacketPayload.Type<T> type, HandlerThread thread, IPayloadHandler<T> handler) Registers the providedIPayloadHandleras the client handler to be invoked on the specified thread for the providedCustomPacketPayload.Type
-
Constructor Details
-
RegisterClientPayloadHandlersEvent
@Internal public RegisterClientPayloadHandlersEvent()
-
-
Method Details
-
register
public <T extends CustomPacketPayload> void register(CustomPacketPayload.Type<T> type, IPayloadHandler<T> handler) Registers the providedIPayloadHandleras the client handler to be invoked on the main thread for the providedCustomPacketPayload.Type- Parameters:
type- The payload type to register the handler forhandler- The client-side payload handler to register
-
register
public <T extends CustomPacketPayload> void register(CustomPacketPayload.Type<T> type, HandlerThread thread, IPayloadHandler<T> handler) Registers the providedIPayloadHandleras the client handler to be invoked on the specified thread for the providedCustomPacketPayload.Type- Parameters:
type- The payload type to register the handler forthread- The thread the handler should be invoked onhandler- The client-side payload handler to register
-