registerS2C

abstract fun <T : CustomPayload> registerS2C(id: CustomPayload.Id<T>, codec: PacketCodec<in RegistryByteBuf, T>, handler: S2CPayloadHandler<T>)

registers a client-bound (S2C) payload type and receipt handler. This must be done on both logical sides (client and server). A common entrypoint is typically the best place for this.

Author

fzzyhmstrs

Since

0.4.1

Parameters

T

the payload type to register

id

CustomPayload.Id the id of the custom payload

codec

PacketCodec the packet codec for serializing the custom payload

handler

S2CPayloadHandler a handler for dealing with receiving the payload. This handler will be on the client handling a payload received from the server. As such, take care with your client-only class references, pushing them to a method to reference, perhaps.