DEV Community

Sam Erickson
Sam Erickson

Posted on

How to Create a Minecraft Server: Server Optimizations

The following optimizations can be made in game using the Minecraft command line. This is accessed by the / key.

Modifying Gamerules

You can read more about gamerules on the Offical Minecraft Wiki

Next we want to disable fireTick, this prevents fire from spreading. This reduces lag from accidental fires, and lava lakes burning down an entire forrest. We change the gamerule by typing:

/gamerule doFireTick false
Enter fullscreen mode Exit fullscreen mode

The gamerules that I change are:

  1. doFireTick=false: to prevent lag and destructive accidents
  2. doPatrolSpawning=false: prevent patrols from spawning and thus triggering raids in villages. This may be contriversial, but I have a limited amount of time in a day to play, and I do not want to spend it all dealing with raids. If I ever want a raid, I can turn it back on

Pre-generating terrain

Minecraft can read the level.dat file much faster than it can generate terrain. The level.dat file contains all information about the entities and blocks in a Minecraft world, Only the information about the areas that have been visited by the user. So before you have a bunch of players join and run arround each of them forcing the server to generate the areas they are exploring you will experience lots of lag. To avoid this I recommend flying around in spectator mode to load in the main area. I typically try and generate all the area within 1 2000-4000 block radius. (*Note that this will make your world file size reach into the GB).

You can enter spectator mode using the following command:

/gamemode spectator
Enter fullscreen mode Exit fullscreen mode

You can then get back to survival mode by:

/gamemode survival
Enter fullscreen mode Exit fullscreen mode

The reason you want to use spectator mode over creative mode is that you can use the scroll wheel to change the speed that you are able to fly around.

For more information on this watch Xisumavoid's video on Pre-Generating minecraft worlds. Note that his version of pre-generating is far more complicated than mine.

Discussion (0)