PacketSizeEstimator

public final class PacketSizeEstimator

Bridge that lets the version-agnostic consumer (e.g. FreeMinecraftModels' packet sampler) ask the active NMS module for the REAL serialized wire size of a packet, without the consumer needing any NMS imports.

The NMS module registers a PacketSizeFunction at adapter init via setImpl. Callers use sizeOf; if no implementation is registered (or it fails) they get -1 and should fall back to their own estimate.

Types

Link copied to clipboard
public interface PacketSizeFunction
Encodes a single NMS packet and returns its serialized byte length, or -1 if unmeasurable.

Functions

Link copied to clipboard
public static boolean hasImpl()
Link copied to clipboard
public static void setImpl(PacketSizeEstimator.PacketSizeFunction function)
Link copied to clipboard
public static int sizeOf(Object packet)