Description
Lag Clear and Mob Limiter
Sweeps dropped items with a warning, caps mobs per chunk without touching pets or named mobs, and tells you what is lagging. Achievements stay on: stable Script API only, no experiments, no custom items. Made for Realms, dedicated servers and local worlds; tested on the dedicated server, not yet on a real Realm.
What it does
- Every 10 minutes dropped items are swept, with warnings at 30, 10 and 5 seconds. With fewer than 20 items on the ground nothing happens at all, so chat stays quiet.
- A sweep leaves alone: items younger than a minute (hopper lines keep working), renamed items, valuables (netherite, elytra, totems, shulker boxes, enchanted books, tridents and more), and anything within 8 blocks of a player's death for 5 minutes.
- Mob limits per chunk: 24 monsters and 32 animals by default, villagers only if you set a limit. Mobs over the limit are removed quietly, no drops and no experience, furthest from players first.
- Never removed: named, tamed, leashed or ridden mobs, mobs carrying a rider, bosses and golems.
/lagshows ticks per second, how many items and mobs are loaded, the most common entities, the busiest chunk and the next sweep. Anyone can use it./clearlag items,/clearlag mobs,/clearlag alland/clearlag cancelfor operators.- When the server stays under 10 ticks per second for 30 seconds, the next sweep comes early.
- Operators change any setting in game with
/lagconfig(numbers, booleans as 1 or 0) or/lagconfigtext, saved in the world; the settings also sit at the top ofscripts/main.jswith a comment for each:sweepMinutes,warnSeconds,minItemsToSweep,itemMinAgeSeconds,keepNamedItems,protectedItems,deathProtectMinutes,clearArrows,clearXpOrbs,limitMobs,mobCheckSeconds,maxHostilePerChunk,maxAnimalsPerChunk,maxVillagersPerChunk,exemptMobs,announce,tellOperators,autoClearTps.
Armor stands, minecarts, boats, item frames and everything else that is not a dropped item or a mob are never touched.
Tested
On the official Bedrock Dedicated Server:
- 37 checks with real items and real mobs in a Beta-APIs test world (the add-on itself uses no beta API): what a sweep takes and leaves, renamed items, the protected list, young items, a player's real death drops, arrows and orbs, armor stands, minecarts and boats untouched, 48 cows coming down to 32, named, tamed and leashed animals kept, monsters and animals counted apart, chunks counted apart, the mobs furthest from players going first, exempt mobs, golems, villagers, the limit running by itself, timed sweeps, and a busy script causing real lag until the sweep came forward by itself (about a minute).
- 79 checks with real network clients in a world with no experiments and cheats off, shared with the other three add-ons of this batch: /lag, /clearlag on real dropped items, warnings arriving before a timed sweep, /clearlag cancel, the mob limit reporting to operators only, and settings surviving a restart and /reload. After the run, level.dat still shows cheats off and no experiment ever used.
- 23 checks with real clients and all nine of our add-ons in one world, including /clearlag all next to the others.
Not tested: a real phone, console or PC client, and a real Realm. Not covered by the API: scripts only see loaded chunks, so nothing happens in chunks nobody is near, and this can't change how the game itself generates lag from redstone or big farms. Mobs are removed after they spawn, because stable scripts can't stop a spawn. Ticks per second are measured by the script.
Install: open the .mcaddon, then add the behaviour pack to your world, or put it in your server's behavior_packs folder and list it in world_behavior_packs.json. Needs Minecraft 1.21.100 or newer; it has only been run on 1.26.61. Licence: MIT.
Not affiliated with Mojang or Microsoft.
More free tools: actuallyop.com




