Server Setup

From GT New Horizons
Revision as of 07:44, 13 December 2023 by Embri (talk | contribs) (→‎Server Files: where to get older packs/clients)

A server is a way of running Minecraft that separates the game into two parts. The server simulates the world, while a client displays and handles input/output from each player and rendering the world. The two communicate constantly to create the game; a breakdown of this communication can cause lag. Running GT:NH as a separate server is required for more than one player to access the same world, as BetterQuesting does not support LAN. A Minecraft license is not needed for the server, but each player connecting must have a valid Minecraft account. Servers also need to be online to authenticate joining players.

Pros/Cons

Servers enable multiplayer fun, can improve TPS even in a single player (SP) world on the same machine, allow chunk-loaded areas to run 24/7 for passive resource production, and supports party progress in the Quest Book. They also have downsides; while running a server/client split can improve performance for SP, it's more prone to bugs and stability issues. Having machines running constantly can cause breakdowns if maintenance isn't automated or something unforeseen happens in-game. Servers are more complicated to set up than a SP instance of GT:NH and require regular technical support (restarts, backups, updates, lag-busting, etc.) An improperly secured server can leave its host machine vulnerable to DDoS attacks, becoming a bitcoin farming bot, or accessed by 3rd parties. Renting a remote hosting service is safer, but usually carries a monthly fee. If self-hosting, a second computer is usually used to run just the server which has its own cost.

Versions

Servers can run either the Java8 or Java17+ build of GT:NH. JRE 17+ is strongly recommended unless a hybrid server setup is being deployed. Players connecting to the server can run either Java8 or Java17+ with their own launcher; it doesn't have to match the server's, nor do all players need to use the same launcher/Java to play. The version of GTNH (ex. 2.4.0) must match exactly between all clients and the server. If the server updates to a different version, all players will have to update as well to join again. GTNH is not compatible with Bedrock Edition, due to being built almost entirely with mods.


edit 

Lost?

Any of these computer terms drawing a blank? Not sure the difference between a JDK, JRE or Java SE? Read this.


Hardware and Specs

Server Files

While our pack is hosted on many launchers we also maintain a repository of all of our releases. If the server fails to install via a launcher, attempt a manual download.

There are two variations of the pack, both for server and client. ..._Server.zip is for Java 8, _Server_Java_17_20.zip is for Java 17+. Make sure to pick the .zip file that matches the Java version the server will be running, or it will fail. Unless you have a reason not to, you should use the Java 17+ version as it has better garbage collection & performance on modern hardware. The only major reason not to use Java 17+ for a server is Thermos compatibility - and if you know what Thermos is, you know how to setup your own server more likely than not.

While Java 17 is the most widely tested with New Horizons, any Java build of 17 or later should suffice. Check if any versions of Java are already installed on your machine before downloading more. Oracle's closed source Java will also work with GT:NH, if preferred.

Setup Guides

Server Update

  1. Check in Dev Release Stability that the version you want to update to is stable enough. Note that versions ending with `.0` are generally considered stable, e.g., `2.3.0`.
  2. Download a new server version of GTNH.
  3. Backup your entire server folder.
  4. Delete the config (folder JourneymapServer from config will be needed later), libraries, mods, resources (if present) and scripts folders from your server folder. e.g., on a Linux server, use the following commands:
    cd you_server_folder
    rm -r config libraries mods resources scripts
    
  5. Replace the deleted folders with the ones from the downloaded archive.
  6. Transfer any customized config settings. Use your backup as a reference. Do not just copy old configs over! Move your changes as necessary or you may miss out on new functionality.
  7. Move over the JourneymapServer folder. This folder contains your world UUID inside a config file. If this file is lost, the server would generate a new map UUID and clients would lose their journeymap map data for your server.
  8. If you are using the Java 17+ version, then update and use these files from the downloaded archive to start the server: lwjgl3ify-forgePatches.jar, java9args.txt, startserver-java9.bat and startserver-java9.sh.

Whitelisting Players

In order to connect to the server yourself or allow other players to connect you must add them to the whitelist. To do this use the following command inside the server console window:
Syntax: whitelist add <playername>

Example: whitelist add shawnbyday

Server Backups

Go ahead and follow the above procedure to stop the server.

Unlike the client (single player) version of GT:HN, the server does not ship with a backup mod. We recommend Server Utilities which is the updated GT:HN fork of FTB Utilities. Download the most recent release and the file that ends in {numbers}.jar (so 2.0.3.jar, not -dev.jar or -sources.jar). Place the file(s) in your mods directory on the server (and it is recommended to put it on your client, also, so you can get access to claims, chunkloading, etc. See Additional Mods for more details or the repository Readme.


At this point you can go ahead and start your server again. By default Server Utilities will backup your server every 30 minutes. You can change this in the serverutilities.cfg configuration file which will be located in: C:\<GTNH Install Directory>\serverutilites\ folder. Modifying configuration files is outside of the scope of this guide, however, it is recommended to set the backup interval to be equal to or less the amount of work you are willing to lose. The default rotation keeps the last 12 backups - so the last 6 hours of play. Make sure you have enough space for the world and all its backups! If you run out of space you could corrupt your world save!

Chunk Loading

The 16x16 pieces of the world are called chunks. When a player loads into the world, the server starts to simulate the chunks around them -- it loads these chunks. You want some chunks to remain loaded when you're away. For example, for the machines to continue working, or for the crops to grow.

To have the functionality to load chunks, you need to add ServerUtilities or FTBUtilities & Library. ServerUtilties is recommended since it's a fork of FTBU modified specifically for GTNH. Do not install both of these at once, only one is necessary.

To add the mod(s), upload .jar files to the "mods" folder. The exact commands (wget/scp) for that are provided in the "mods for backups" chapter above, make sure to remove old version the mods before upload the new version.

After adding the mods, restart both the server and the client. After connecting to the server, you should see new icons to the left of the inventory. You can hide some of the icons through their settings. One of the icons opens a top-down map where you can manage the chunks. You can claim them and then select them again to load them -- a tooltip will indicate if a chunk is claimed or loaded when you hover over it. On FTBLib 1.0.18.5 and FTBUtilities 1.0.18.7, the LMB claims a chunk, Ctrl+LMB chunkloads a chunk, RMB unloads and unclaims a chunk.

If the described way to load chunks is not fitting, the Windows part of the manual describes the alternatives.

FAQ (Frequently Asked Questions)

  1. How do I connect to my server?
    1. On the Multiplayer Game you need to add a server and the server address can be (note by default the server is set to use the default Minecraft port which is 25565):
      1. localhost
      2. 127.0.0.1
  2. How do I let my friends connect?
    1. You will need to find out what your external IP address is (you can find this using Google).
    2. You then need to setup port forwarding on your modem/router (this is outside the scope of this guide and requires special attention to detail for privacy and security reasons - again Google is your friend here).