类 RegisterPayloadHandlersEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent
- 所有已实现的接口:
net.neoforged.fml.event.IModBusEvent
public class RegisterPayloadHandlersEvent
extends net.neoforged.bus.api.Event
implements net.neoforged.fml.event.IModBusEvent
Event fired when the
NetworkRegistry
is being set up.
This event is used to collect all the payload types and their handlers that should be used on the network.
There are a few base rules for custom payloads:
- Payloads should not write their ids within their
StreamCodec
, as this will be done automatically. - Payloads must be registered before they can be sent over the network.
- Payloads may only be sent over the
ConnectionProtocol
they were registered for. - By default,
PayloadRegistrar
will wrap handlers so they execute on the main thread instead of the network thread. - Payloads are always serialized, including for
memory connections
(singleplayer and LAN hosts).
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明Creates a newPayloadRegistrar
, a utility for registering payloads using a builder-style format.
-
构造器详细资料
-
RegisterPayloadHandlersEvent
@Internal public RegisterPayloadHandlersEvent()
-
-
方法详细资料
-
registrar
Creates a newPayloadRegistrar
, a utility for registering payloads using a builder-style format.- 参数:
version
- The network version. May not be empty
-