Mob Limiter
The Mob Limiter module prevents excessive mob spawning by enforcing per-chunk limits.
Overview
Purpose: Control entity spawning to prevent lag from too many mobs in one area.
Key Features:
- Global mob limit per chunk
- Per-type mob limits for specific control
- Prevents both natural spawns and spawner spawns
- Automatic chunk optimization
- Real-time enforcement
How It Works
- When a mob tries to spawn, the plugin checks the chunk's mob count
- If the chunk has reached the limit, the spawn is cancelled
- Per-type limits can further restrict specific mob types
- Works with spawners, natural spawns, and breeding
Example:
- Chunk limit: 50 mobs
- Current mobs in chunk: 49
- Next spawn: Allowed (49 < 50)
- After that: Cancelled (50 = 50)
Configuration
Location: plugins/ClearLaggEnhanced/module/mob-limiter/config.yml
Basic Settings
enabled: true
max-mobs-per-chunk: 50 # Global mob limit per chunk
Recommended values:
- Small servers (1-20 players):
75 - Medium servers (20-100 players):
50 - Large servers (100+ players):
35 - Laggy servers:
25-30
Per-Type Limits
per-type-limits:
enabled: true
limits:
ZOMBIE: 10
SKELETON: 10
CREEPER: 8
SPIDER: 8
ENDERMAN: 5
VILLAGER: 15
COW: 12
SHEEP: 12
PIG: 12
CHICKEN: 15
IRON_GOLEM: 3
How per-type limits work:
- Limits apply in addition to the global limit
- Even if global limit allows it, per-type limit can block spawns
- Useful for controlling specific problematic mobs
Example:
- Global limit: 50 mobs per chunk
- Zombie limit: 10 per chunk
- Chunk has 30 total mobs, but 10 are zombies
- Next zombie spawn: Cancelled (zombie limit reached)
- Next cow spawn: Allowed (cow limit not reached, global limit OK)
Common Configurations
Passive Mob Farm Server
max-mobs-per-chunk: 60
per-type-limits:
enabled: true
limits:
COW: 20
SHEEP: 20
PIG: 20
CHICKEN: 20
ZOMBIE: 8
SKELETON: 8
CREEPER: 5
Result: Higher limits for farm animals, lower for hostiles.
Hostile Mob Farm Focus
max-mobs-per-chunk: 50
per-type-limits:
enabled: true
limits:
ZOMBIE: 15
SKELETON: 15
CREEPER: 10
SPIDER: 10
COW: 5
SHEEP: 5
PIG: 5
CHICKEN: 5
Result: Higher limits for hostiles, lower for passives.
PvP/Survival Balance
max-mobs-per-chunk: 40
per-type-limits:
enabled: true
limits:
ZOMBIE: 10
SKELETON: 10
CREEPER: 8
ENDERMAN: 5
VILLAGER: 12
IRON_GOLEM: 3
Result: Balanced for both PvE and trading.
Usage Examples
Scenario 1: Spawner Farm
You have a zombie spawner farm in a chunk:
- Spawner tries to spawn zombies
- Chunk already has 50 mobs
- Spawn is cancelled
- Farm naturally limits itself
Benefit: No need to manually limit spawner output.
Scenario 2: Natural Spawning
Players are exploring caves:
- Chunk has 45 mobs naturally
- Next mob tries to spawn naturally
- Spawn is cancelled (45 < 50, but limit is 50)
- Prevents chunk from having excessive mobs
Benefit: Prevents lag from mob-heavy areas.
Scenario 3: Per-Type Protection
Your server has too many creepers:
per-type-limits:
enabled: true
limits:
CREEPER: 5 # Max 5 creepers per chunk
ZOMBIE: 15 # But allow 15 zombies
Result: Creepers are limited while other mobs can spawn normally.
Integration with Other Modules
Works With: Spawner Limiter
When used together:
- Spawner tries to spawn
- Mob Limiter checks chunk limit
- If OK, Spawner Limiter checks spawner delay
- Only spawns if both allow it
Works With: Entity Clearing
- Entity clearing removes excess mobs
- Mob count drops below limit
- New mobs can spawn again
- Creates natural cycle
Recommendation: Use both modules together for best results.
Entity Types
Common hostile mobs:
ZOMBIESKELETONCREEPERSPIDERCAVE_SPIDERENDERMANWITCHBLAZEPHANTOM
Common passive mobs:
COWSHEEPPIGCHICKENRABBITHORSEDONKEYFOX
Villagers and utility:
VILLAGERZOMBIE_VILLAGERIRON_GOLEMSNOW_GOLEMALLAY
Full list: Spigot EntityType
Performance Impact
Minimal overhead:
- Checks happen only during spawn events
- Fast chunk mob counting (O(n) where n = entities in chunk)
- No continuous background tasks
Expected impact:
- < 1ms per spawn event
- Prevents lag by stopping spawns early
- Actually improves performance overall
Troubleshooting
Mobs Not Spawning
Check these:
- Is
enabled: true? - What is
max-mobs-per-chunkset to? - Are there already that many mobs in the chunk?
- Check per-type limits for specific mob types
Debug steps:
- Stand in a chunk
- Count mobs with
/lagg chunkfinderor manually - If count >= limit, spawns will be blocked
- Increase limit or clear entities
Too Many Mobs Still Spawning
Solutions:
- Lower
max-mobs-per-chunkvalue - Enable per-type limits for problematic mobs
- Use with Entity Clearing module
- Check if mobs are spawning in different chunks
Per-Type Limits Not Working
Verify:
- Is
per-type-limits.enabled: true? - Check entity type name spelling (must match exactly)
- Entity types are case-sensitive:
ZOMBIE, notzombie - Check console for errors
Spawner Not Producing Mobs
This is normal if:
- Chunk has reached mob limit
- Specific mob type has reached its limit
- Use with Spawner Limiter for more control
Solutions:
- Increase
max-mobs-per-chunk - Increase per-type limit for spawner mob
- Spread spawners across multiple chunks
Advanced Configuration
Dimension-Specific Limits
max-mobs-per-chunk: 50 # Default for overworld
per-type-limits:
enabled: true
limits:
ZOMBIE_PIGLIN: 20 # Higher in nether
BLAZE: 15
GHAST: 5
Note: This config applies to all worlds. For world-specific configs, you would need multiple instances (not currently supported, but planned).
Farm-Friendly Settings
max-mobs-per-chunk: 75 # High limit for farms
per-type-limits:
enabled: true
limits:
ZOMBIE: 30 # Allow large zombie farms
SKELETON: 30
COW: 30
CHICKEN: 30
CREEPER: 15 # Still limit creepers
Minimal Performance Impact
max-mobs-per-chunk: 100 # Very high limit
per-type-limits:
enabled: false # Disable per-type checks
Use when: Performance is good, just want absolute maximum safety.
Related Modules
- Spawner Limiter - Control spawner activation
- Entity Clearing - Remove existing entities
- Misc Entity Limiter - Limit non-mob entities