feat: add gtnh server

This commit is contained in:
Katharina 2026-05-31 17:51:41 +02:00
parent d9b7ebf95c
commit 10e6d08ca9
6 changed files with 255 additions and 0 deletions

View file

@ -0,0 +1,13 @@
{
"UseWorldID": true,
"SaveInWorldFolder": true,
"cave": {
"PlayerCaveMapping": true,
"OpCaveMapping": true
},
"radar": {
"PlayerRadar": true,
"OpRadar": true
},
"ConfigVersion": 1.11
}

View file

@ -0,0 +1,137 @@
afk {
B:enabled=true
B:enabled_singleplayer=true
S:notification_timer=5m
}
backups {
B:only_backup_claimed_chunks=true
I:compression_level=5
B:delete_custom_name_backups=false
B:enable_backups=true
S:additional_backup_files <
saves/NEI/global/**
saves/NEI/local/$WORLDNAME/**
>
S:backup_folder_path=./backups/
S:backup_timer=0.5
I:backups_to_keep=12
B:display_file_size=true
I:max_folder_size=10
B:need_online_players=true
B:silent_backup=false
B:use_separate_thread=true
}
commands {
B:back=true
B:backup=true
B:chunks=true
B:dump_chunkloaders=true
B:dump_permissions=true
B:dump_stats=true
B:fly=true
B:god=false
B:heal=false
B:home=true
B:inv=true
B:kickme=false
B:killall=true
B:leaderboard=true
B:mute=false
B:nbtedit=true
B:nick=false
B:pregen=true
B:ranks=true
B:rec=false
B:reload=true
B:rtp=false
B:spawn=false
B:tpa=false
B:tpl=true
B:trash_can=true
B:vanish=true
B:warp=false
}
general {
B:enable_pause_when_empty_property=true
S:merge_offline_mode_players=TRUE
}
login {
B:enable_motd=false
S:motd <
"Hello player!"
>
B:enable_starting_items=false
S:starting_items <
{id:"minecraft:torch",Count:16,Damage:0,tag:{}}
{id:"sleepingbag:sleepingBag",Count:1,Damage:0,tag:{}}
>
}
ranks {
B:enabled=false
B:command_permissions=true
B:override_chat=true
}
tasks {
cleanup {
B:enabled=true
B:experience=true
B:hostiles=true
D:interval=2.0
B:items=true
B:passives=false
B:silent=false
}
}
teams {
B:autocreate_mp=false
B:autocreate_sp=true
B:disable_teams=false
B:force_team_prefix=false
B:grief_protection=true
B:hide_team_notification=false
B:interaction_protection=true
}
world {
B:chunk_claiming=true
B:chunk_loading=true
I:blocked_claiming_dimensions <
>
B:disable_player_suffocation_damage=false
S:disabled_right_click_items <
>
S:enable_explosions=TRUE
B:enable_player_sleeping_percentage=true
I:player_sleeping_percentage=50
S:enable_pvp=TRUE
I:spawn_dimension=0
I:forced_spawn_dimension_time=-1
I:forced_spawn_dimension_weather=-1
D:rtp_max_distance=100000.0
I:rtp_max_tries=200
D:rtp_min_distance=1000.0
B:safe_spawn=true
B:spawn_area_in_sp=false
B:show_playtime=true
I:spawn_radius=10
B:unload_erroring_chunks=true
logging {
B:block_broken=false
B:block_placed=false
B:chat_enable=false
B:enabled=false
B:entity_attacked=false
B:exclude_mob_entity=false
B:include_creative_players=false
B:include_fake_players=false
B:item_clicked_in_air=false
}
}

View file

@ -0,0 +1,42 @@
{ pkgs, config, ... }:
let
cfg = config.services.minecraft-servers.servers.gtnh;
in
{
networking.firewall.allowedTCPPorts = [ cfg.serverProperties.server-port ];
networking.firewall.allowedUDPPorts = [ cfg.serverProperties.server-port ];
services.minecraft-servers.servers.gtnh = rec {
enable = true;
enableReload = true;
package = pkgs.callPackage ./gtnh.nix { };
jvmOpts = "-Xms6G -Xmx6G -Dfml.readTimeout=180";
whitelist = import ../../whitelist.nix;
serverProperties = {
"level-type" = "rwg";
difficulty = 3;
"spawn-protection" = 1;
"server-port" = 25565;
"online-mode" = true;
"white-list" = true;
motd = "GTNH on tuserver";
"max-tick-time" = 60000;
"level-seed" = "6551456123132879154";
};
files = {
config = "${package}/lib/config";
serverutilities = "${package}/lib/serverutilities";
"serverutilities/serverutilities.cfg" = ./configs/serverutilities.cfg;
"config/JourneyMapServer/world.cfg" = ./configs/journeymap-world.cfg;
};
symlinks = {
"mods/bungeeforge-1.7.10.jar" = pkgs.fetchurl rec {
pname = "bungeeforge";
version = "1.0.6";
url = "https://github.com/caunt/BungeeForge/releases/download/v${version}/bungeeforge-1.7.10.jar";
hash = "sha256-Y10ExD0nn1pkjhrgsSq9eiww5+n0J5skoC2EetXCVGM=";
};
};
};
}

View file

@ -0,0 +1,56 @@
{ lib, stdenvNoCC, fetchzip, jre_headless, groovy, makeWrapper, writeShellScript, pkgs, ... }:
let
readMetaInf = /* groovy */ ''
import java.net.URL
import java.io.File
import java.util.jar.Attributes.Name
jarPath = args[0]
pathPrefix = args[1]
jar = new URL("jar:file:" + new File(jarPath).getAbsolutePath()+ "!/")
attributes = jar.openConnection().getManifest().getMainAttributes()
println(attributes.get(Name.MAIN_CLASS))
println(attributes.get(Name.CLASS_PATH).split(' ').collect{"$pathPrefix/$it"}.join(':'))
'';
in
stdenvNoCC.mkDerivation {
pname = "gt-new-horizons";
version = "2.8.4";
src = fetchzip {
url = "https://downloads.gtnewhorizons.com/ServerPacks/GT_New_Horizons_2.8.4_Server_Java_17-25.zip";
hash = "sha256-HH/Z3T6H3cDHFuPsxKSlJELGLL4Hc/5s2DZCxU+Txhs=";
stripRoot = false;
};
nativeBuildInputs = [ makeWrapper groovy ];
preStart = writeShellScript "gtnh-prestart" ''
out=$1
for name in "config" "serverutilities" "server.properties"; do
if ! [[ -e "$name" ]]; then
echo "$name missing. Copying it from $out/lib."
cp -rL "$out/lib/$name" .
chmod +w "$name" -R
fi
done
if ! [[ -e "eula.txt" ]]; then
echo "NOTICE: by running this software, you agree to https://account.mojang.com/documents/minecraft_eula"
echo "eula=true" > eula.txt
fi
'';
installPhase = ''
mkdir $out
ln -s $src $out/lib
mainJar="$out/lib/lwjgl3ify-forgePatches.jar"
{ read main_class; read class_path; } < <(groovy -e ${lib.escapeShellArg readMetaInf} $mainJar $out/lib)
class_path+="$(printf ':%s' $out/lib/mods/lwjgl3ify-*.jar)"
makeWrapper ${lib.getExe jre_headless} $out/bin/gt-new-horizons \
--run "$preStart $out" \
--run 'mods="$(find "$(realpath --relative-to="$PWD" '$out'/lib/mods)" -name "*.jar" | tr "\n" ",")"' \
--append-flags "@$out/lib/java9args.txt -cp $mainJar:$class_path $main_class nogui --mods \"\$mods\""
'';
}

View file

@ -0,0 +1,6 @@
{
# Minimal whitelist copied from example (trimmed)
"1Storce1" = "3d5bafe4-dc52-4b6e-9e0e-7cb989dfa9c9";
Misterio7x = "3fc76c64-b1b2-4a95-b3cf-0d7d94db2d75";
N0SenseG4ming = "b11ffa78-1708-4725-aa71-21e601b53533";
}