FTB Server

games
Report Issue

FTB modpacks are now distributed through their own API. This egg was developed for support for modpacks that are distributed through this.

Contributors:
README

FTB Modpacks

A generic service to pull FTB modpacks from api.feed-the-beast.com. There are 2 ways to install a server through this service. The first method only requires you to know the modpacks name and (optionally) version. The second method requires you to know the id for the modpack and (optionally) version in the api.

Method 1 (Recommended)

  • FTB_SEARCH_TERM: the modpack name to query for, must be at least 3 characters long. EX: for FTB: Interactions you would do "interactions".
  • FTB_VERSION_STRING: the string version that you want to install. Leave blank to install latest stable release. EX: for FTB: Interactions 2.0.2, you would put "2.0.2".

Method 2

  • FTB_MODPACK_ID: the id that directs to the modpack in the api. EX: for FTB: Interactions the id would be "5". https://api.feed-the-beast.com/v1/modpacks/public/modpack/5
  • FTB_MODPACK_VERSION_ID: the version id in the api. Leave blank to install latest stable release. EX: for FTB: Interactions 2.0.2 the id is "86". https://api.feed-the-beast.com/v1/modpacks/public/modpack/5/86

NOTE Not all FTB packs come with a server.properties file, due to this the server.properties file may not get updated with the correct ip address and port at first launch. Please restart the server after first launch to fix this.

Neoforged

If you have trouble using an neoforge pack, make sure to select the latest java.

Server Ports

The minecraft server requires a single port for access (default 25565) but plugins may require extra ports to enabled for the server.

Port default
Game 25565
Docker Images (8)
Name Image
Java 8 ghcr.io/ptero-eggs/yolks:java_8
Java 11 ghcr.io/ptero-eggs/yolks:java_11
Java 16 ghcr.io/ptero-eggs/yolks:java_16
Java 17 ghcr.io/ptero-eggs/yolks:java_17
Java 21 ghcr.io/ptero-eggs/yolks:java_21
Java 22 ghcr.io/ptero-eggs/yolks:java_22
Java 23 ghcr.io/ptero-eggs/yolks:java_23
Java 24 ghcr.io/ptero-eggs/yolks:java_24
Startup Command
java $( [[ -f log4jfix/Log4jPatcher.jar ]] && printf %s "-javaagent:log4jfix/Log4jPatcher.jar " ) -Xms128M -XX:MaxRAMPercentage=95.0 -Dterminal.jline=false -Dterminal.ansi=true $( [[ ! -f unix_args.txt ]] && printf %s "-jar start-server.jar" || printf %s "@unix_args.txt" )
Variables (4)

FTB Pack search term

the search term for finding the modpack. needs to be at least 4 characters long. Find out what term is needed by using the ftb app and searching with the term. make sure it only returns 1 result. can also be searched for via: https://api.feed-the-beast.com/v1/modpacks/public/modpack/search/8?term={SEARCHTERM} only needed if the modpack id and modpack version id is unknown.

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

FTB modpack ID

The FTB Api modpack ID. Needed if not using the search variable Example: FTB Interactions ID is 5. https://api.feed-the-beast.com/v1/modpacks/public/modpack/5

Environment:
FTB_MODPACK_ID
Default:
None
User Viewable:
User Editable:
Rules:
nullable|integer

FTB Pack Version

what version of the modpack to install. leave empty if using the modpack version id variable.

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

FTB Pack Version ID

The modpack api version ID. Leave this and FTB Pack Version empty to install latest. Example FTB Revelations version id for version "2.0.2" is 86. which would come out as: https://api.feed-the-beast.com/v1/modpacks/public/modpack/5/86

Environment:
FTB_MODPACK_VERSION_ID
Default:
None
User Viewable:
User Editable:
Rules:
nullable|integer
Installation Script
Container: eclipse-temurin:8-jdk-jammy
Entrypoint: bash
#!/bin/bash
# FTB Pack Installation Script
#
# Server Files: /mnt/server
if [ ! -d /mnt/server ]; then
    mkdir -p /mnt/server
fi
cd /mnt/server || { echo "Failed to change into server directory"; exit 1; }


# Download needed software.
function install_required {
    apt update
    apt install -y curl jq
}

function get_modpack_id {
    urlencode() {
        local string="${1// /%20}"
        echo "$string"
    }
    
    # if no modpack id is set and modpack search term is set.
    if [ -z "${FTB_MODPACK_ID}" ] && [ -n "${FTB_SEARCH_TERM}" ]; then
        encoded_search_term=$(urlencode "$FTB_SEARCH_TERM")
        JSON_DATA=$(curl -sSL https://api.feed-the-beast.com/v1/modpacks/public/modpack/search/8?term="${encoded_search_term}")
    
        # grabs the first modpack in array.
        FTB_MODPACK_ID=$(echo -e "${JSON_DATA}" | jq -r ".packs[0]")
    fi
    
    if [ -z "${FTB_MODPACK_VERSION_ID}" ] && [ -n "${FTB_VERSION_STRING}" ]; then
        # grabs the correct version id matching the string.
        FTB_MODPACK_VERSION_ID=$(curl -sSL https://api.feed-the-beast.com/v1/modpacks/public/modpack/"${FTB_MODPACK_ID}" | jq -r --arg VSTRING "${FTB_VERSION_STRING}" '.versions[] | select(.name == $VSTRING) | .id')
    fi
}

function run_installer {
    # get architecture for installer
    INSTALLER_TYPE=$([ "$(uname -m)" == "x86_64" ] && echo "linux" || echo "arm/linux")
    echo "ModpackID: ${FTB_MODPACK_ID} VersionID: ${FTB_MODPACK_VERSION_ID:-latest} InstallerType: ${INSTALLER_TYPE}"

    # download installer
    curl -Ls https://api.feed-the-beast.com/v1/modpacks/public/modpack/0/0/server/${INSTALLER_TYPE} --output serversetup
    chmod +x ./serversetup
    
    # remove old forge files (to allow updating)
    rm -rf libraries/net/minecraftforge/forge
    rm -rf libraries/net/neoforged/forge
    rm -rf libraries/net/neoforged/neoforge
    rm -f unix_args.txt
    
    # Remove old log4jpatcher
    rm -rf log4jfix/
    
    # run installer
    # shellcheck disable=SC2046
    ./serversetup -pack "${FTB_MODPACK_ID}" $([ -n "$FTB_MODPACK_VERSION_ID" ] && echo "-version $FTB_MODPACK_VERSION_ID") -no-colours -no-java -auto -force || { echo "Failed to run FTB Installer"; exit 1; }
}

# allows startup command to work
function move_startup_files {
    # create symlink for forge unix_args.txt if exists
    if compgen -G "libraries/net/minecraftforge/forge/*/unix_args.txt"; then
        ln -sf libraries/net/minecraftforge/forge/*/unix_args.txt unix_args.txt
    fi
    
    # create symlink for neoforge unix_args.txt if exists
    if compgen -G "libraries/net/neoforged/forge/*/unix_args.txt"; then
        ln -sf libraries/net/neoforged/forge/*/unix_args.txt unix_args.txt
    fi
    if compgen -G "libraries/net/neoforged/neoforge/*/unix_args.txt"; then
        ln -sf libraries/net/neoforged/neoforge/*/unix_args.txt unix_args.txt
    fi
    
    # Create symlink for log4jpatcher that is sometimes included
    if compgen -G "log4jfix/Log4jPatcher-*.jar"; then
        ln -sf log4jfix/Log4jPatcher-*.jar log4jfix/Log4jPatcher.jar
    fi
    
    # move forge/neoforge/fabric jar file to start-server.jar if exists
    if compgen -G "forge-*.jar"; then
        mv -f forge-*.jar start-server.jar
    elif compgen -G "fabric-*.jar"; then
        mv -f fabric-*.jar start-server.jar
    fi
}

# installer cleanup
function installer_cleanup {
    rm serversetup
    rm -f run.bat
    rm -f run.sh
}

# run installation steps
install_required
get_modpack_id
run_installer
move_startup_files
installer_cleanup

echo "Finished installing FTB modpack"