Reducing Lag

## What is Lag

Lag is not caused by one person, it is caused by all of us. Some of us cause more lag than others, but we can all do small things to reduce the amount of lag we cause.

1. Remember: do not ever accuse anyone else of being the problem. If you believe someone’s build or behavior is a large contributor to the lag... please privately tell a staff member so we can look into it.
2. Reach out to staff if you're having trouble with making redstone contraptions lag-friendly. Ask for help if you're having trouble making machines that automatically shut off when not needed.

### Mobs

Mobs are the #1 cause of lag on a survival Minecraft server! They can be surprisingly hard on the server, and mob lag is something we all contribute to. Because of this, never keep more than you need of any given mob, at any given time.

1. Villagers should not be allowed to build up from a breeder, and you should cull undesirables as needed to keep your numbers as low as possible. Think carefully about which villagers you really need and if you can make dual use of some.
	1. Only use infinite villager breeder designs if you limit their breeding by limiting their food.
2. Villagers used for trading should be named with an "`Optimize`" nametag to remove their AI. This will disable their AI for anything other than trading. They won't move, try and find their POI's, etc - but you can still trade with them. This helps server performance a lot! Change their name to something else to re-enable their AI. Any villagers used for trading found without their AI disabled could be removed by staff if they are found to be causing lag.
3. Turtles only need one breeding pair. The breeding mechanic of turtles allows you to breed one pair over and over, since they become fertile again immediately upon laying their eggs.
4. Consider not raising pigs at all. Their meat has the same benefits as beef and they have no secondary drops. You're better off without them!
5. Do not fill your base with more vanilla pets than you need.
6. Never circumvent entity cramming. It is there because a lot of entities crammed into a small space is hard on the server.

### Minecarts

Minecarts are another type of entity that cause a lot of lag. They are harder on the server than you might think.

1. Do not store villagers or other mobs in minecarts of boats for long periods of time. Use them for transportation, and then drop them off in an enclosed location at the end of your track.
2. Do not use farm designs that rely on many hopper minecarts. They are convenient because they pick up items through blocks and have a faster throughput than hoppers, but they are unnecessarily hard on the server.
3. Avoid using minecarts for entity cramming purposes when possible. Try to design your farm to have only one such killing chamber, if one is even necessary.

### Hoppers

Hoppers cause lag because they are constantly checking for items, even when nothing is in them, so you should minimize your use of them.

1. When bringing items down through a vertical line of hoppers, try alternating them with single chests. This saves you iron and saves the server a bit of lag.
2. Bulk storage systems where random items are dropped in and sent into chests should be avoided because they are likely to cause a situation that is especially taxing. More specifically: A hopper pushing items into a full chest that are not in the chest OR A hopper trying to pull items from a chest to complete stacks but none of the items in the chest match.
3. MYTH: Droppers/Furnaces on top of hoppers reduce lag. Droppers on top of hoppers do not reduce lag, and furnaces are a slightly laggy object in their own right, so do not use them unnecessarily.
4. When moving items long distances use water streams. Also try to use water to gather newly farmed items rather than an array of hoppers. Do not make water streams so long that they flow into unloaded chunks, as the items can back up where chunks unload and create a ticking lag bomb of item entities. Finally, set things up so that, if the storage system at the other end fills up, the extra items get automatically destroyed rather than sitting on full hoppers to despawn.

### Redstone Farms

Redstone contraptions are, by their nature, going to contribute some lag. But you can do things to reduce their impact.

1. Bigger is not always better. Try to make farms a reasonable size for what you need and no larger. Think about how much of a resource you actually need.
2. Think about the design you use; minimize how much redstone is running at once. If you have a farm with a lot of pistons to break crops automatically, can you set it up so that the pistons fire in sequence instead of all at once? Can you use a slime block push bar so that you only need one piston and one observer for every 12 plants instead of one per each?
3. Set up your machines to shut off when not in use. This is key! A good on/off switch is most important for any redstone farm.
4. If you use a minecart hopper/chest to transport items, make sure it automatically docks when there are no items to move. You can set up the minecart pickup to only run after a harvest and an auto-smelter that uses minecarts to fill the furnaces does not need to have the minecart running all the time, only when it’s dropping off items.
5. Redstone clocks rarely need to run all the time. For example, an item disposal dropper can be set up to automatically trigger the clock when there are items in the dropper and to shut off the clock when the dropper is empty.

### Other Entities

You may have noticed a theme in this list. Everything we've listed is an entity. Entities are the biggest cause of lag on Stormy Lagoon, and anything we can do to reduce the number of entities on the server will help!

1. Any block entity causes more lag than a normal block, but some cause more than others. Check out this site for examples!
2. Leave signs blank when possible. Signs with text on them are laggier than empty signs, so think about whether or not you need to write on that sign. You should especially leave signs blank when they're used for technical reasons, like to hold back lava or water.
3. Minimize item frames. You should never use a lot for no reason, because even though they're a small contributor to lag, they add up easily!
4. Brewing stands cause more lag than you might think... so please do not have more placed than you need.
5. Leaving mass amounts of items to despawn puts an unnecessary strain on the server. Please pick up item entities when mining, even if you don’t actually want them. You can dispose of them by throwing them in lava or on a cactus. You can also use /trash.

## Farm Limiter

Farm Limiter is a plugin that introduces hard limits to mobs. We've provided the settings of this plugin below for your reference. Do not try to circumvent this system. It is in place for a reason! Picture of how grouping works on the server.

```
- entities: all
 exclude: villager, zombie villager, dropped item, experience orb, leash hitch, painting, item frame, armor stand, minecart, minecart chest, minecart command, minecart furnace, minecart hopper, minecart mob spawner, minecart tnt
 distance: 3
 max-amount: 25

- entities: area effect cloud, arrow, boat, dragon fireball, egg, ender crystal, ender pearl, ender signal, falling block, fireball, firework, llama spit, primed tnt, shulker bullet, small fireball, snowball, spectral arrow, splash potion, thrown exp bottle, trident, wither skull
 distance: 10
 max-amount: 20

- entities: minecart, minecart chest, minecart command, minecart furnace, minecart hopper, minecart mob spawner, minecart tnt
 distance: 10
 max-amount: 10

- entities: bat, cat, chicken, cod, cow, donkey, fox, horse, mushroom cow, mule, ocelot, parrot, pig, rabbit, salmon, sheep, skeleton horse, snowman, squid, tropical fish, wandering trader, bee, dolphin, iron golem, llama, panda, piglin, polar bear, pufferfish, wolf, axolotl, glow squid, goat, trader llama
 distance: 3
 max-amount: 20

- entities: blaze, creeper, drowned, elder guardian, evoker, ghast, guardian, hoglin, husk, magma cube, phantom, pillager, ravager, shulker, silverfish, skeleton, slime, stray, vex, vindicator, witch, wither skeleton, zoglin, zombie, cave spider, spider, zombie horse, giant, enderman, illusioner, piglin brute, zombified piglin, strider, wither
 distance: 1
 max-amount: 10

- entities: turtle
 distance: 5
 max-amount: 10

- entities: villager, zombie villager
 distance: 50
 max-amount: 70

- entities: endermite
 distance: 10
 max-amount: 5
- entities: enderman
 worlds: all
 distance: 50
 max-amount: 1

- entities: allay
 worlds: all
 distance: 50
 max-amount: 2

- entities: frog
 worlds: all
 distance: 25
 max-amount: 2

```