Skip to content
On this page
Fabric

ScriptPlayNetworking

top.katton.networkfabric/src/main/kotlin/top/katton/network/ScriptPlayNetworking.kt
Send and receive script Play packets on the server. Katton keeps the packet codec registered across script reloads.

ScriptPlayNetworking ​

ScriptPlayNetworkingFabricObject
kotlin
object ScriptPlayNetworking

Send and receive script Play packets on the server. Katton keeps the packet codec registered across script reloads.

ScriptPlayNetworking.registerReceiver ​

ScriptPlayNetworking.registerReceiverFabricFunction
kotlin
@JvmStatic
@JvmStatic fun registerReceiver(channel: Identifier, handler: (ServerPlayer, ByteArray) -> Unit)

Register a receiver for a logical channel. Katton removes the script-owned receiver on reload.

ScriptPlayNetworking.sendToClient ​

ScriptPlayNetworking.sendToClientFabricFunction
kotlin
@JvmStatic
@JvmStatic fun sendToClient(player: ServerPlayer, channel: Identifier, data: ByteArray): Boolean

Send up to 16 KiB to a player. Returns false if the peer cannot receive Katton packets. True does not confirm processing.

ScriptPlayNetworking.receive ​

ScriptPlayNetworking.receiveFabricFunction
kotlin
@JvmStatic
@JvmStatic fun receive(player: ServerPlayer, packet: ScriptPayloadPacket)

Dispatch a received packet to script handlers. This host entrypoint is not for scripts to call.