Minecraft Server

Saturday, Mar 20, 2021
#server #minecraft

I’ve been running a dedicated Minecraft server since Beta 1.6. That’s so old we used to actually have the piston mod and elemental arrows installed with Risugami’s Mod Loader. Over the years, I’ve used lots of different setups for server hosting and modding. Namely, Bukkit, Spigot, Paper, Forge, Sponge, and now Fabric. Each has their own history, lore, and drama, but I figured I’d write up a bit about why I switched to Fabric and how to setup a nice fast server that can be modded lightly if you’d like. I assume you have basic UNIX knowledge in this guide.

Getting a Server

Get yourself a computer. If you’ve got a fast internet connection, about 2Mbit up/down per player, I’d suggest hosting at home. You’ll want something with a few gigs of ram (about 512Mb per active player, so 4GB = about 8 players) and ideally it should be fairly quiet and have a low power draw. I used to use an old laptop with a cracked screen, you can probably get something like that at a yard sale or when your local college sells off their surplus, but if you’re looking for something brand new I like the SMBs from pine64 or the new raspberry pi 4. If you can’t host at home I’ve rented servers from Vultr, Digital Ocean, and OVH. It’s a little pricey, but you can be fairly sure you’ll have a reliable server with a static IP address assuming their datacenters don’t burn down.

Install a decent UNIX-like OS on it such as Debian, Alpine, OpenBSD, or CentOS. Once you’ve created an admin account, run initial updates, and enabled ssh, you’re ready to create the actual minecraft server. If you’re running the server at home make sure you forward port 25565 to your server and open that port up if you’re using a firewall.

Fabric Install

Install at least java, tmux, and wget. For Debian I normally run sudo apt install default-jre tmux wget rsync htop. The current stable version of openjdk will run very well, but for the best performance you’ll want openjdk 14+ which isn’t packaged by debian so I download it from here https://adoptopenjdk.net/.

Now, create a folder to store your minecraft install(s). I organize mine by creating an mc folder and then creating sub-folders for each minecraft release. cd into the folder and copy and paste the wget command from the fabricmc page. Once that downloads you’ll need to run the java command on that page below where you copied the wget command.

$ tree mc
mc
├── 14_survival
├── 15_modded
├── 15_survival
├── 16_survival
├── creative
└── snapshot
$ cd mc/16_survival
$ wget -O fabric-installer-0.7.2.jar https://maven.fabricmc.net/net/fabricmc/fabric-installer/0.7.2/fabric-installer-0.7.2.jar
$ java -jar fabric-installer-0.7.2.jar server -downloadMinecraft

The fabric installer will quickly download the standard minecraft server jar and then apply all of the fabric patches leaving you with two new jar files: fabric-server-launch.jar and server.jar. All you really need to do to run your server is start fabric-server-launch.jar. On my server I created the following start.sh file and marked it as executable.

#!/bin/sh
java -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -Xms4000M -Xmx4000M -jar fabric-server-launch.jar

That command will run the server with 4GB of ram and use the faster, but experimental ZGC garbage collector. If you’re just running the stable version of openjdk you should change that line to java -Xms4000M -Xmx4000M -jar fabric-server-launch.jar and change the amount of ram to whatever you have available – if you use too much the server wont start.

The very first time you start the server you’ll get an error message like this [20:00:58] [main/WARN]: Failed to load eula.txt. Open eula.txt in your favorite text editor, change the line to eula=true, and run the server again.

At this point you have a working vanilla server that can easily be expanded. The server.properties file has some basic configuration settings – I usually set the MOTD and create a server-icon.png file (64x64 pixels) to make the whole thing feel completed.

Mods

Finally, the fun part! Even if you’re planning on playing a very vanilla experience there’s a number of performance, bug fix, and minor feature mods to consider. You’ll notice a mods folder has been created in your server’s directory. Installing new mods is as simple as stopping your server (by typing stop in the server’s interactive shell), downloading a jar file for the fabric mod you’d like to install, copying it to the mods folder, and starting up the server again.

Fabric has an amazing community of dedicated and brilliant modders who actively embrace and support open source. Many of the other modding platforms of the past were “ruled with an iron fist” and generally had all the worst parts you see in other gaming communities. This is the primary reason I switched to fabric, but it also just so happens to have the fastest and fanciest server mods around.

Phosphor and Lithium

These two mods are “must have” performance mods that tackle the lighting engine and general purpose improvements. They drastically improve server performance and do so without changing any game mechanics unlike the tweaks provided by spigot or paper. These alone make it worth switching to fabric and there’s really no reason not to install them.

phosphor
lithium

Carpet

Carpet mod is a powerful mod for technical minecraft players. You can test your farms on a creative server with hopper counters and tick warping, view the server tps and mobcap to check performance, and enable dozens of interesting well thought out features. When you first install carpet, nothing will change in your game. You need to run commands on the server to enable the features you’d like to use.

carpet screenshot

On my own personal server I use this for bug fixes and to enable fun “end game oriented” features like autocrafting, block placing dispensers, stackable empty shulkers, renewable sand, gravel, etc. The best part is you don’t need a modded client to join a carpet server and you can always convert your world back to vanilla.

carpet
carpet-extra
carpet-autoCraftingTable

Fabric API

I figured this is a good time to bring up the fabric api. Technically it’s not required by lithium, phosphor, and carpet, but most of the rest of the mods on this list require you to have it and it’s just as easy to install as any other mod so you might as well install it quick.

fabric api

World Edit

By far one of the most powerful creative mods of all time. World edit allows you to change vast regions of your world instantly with simple selection commands and brushes. This is a must have on creative servers for planning out and experimenting with large builds. World edit is serverside only, but if your players want to more easily visualize their selections they can install the worldedit-cui client side mod.

worldedit
worldedit-cui

Auto Backup

Allows you to run a command on your server every few minutes safely and without corrupting your world. I use it to run an rsync command that compresses and copies a backup of my world folder to another server. The advantage of using this mod rather than a regular cron job is that it runs an in-game world save and then temporarily disables world saving to run your command.

auto backup

For a simpler alternative check out textile backup. It even has a setting to only make backups when people are on the server which can save a lot of disk space.

textile backup

Gunpowder

This is one of those “servery” mods that adds stuff like currency, sign shops, teleport commands, and lots of administration stuff. I don’t use it or anything like it, but if you’re into that sorta thing this is the one to get for fabric.

gunpowder

Username Remap

Basically a nickname mod. You have to manually edit a json file to create the name mappings for each player. I’m sure gunpowder and friends have an easy way to do this, but for small servers with a few players this is fairly easy to install and setup.

username remap

Fabric Chunk Pregenerator

If you’ve got disk space to spare you can use this mod to pre-generate a huge region of your world which will have massive performance improvements whenever your players go off exploring. NOTE: if you pregenerate your world and a new update comes out with cool biomes you want to explore you’ll have to travel past the pregenerated chunks or try to manually delete the ones that haven’t been visited.

fabric chunk pregenerator

Inventory Sorting

This simple mod allows your players to sort their inventory or chests at the press of a button. Unfortunately, for your players to take advantage of this they must install a client side compentent. If they don’t have it they can still play on the server like normal so it doesn’t hurt to have this installed. There are alternative inventory sorting mods, such as mouse wheelie, but they operate client side only so they actually require the client to send hundreds of quick commands to the server telling it how to move everything around – which is slow and uses a lot of bandwidth.

inventory-sorting
mouse wheelie

Color Unchained

Minecraft supports some basic text coloring and markup, but in vanilla doesn’t have any way for players to actually use these features. Color Unchained, if installed on both the server and clients, allows users to add color and markup to their chat messages, books, signs, and it will display for all users regardless of if they have the client side mod installed.

color unchained

For a more serverside only approach try Text Colorizer Plugin.

text colorizer plugin

Appleskin

Similar to the last two this mod adds an optional feature for players who have the client side compentent installed, however it’s the 5th most popular mod on curseforge so it’s likely some players will have it. Appleskin simply shows a little visualization when you mouse over a piece of food in game showing how much hunger and saturation it will restore.

appleskin

Creative One-Punch

One punch any mob while in creative mode and not holding a weapon.

creaive one punch

I am very smart

Instantly unlock all recipes for your players. For seasoned players the “recipe unlock” feature is mostly just annoying.

i am very smart

Couplings

Open double doors and fence gates by right clicking one of them. Technically it’s changing a mechanic, but once you start using this mod it feels ridiculous when you try playing without it. Works best if your players have the client side version installed, but you can use it server side only.

couplings

Fabric Tree Chopper

This is the best fabric lumberjack / tree feller mod. It’s definitely not vanilla and considered cheaty by some, but it’s always been one of the most downloaded plugins for other server platforms. Personally, I’m on the fence about it. I don’t think manually chopping trees in minecraft is enjoyable or rewarding, but having a tree chopper mod effectively removes any incentive to create tree farms which can be a fun mid/late game challenge.

fabric tree chopper

Starlight

A complete re-write of minecraft’s lighting engine. This mod is in beta, but is becoming more stable every day. Unlike phosphor, this mod doesn’t just tweak the vanilla engine, it scraps it and rewrites it all from scratch. As a result it’s several orders of magnitude faster than vanilla and even phosphor.

starlight

Krypon

An optimization mod that tackles the minecraft networking stack. It’s completely compatible with vanilla and is really helpful for self-hosted setups with limited upload bandwidth.

kyrpton

Immersive Cursedness

I have no idea how they managed to to it. It’s a server side only implementation of immersive portals. It allows you to look through a nether portal and see the other side. Definitely do regular server backups if you’re using this one.

immersive cursedness

It’s a little bit jank compared to the real immersive portals mod (which also works on fabric, but must be installed on both the server and clients). The fact that this works at all is incredible.

immersive cursedness
immersive portals

Bedrock Waters

Changes the water color slightly to match the biome it’s in. The bedrock version of the game has this feature, but it hasn’t been officially ported to java yet. If you install this only players with the client side mod will get the full effect, BUT everyone will have the underwater fog color change which could be annoying/weird for players who don’t have the client side mod installed.

bedrock waters

Stiched Snow

stiched snow

Makes the snow stack up a bit, looks great and honestly why the hell isn’t this just in vanilla?!?!?

stiched snow

MOOOARRRRR

This list is the mostly vanilla serverside fabric mods I’ve actually tried out. Once you have your server up and running you can browse modrinth and curseforge to find loads more.