Skip to content

👥 Mob Crowd Overdraw Defense (Minecraft 26.2) ​

Dense mob farms, villager trading halls, and animal breeding pens can cause extreme framerate drops when hundreds of entities are stacked within a few blocks. While GPU Early-Z rasterization handles basic depth testing, extracting and submitting hundreds of mob skeletal hierarchies overloads CPU render dispatchers.

Camera Culling provides an optional, safeguarded crowd overdraw defense system.


📋 Mob Crowd Defense Infobox ​

PropertyValue
Config KeycullEntitiesBehindEntities (Default: false)
Cluster Density CapmaxEntitiesPerCluster (Default: 8 mobs / 1.5 blocks)
Distance Fast-Fail$> 16.0$ meters ($256.0\text{m}^2$)
Cluster Search RadiustargetBox.inflate(1.5)
Exempt EntitiesTransparent / Decorative mobs (Vex, ArmorStand, ItemFrame, Slime, MagmaCube)

🛑 16-Meter Distance Fast-Fail Architecture ​

In large open fields with dispersed cow herds, running spatial queries across all mobs causes unnecessary CPU overhead. In modern versions of Camera Culling, crowd overdraw culling enforces an immediate 16-meter distance fast-fail:

java
public static boolean isEntityOccludedByCloserEntities(Entity target, Level level, Vec3 camPos, AABB targetBox, double targetDistSq) {
    if (target == null || level == null || camPos == null) {
        return false;
    }

    // Fast-fail: only apply crowd overdraw culling within 16 meters
    if (targetDistSq > 256.0) {
        return false;
    }

    // 1. Cluster Density Cap in tight 1.5-block sphere
    int maxCluster = CameraCullingConfig.getMaxEntitiesPerCluster();
    AABB clusterBox = targetBox.inflate(1.5);
    List<Entity> clusterEntities = level.getEntities(target, clusterBox, 
        e -> e instanceof LivingEntity && !isTransparentOrDecorative(e));
    
    if (clusterEntities.size() < maxCluster) {
        return false;
    }

    int closerInCluster = 0;
    for (Entity e : clusterEntities) {
        double distSq = camPos.distanceToSqr(e.getX(), e.getY(), e.getZ());
        if (distSq < targetDistSq) {
            closerInCluster++;
            if (closerInCluster >= maxCluster) {
                return true; // Culled due to cluster density cap
            }
        }
    }
    return false;
}

Benefits: ​

  1. Zero Open-Field Overhead: Mobs grazing beyond 16 meters skip entity search sweeps entirely.
  2. Dense Pen Protection: In 1x1 or 2x2 mob grinder pens where 50+ cows/zombies are packed, rendering is capped to the frontmost 8 entities, eliminating lag spikes.

Official documentation & web portal for Dasik Igaijinn mods.