类 PayloadRegistrar
CustomPacketPayload
s, used for modded networking.-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明<T extends CustomPacketPayload>
PayloadRegistrarcommonBidirectional
(CustomPacketPayload.Type<T> type, StreamCodec<? super FriendlyByteBuf, T> codec, IPayloadHandler<T> serverHandler) Registers a bidirectional payload for all phases.<T extends CustomPacketPayload>
PayloadRegistrarcommonBidirectional
(CustomPacketPayload.Type<T> type, StreamCodec<? super FriendlyByteBuf, T> codec, IPayloadHandler<T> serverHandler, @Nullable IPayloadHandler<T> clientHandler) Registers a bidirectional payload for all phases.<T extends CustomPacketPayload>
PayloadRegistrarcommonToClient
(CustomPacketPayload.Type<T> type, StreamCodec<? super FriendlyByteBuf, T> codec) Registers a client-bound payload for all phases without a handler.<T extends CustomPacketPayload>
PayloadRegistrarcommonToClient
(CustomPacketPayload.Type<T> type, StreamCodec<? super FriendlyByteBuf, T> codec, IPayloadHandler<T> handler) Registers a client-bound payload for all phases.<T extends CustomPacketPayload>
PayloadRegistrarcommonToServer
(CustomPacketPayload.Type<T> type, StreamCodec<? super FriendlyByteBuf, T> codec, IPayloadHandler<T> handler) Registers a server-bound payload for all phases.<T extends CustomPacketPayload>
PayloadRegistrarconfigurationBidirectional
(CustomPacketPayload.Type<T> type, StreamCodec<? super FriendlyByteBuf, T> codec, IPayloadHandler<T> serverHandler) Registers a bidirectional payload for the configuration phase.<T extends CustomPacketPayload>
PayloadRegistrarconfigurationBidirectional
(CustomPacketPayload.Type<T> type, StreamCodec<? super FriendlyByteBuf, T> codec, IPayloadHandler<T> serverHandler, @Nullable IPayloadHandler<T> clientHandler) Registers a bidirectional payload for the configuration phase.<T extends CustomPacketPayload>
PayloadRegistrarconfigurationToClient
(CustomPacketPayload.Type<T> type, StreamCodec<? super FriendlyByteBuf, T> codec) Registers a client-bound payload for the configuration phase without a handler.<T extends CustomPacketPayload>
PayloadRegistrarconfigurationToClient
(CustomPacketPayload.Type<T> type, StreamCodec<? super FriendlyByteBuf, T> codec, IPayloadHandler<T> handler) Registers a client-bound payload for the configuration phase.<T extends CustomPacketPayload>
PayloadRegistrarconfigurationToServer
(CustomPacketPayload.Type<T> type, StreamCodec<? super FriendlyByteBuf, T> codec, IPayloadHandler<T> handler) Registers a server-bound payload for the configuration phase.executesOn
(HandlerThread thread) Creates a copy of this registrar with a different default handling thread.optional()
Creates a copy of this registrar with optional mode enabled.<T extends CustomPacketPayload>
PayloadRegistrarplayBidirectional
(CustomPacketPayload.Type<T> type, StreamCodec<? super RegistryFriendlyByteBuf, T> codec, IPayloadHandler<T> serverHandler) Registers a bidirectional payload for the play phase.<T extends CustomPacketPayload>
PayloadRegistrarplayBidirectional
(CustomPacketPayload.Type<T> type, StreamCodec<? super RegistryFriendlyByteBuf, T> codec, IPayloadHandler<T> serverHandler, @Nullable IPayloadHandler<T> clientHandler) Registers a bidirectional payload for the play phase.<T extends CustomPacketPayload>
PayloadRegistrarplayToClient
(CustomPacketPayload.Type<T> type, StreamCodec<? super RegistryFriendlyByteBuf, T> codec) Registers a client-bound payload for the play phase without a handler.<T extends CustomPacketPayload>
PayloadRegistrarplayToClient
(CustomPacketPayload.Type<T> type, StreamCodec<? super RegistryFriendlyByteBuf, T> codec, IPayloadHandler<T> handler) Registers a client-bound payload for the play phase.<T extends CustomPacketPayload>
PayloadRegistrarplayToServer
(CustomPacketPayload.Type<T> type, StreamCodec<? super RegistryFriendlyByteBuf, T> codec, IPayloadHandler<T> handler) Registers a server-bound payload for the play phase.private <T extends CustomPacketPayload,
B extends FriendlyByteBuf>
voidregister
(CustomPacketPayload.Type<T> type, StreamCodec<? super B, T> codec, @Nullable IPayloadHandler<T> serverHandler, @Nullable IPayloadHandler<T> clientHandler, List<ConnectionProtocol> protocols, Optional<PacketFlow> flow, String version, boolean optional) Creates a copy of this registrar with a different version.
-
字段详细资料
-
version
-
optional
private boolean optional -
thread
-
-
构造器详细资料
-
PayloadRegistrar
-
PayloadRegistrar
-
-
方法详细资料
-
playToClient
public <T extends CustomPacketPayload> PayloadRegistrar playToClient(CustomPacketPayload.Type<T> type, StreamCodec<? super RegistryFriendlyByteBuf, T> codec, IPayloadHandler<T> handler) Registers a client-bound payload for the play phase. -
playToClient
public <T extends CustomPacketPayload> PayloadRegistrar playToClient(CustomPacketPayload.Type<T> type, StreamCodec<? super RegistryFriendlyByteBuf, T> codec) Registers a client-bound payload for the play phase without a handler. The missing handler must be registered viaRegisterClientPayloadHandlersEvent
. -
playToServer
public <T extends CustomPacketPayload> PayloadRegistrar playToServer(CustomPacketPayload.Type<T> type, StreamCodec<? super RegistryFriendlyByteBuf, T> codec, IPayloadHandler<T> handler) Registers a server-bound payload for the play phase. -
playBidirectional
public <T extends CustomPacketPayload> PayloadRegistrar playBidirectional(CustomPacketPayload.Type<T> type, StreamCodec<? super RegistryFriendlyByteBuf, T> codec, IPayloadHandler<T> serverHandler, @Nullable @Nullable IPayloadHandler<T> clientHandler) Registers a bidirectional payload for the play phase.If the provided client handler is null, it must be registered via
RegisterClientPayloadHandlersEvent
-
playBidirectional
public <T extends CustomPacketPayload> PayloadRegistrar playBidirectional(CustomPacketPayload.Type<T> type, StreamCodec<? super RegistryFriendlyByteBuf, T> codec, IPayloadHandler<T> serverHandler) Registers a bidirectional payload for the play phase.The provided handler is registered for serverbound payloads and the client-side handler must be registered via
RegisterClientPayloadHandlersEvent
-
configurationToClient
public <T extends CustomPacketPayload> PayloadRegistrar configurationToClient(CustomPacketPayload.Type<T> type, StreamCodec<? super FriendlyByteBuf, T> codec, IPayloadHandler<T> handler) Registers a client-bound payload for the configuration phase. -
configurationToClient
public <T extends CustomPacketPayload> PayloadRegistrar configurationToClient(CustomPacketPayload.Type<T> type, StreamCodec<? super FriendlyByteBuf, T> codec) Registers a client-bound payload for the configuration phase without a handler. The missing handler must be registered viaRegisterClientPayloadHandlersEvent
. -
configurationToServer
public <T extends CustomPacketPayload> PayloadRegistrar configurationToServer(CustomPacketPayload.Type<T> type, StreamCodec<? super FriendlyByteBuf, T> codec, IPayloadHandler<T> handler) Registers a server-bound payload for the configuration phase. -
configurationBidirectional
public <T extends CustomPacketPayload> PayloadRegistrar configurationBidirectional(CustomPacketPayload.Type<T> type, StreamCodec<? super FriendlyByteBuf, T> codec, IPayloadHandler<T> serverHandler, @Nullable @Nullable IPayloadHandler<T> clientHandler) Registers a bidirectional payload for the configuration phase.If the provided client handler is null, it must be registered via
RegisterClientPayloadHandlersEvent
-
configurationBidirectional
public <T extends CustomPacketPayload> PayloadRegistrar configurationBidirectional(CustomPacketPayload.Type<T> type, StreamCodec<? super FriendlyByteBuf, T> codec, IPayloadHandler<T> serverHandler) Registers a bidirectional payload for the configuration phase.The provided handler is registered for serverbound payloads and the client-side handler must be registered via
RegisterClientPayloadHandlersEvent
-
commonToClient
public <T extends CustomPacketPayload> PayloadRegistrar commonToClient(CustomPacketPayload.Type<T> type, StreamCodec<? super FriendlyByteBuf, T> codec, IPayloadHandler<T> handler) Registers a client-bound payload for all phases. -
commonToClient
public <T extends CustomPacketPayload> PayloadRegistrar commonToClient(CustomPacketPayload.Type<T> type, StreamCodec<? super FriendlyByteBuf, T> codec) Registers a client-bound payload for all phases without a handler. The missing handler must be registered viaRegisterClientPayloadHandlersEvent
. -
commonToServer
public <T extends CustomPacketPayload> PayloadRegistrar commonToServer(CustomPacketPayload.Type<T> type, StreamCodec<? super FriendlyByteBuf, T> codec, IPayloadHandler<T> handler) Registers a server-bound payload for all phases. -
commonBidirectional
public <T extends CustomPacketPayload> PayloadRegistrar commonBidirectional(CustomPacketPayload.Type<T> type, StreamCodec<? super FriendlyByteBuf, T> codec, IPayloadHandler<T> serverHandler, @Nullable @Nullable IPayloadHandler<T> clientHandler) Registers a bidirectional payload for all phases.If the provided client handler is null, it must be registered via
RegisterClientPayloadHandlersEvent
-
commonBidirectional
public <T extends CustomPacketPayload> PayloadRegistrar commonBidirectional(CustomPacketPayload.Type<T> type, StreamCodec<? super FriendlyByteBuf, T> codec, IPayloadHandler<T> serverHandler) Registers a bidirectional payload for all phases.The provided handler is registered for serverbound payloads and the client-side handler must be registered via
RegisterClientPayloadHandlersEvent
-
executesOn
Creates a copy of this registrar with a different default handling thread.When the handling thread is set to
HandlerThread.MAIN
, all registered handlers will be wrapped inMainThreadPayloadHandler
.The initial handling thread is
HandlerThread.MAIN
.- 参数:
thread
- The default handling thread.- 返回:
- A new registrar, which will map payload handlers to the desired thread.
-
versioned
Creates a copy of this registrar with a different version. Payloads registered with the returned copy will use the passed version, instead of the version from the constructor.On Neo-Neo connections, the connection will only succeed if all registered payloads have the same version.
On other connections, the payload version is ignored, since only Neo knows how to communicate Neo payload versions.
- 参数:
version
- The version to use.- 返回:
- A new registrar, ready to configure payloads with that version.
-
optional
Creates a copy of this registrar with optional mode enabled. Payloads registered with the returned copy will be marked as optional.If any non-optional payloads are missing during a connection attempt, the connection will fail.
- 返回:
- A new registrar, ready to configure payloads as optional.
-
register
private <T extends CustomPacketPayload,B extends FriendlyByteBuf> void register(CustomPacketPayload.Type<T> type, StreamCodec<? super B, T> codec, @Nullable @Nullable IPayloadHandler<T> serverHandler, @Nullable @Nullable IPayloadHandler<T> clientHandler, List<ConnectionProtocol> protocols, Optional<PacketFlow> flow, String version, boolean optional)
-