package top.r3944realms.lib39.example.core.network;

import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;

/**
 * The type Fabric ex network handler.
 */
public class FabricExNetworkHandler {
    /**
     * 注册服务器接收的数据包
     */
    public static void registerServerReceivers() {
        PayloadTypeRegistry.playC2S().register(
                FabricClientDataPacket.TYPE,
                FabricClientDataPacket.STREAM_CODEC
        );
        ServerPlayNetworking.registerGlobalReceiver(
                FabricClientDataPacket.TYPE,
                FabricClientDataPacket::handle
        );
    }
}
