Description
LagShield
Server-side performance mod. On every tick it skips work no player can notice, and only when the server falls behind does it ease off on things far away from players. No client install required.
Performance
- Stress-test world: −34.8 % main-thread time — 28.17 → 18.38 ms per tick; tick time (MSPT) 18.58 → 16.63 ms (−10.5 %)
- 273-mod Create pack: −8.7 % tick time — 24.17 → 22.08 ms per tick
- Under load: another −15.4 % — AI culling, 26.41 → 22.35 ms
Measured with V17 while the server held 20 TPS: LagShield on and off in alternating rounds on the same running server, lower is better. MSPT only covers the tick itself; vanilla handles player packets between ticks, so main-thread time (CPU time of the server thread, tick and packets together) is where the entity tracking throttle shows up. Test setup, hardware and method are listed at the bottom of the image.
How much your server gains depends on what it has to do: machines in loaded but idle chunks, villagers away from players and many entities around moving players are where LagShield saves time.
Invisible optimizations
Always on, no gameplay change — they only skip recomputing answers that cannot have changed yet.
- Entity tracking throttle — vanilla re-checks the visibility of every entity on every movement packet of every player, even pure head turns. LagShield re-checks once the player has moved 2 blocks or 10 ticks have passed; entities at the edge of view range appear a few ticks later at most. −8.07 ms main-thread time with 8 walking players.
- Block entity loop skip — vanilla walks every block entity ticker each tick, including machines in chunks that are loaded but do not tick (the ring between simulation and view distance, or around force-loaded chunks). LagShield passes over those without touching them. Which block entities tick does not change. −0.41 ms in the stress-test world, −0.84 ms (−14.4 %) in the modpack.
- Mob-cap census reuse — the natural-spawning census walks every entity each tick. It is reused for 4 ticks; new spawns are still counted immediately, so mob caps are never exceeded. −0.74 ms with 5,760 mobs.
- Spawn-range cache — “is a player within 128 blocks of this chunk?” is cached per chunk for 20 ticks. Only matters with many players spread out; with 8 players close together it was within noise.
New in V18 (NeoForge only, not in the chart above). Each of these gives exactly the same result as vanilla: during testing every one ran side by side with the vanilla code over millions of calls, with zero differences.
- Villager food count — villagers count the food in their inventory in one pass instead of one pass per food item. In the 273-mod pack, where vanilla’s inventory count is unusually slow, this took a village of 256 villagers from 20.27 to 11.75 ms per tick (−42 %); in a lightly modded world it saves well under 0.1 ms.
- Tracker section reuse — entity tracking no longer builds a new section position for every entity on every tick just to compare it with the last one. Entity tracking 1.87 → 1.54 ms per tick with 6,300 tracked entities (−18 %).
- Chunk ticket memo — a chunk looked up again in the same tick is returned directly instead of getting the same “chunk in use” ticket a second time; loading and unloading stay as in vanilla. Lithium does the same, but Sable switches Lithium’s version off. About 30 % less time per lookup in the modpack.
Villager brain throttle
Villagers more than 32 blocks from every player look for new tasks (job site, bed, partner, stroll target) on every 4th tick instead of every tick. Walking, looking, swimming, trading, working and memories still update every tick, so villagers never freeze. Villagers in water, hurt, near a hostile, panicking or in a raid always decide at full speed, and iron golem spawning and bone-meal farmers work as in vanilla. −1.27 ms in the stress-test world, −1.29 ms in the modpack, 256 villagers.
Adaptive system (only when the server falls behind)
LagShield turns live TPS and player count into a stress level with a configurable fan curve, like fan-control software. While the server holds 20 TPS, everything in this section stays idle.
- AI culling — below about 18 TPS, mobs far from every player pause their AI; the distance shrinks from 43 to 10 blocks as stress rises. They wake up when a player comes close, when they get hurt, or when the server recovers. Which mobs to pause is worked out off the main thread from a snapshot. −4.06 ms (−15.4 %) with 400 mobs far from the players.
- Per-chunk mob limit — under load, freshly spawning mobs are refused in crowded chunks. Mobs loading from disk, persistent, named and tamed mobs are never refused.
- Kill switches — below 13 TPS fewer blocks may fall at once per chunk, below 12 TPS explosions are suppressed.
Cleanup
- XP orbs merge (Clumps-style)
- Arrows stuck in the ground despawn after 20 s (vanilla arrows only)
- Falling-block limit against sand/gravel lag machines — blocks over the limit drop as items, nothing is lost
- Timed ground-item cleaner (every 15 min, items older than 60 s, countdown warnings, item blacklist)
/lagshield forceclean— removes ground items, XP orbs and mobs; villagers, named and tamed mobs and a configurable whitelist (farm animals, iron golems, …) are kept
Always protected
Villagers, wandering traders, the Wither and the Ender Dragon (configurable VIP list) are never paused, limited or removed. Named and tamed mobs are never removed by a cleanup or refused at spawn.
Commands
/lagshield status— TPS, MSPT, RAM, entities, block entities, chunks, and how much each optimization skipped/lagshield reload— reload all configs without restarting/lagshield mode <ADAPTIVE|ECO|NORMAL|AGGRESSIVE|OFF>— override the operating mode/lagshield forceclean— clean up now
Configuration
Config lives in config/lagshield/ — lag_features.toml for module settings and mob_spawns.json for optional per-mob spawn control (spawn weight and cap per entity, off by default). Every module has its own switch; edits apply on save or with /lagshield reload.
A few modules change gameplay on purpose and can be switched off if your server does not want them: [SimpleMobAiReducer] (freshly spawned mobs lose the breed, tempt and panic goals), [VehicleMotionReducer] (caps very fast boats and minecarts) and preventChainReaction in [ExplosionOptimizer] (explosions do not push primed TNT).
Compatibility
Runs in a 273-mod Create pack alongside Lithium, C2ME, ModernFix, FerriteCore, Neruina and Sable, and on Arclight hybrid servers. I originally designed it for hybrid servers (Arclight, Mohist) and developed it for the Werewolves vs Vampires modpack.
Create and other automation packs: set enabled = false under [TickRateController]. Under load it slows down block entities far from players that look idle, which makes Create bearings and torsion springs fall behind. If you keep it on, add "create:*" to beBlacklist.
The Forge 1.20.1 build has the same config, but not the villager brain throttle and the three V18 shortcuts.


