tModloader

games
Report Issue

tModLoader is essentially a mod that provides a way to load your own mods without having to work directly with Terraria's source code itself. This means you can easily make mods that are compatible with other people's mods, save yourself the trouble of having to decompile and recompile Terraria.exe, and escape from having to understand all of the obscure "intricacies" of Terraria's source code. It is made to work for Terraria 1.3+.

Contributors:
README

tModLoader

From their GitHub

tModLoader is essentially a mod that provides a way to load your own mods without having to work directly with Terraria's source code itself. This means you can easily make mods that are compatible with other people's mods, save yourself the trouble of having to decompile and recompile Terraria.exe, and escape from having to understand all of the obscure "intricacies" of Terraria's source code. It is made to work for Terraria 1.3+.

Install notes

Due to rate limiting the console on the panel cannot keep up with the game console and the build will complete before the panel console may show it. Reloading the console will load it to the latest part of the log.

Minimum RAM warning

You may want to assign a minimum of 768 mb of RAM to a server as it will use around 650 mb to generate the world on the first start.

Server Ports

tModloader, like Terraria, only requires a single port to run. The default is 7777

Port default
Game 7777

Plugins may require ports to be added to the server.

Extra Information

If you want to download mods in the console, the startup command has to be changed.

New startup: ./tModLoaderServer -ip 0.0.0.0 -port ${SERVER_PORT} -maxplayers ${MAX_PLAYERS} -savedirectory ~/ -tmlsavedirectory ~/saves -modpath ~/mods

This will remove the autocreate function, and will thus allow you to download mods and generate world. Afterwards, you can change it back with the correct world name to start automatic. Word name is set in the configuration panel.

Docker Images (2)
Name Image
Dotnet 8 ghcr.io/ptero-eggs/yolks:dotnet_8
Dotnet 6 ghcr.io/ptero-eggs/yolks:dotnet_6
Startup Command
./tModLoaderServer -ip 0.0.0.0 -port {{SERVER_PORT}} -maxplayers {{MAX_PLAYERS}} -password "{{SERVER_PASSWORD}}" -motd "{{MOTD}}" -lang {{LANGUAGE}} -world ~/saves/Worlds/{{WORLD_NAME}}.wld -worldname {{WORLD_NAME}} -autocreate {{WORLD_SIZE}} -config serverconfig.txt -savedirectory ~/ -tmlsavedirectory ~/saves -modpath ~/mods
Variables (10)

World Name

The name for the world file.

Environment:
WORLD_NAME
Default:
world
User Viewable:
User Editable:
Rules:
required|string|max:20

Max Players

The maximum number of players a server will hold.

Environment:
MAX_PLAYERS
Default:
8
User Viewable:
User Editable:
Rules:
required|numeric|digits_between:1,3

World Size

Defines the worlds size. 3 sizes 1 (small), 2 (medium), 3 (large).

Environment:
WORLD_SIZE
Default:
1
User Viewable:
User Editable:
Rules:
required|string|in:1,2,3

tModloader Version

The version of tModloader that is to be used.

Environment:
VERSION
Default:
latest
User Viewable:
User Editable:
Rules:
required|string|max:20

GitHub User

GitHub user to use for api calls. This only needs to be set if you hit the GitHub API too often across multiple servers.

Environment:
GITHUB_USER
Default:
None
User Viewable:
User Editable:
Rules:
string|nullable

GitHub OAuth Token

This can be either an OAuth or a Personal Access Token. This is required for the install is you set a user.

Environment:
GITHUB_OAUTH_TOKEN
Default:
None
User Viewable:
User Editable:
Rules:
string|nullable

Difficulty

Sets the difficulty of the world when using auto-create. Options: 0(normal), 1(expert), 2(master), 3(journey)

Environment:
DIFFICULTY
Default:
0
User Viewable:
User Editable:
Rules:
required|string|in:0,1,2,3

Server Password

Server password for users to connect to your server. Can be empty for no password.

Environment:
SERVER_PASSWORD
Default:
None
User Viewable:
User Editable:
Rules:
nullable|string|max:20

MOTD

Message of the Day for the server

Environment:
MOTD
Default:
Please don’t cut the purple trees!
User Viewable:
User Editable:
Rules:
required|string|max:40

Language

Sets the server language 1:English, 2:German, 3:Italian, 4:French, 5:Spanish

Environment:
LANGUAGE
Default:
1
User Viewable:
User Editable:
Rules:
required|string|in:1,2,3,4,5
Installation Script
Container: ghcr.io/ptero-eggs/installers:debian
Entrypoint: bash
#!/bin/bash
# Vanilla tModloader Installation Script
#
# Server Files: /mnt/server
## install packages to get version and download links
apt update
apt install -y file 

if [ -z "$GITHUB_USER" ] && [ -z "$GITHUB_OAUTH_TOKEN" ] ; then
    echo -e "using anon api call"
else
    echo -e "user and oauth token set"
    alias curl='curl -u $GITHUB_USER:$GITHUB_OAUTH_TOKEN '
fi

## get release info and download links
LATEST_JSON=$(curl --silent "https://api.github.com/repos/tmodloader/tmodloader/releases" | jq -c '.[]' | head -1)
RELEASES=$(curl --silent "https://api.github.com/repos/tmodloader/tmodloader/releases" | jq '.[]')


if [ -z "$VERSION" ] || [ "$VERSION" == "latest" ]; then
    echo -e "defaulting to latest release"
    DOWNLOAD_LINK=$(echo $LATEST_JSON | jq .assets | jq -r .[].browser_download_url | grep -i tmodloader.zip)
else
    VERSION_CHECK=$(echo $RELEASES | jq -r --arg VERSION "$VERSION" '. | select(.tag_name==$VERSION) | .tag_name')
    if [ "$VERSION" == "$VERSION_CHECK" ]; then
        if [[ "$VERSION" == v0* ]]; then
            DOWNLOAD_LINK=$(echo $RELEASES | jq -r --arg VERSION "$VERSION" '. | select(.tag_name==$VERSION) | .assets[].browser_download_url' | grep -i linux | grep -i zip)
        else
            DOWNLOAD_LINK=$(echo $RELEASES | jq -r --arg VERSION "$VERSION" '. | select(.tag_name==$VERSION) | .assets[].browser_download_url' | grep -i tmodloader.zip)
        fi
    else
        echo -e "defaulting to latest release"
        DOWNLOAD_LINK=$(echo $LATEST_JSON | jq .assets | jq -r .[].browser_download_url | grep -i tmodloader.zip)
    fi
fi

## mkdir and cd to /mnt/server/
mkdir -p /mnt/server

cd /mnt/server || exit 5

## download release
echo -e "running: curl -sSL ${DOWNLOAD_LINK} -o ${DOWNLOAD_LINK##*/}"
curl -sSL ${DOWNLOAD_LINK} -o ${DOWNLOAD_LINK##*/}

FILETYPE=$(file -F ',' ${DOWNLOAD_LINK##*/} | cut -d',' -f2 | cut -d' ' -f2)
if [ "$FILETYPE" == "gzip" ]; then
    tar xzvf ${DOWNLOAD_LINK##*/}
elif [ "$FILETYPE" == "Zip" ]; then
    unzip -o ${DOWNLOAD_LINK##*/}
else
    echo -e "unknown filetype. Exiting"
    exit 2
fi

if [[ "$VERSION" == v0* ]]; then
    chmod +x tModLoaderServer.bin.x86_64
    chmod +x tModLoaderServer
else
    #tiny startup script for backward compatibility
    echo 'dotnet tModLoader.dll -server "$@"' > tModLoaderServer
    chmod +x tModLoaderServer
fi

echo -e "Cleaning up extra files."
rm -rf terraria-server-*.zip rm ${DOWNLOAD_LINK##*/}
if [[ "$VERSION" != v0* ]]; then
    rm -rf DedicatedServerUtils LaunchUtils PlatformVariantLibs tModPorter RecentGitHubCommits.txt *.bat *.sh
fi

## using config for difficulty as the startup parameter does not work -> config parser
mv /mnt/server/serverconfig.txt /mnt/server/config.txt
sed 's/#difficulty/difficulty/' /mnt/server/config.txt > /mnt/server/serverconfig.txt
rm /mnt/server/config.txt

## install end
echo "-----------------------------------------"
echo "Installation completed..."
echo "-----------------------------------------"