Skip to main content

Mob Cluster Optimization

Optimizing mob clusters (animals & monsters) is important for keeping TPS stable, especially on survival servers with lots of farms. This section covers why mobs can make the server heavy, the lag patterns that often appear, and how to handle them using plugins like FarmControl.


Basics of How Mobs & AI Work

Minecraft always runs several processes on every mob, such as:

  • AI Tick
    All mobs (animals & hostile) perform pathfinding (finding a route), wander movement (random movement), and interactions (eating, looking for certain blocks, following players). The AI tick is one of the CPU-heavy processes.
  • Breeding Logic
    Animals check whether they are "breeding-ready", look for a partner, and pathfind (find a route) toward the target
  • Movement & Collision
    Mobs always calculate collisions with blocks, collisions with entities, gravity, and water push. Mass movement (20–50+ mobs in one area) = a big load.
  • Mobcap/Spawn-count
    When the mobcap is nearly full, the server keeps checking chunks for spawns, even when they're not visible; this is an extra CPU load.

    Source: https://minecraft.wiki/w/Mob_AI


Lag Patterns Caused by Mob Clusters

  • Mob Ball
    Mobs pile up in one spot & collide with each other. Example: a small farm with 50–150 cows in a single pen, or a mob grinder that doesn't kill mobs quickly. The effect is high collision ticks, panicked pathfinding, and a drastic rise in "entity ticks"
  • Farm Oversized
    Survival servers often have farms with a huge number of mobs. The problem is: the breeding loop never stops, mobs need a lot of AI ticks, and their random movement triggers physics ticks.
  • Random Movement Spam
    Mobs that aren't tightly confined tend to wander around the area. Pathfinding (finding a route) = one of the biggest CPU costs in Minecraft.
  • Zombie/Hostile Mob Clumping If hostile mobs gather in 1 large chunk: aggressive pathfinding and player tracking every tick.

Limiting Mob Clusters With Plugins

FarmControl is a plugin that is very well suited for controlling mob clusters automatically without changing vanilla gameplay too much.

MobControl

Image Source: https://www.spigotmc.org/resources/farmcontrol.86923/

What Does FarmControl Do?

FarmControl reduces CPU load by:

  • Disabling AI on mobs in farms in large numbers.
  • Limiting the number of mobs within a certain chunk/radius (automatic trim/kill).
  • Turning off breeding if a farm is considered too large.
  • Reducing random movement that has no effect on the farm.
    All of the processes above are done asynchronously, so this plugin is relatively lightweight.

Example FarmControl Configuration

# Contoh: Maks 25 cow per chunk
trim-cow-chunks:
group:
types:
- "cow"
count: 26
distance: same-chunk
actions:
- kill

Written by Evan Andreyan (A.K.A LourenT) - Head of Development, foxy-network.net