registerS2C

abstract fun <T : FzzyPayload> registerS2C(id: Identifier, clazz: Class<T>, function: Function<PacketByteBuf, T>, handler: S2CPayloadHandler<T>)

registers a clientbound (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

Identifier the id of the custom payload

clazz

Class<T> class type of the registered payload

function

Function<PacketByteBuf,T> the function for building the payload from a given buf

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.