ModelDensity

public final class ModelDensity

Per-world modeled-entity density snapshot, refreshed by the primary-thread viewer-state clock.

Acts as a pseudo load balancer for the close-range proximity override in SkeletonWatchers. In a sparse world a model within MIN_VIEW_DISTANCE is always shown — the line-of-sight raytrace is skipped to avoid pop-in on models you're standing next to. But in a dense world (a multi-floor NPC hub) that override means every nearby model — including ones on other floors or behind walls that the player cannot actually see — becomes a viewer and sends packets every tick.

Once a world crosses maxModelsForProximityOverride loaded models, the override is disabled there, so the occlusion raytrace runs even up close and culls the models the player has no line of sight to. The decision is per world (not global) so a crowded hub world doesn't penalize sparse worlds, which matches the AG-world-only symptom.

Functions

Link copied to clipboard
public static void clear()
Link copied to clipboard
public static int countInWorld(World world)
Link copied to clipboard
public static boolean proximityOverrideActive(World world)
Link copied to clipboard
public static void refresh()
Rebuilds the per-world counts on the primary thread, before tickPrimaryThread reads the snapshot.