From 58d8f158f54f691f01642edeb302246b1a2db50f Mon Sep 17 00:00:00 2001 From: --set <--set> Date: Sat, 13 Apr 2024 22:11:42 +0200 Subject: [PATCH] Updated Minecraft version to 1.20.4 and added shell scripts --- thinkcentre/minecraft/docker-compose.yml | 9 +++-- thinkcentre/minecraft/unsupported.sh | 5 +++ thinkcentre/minecraft/upgrade-mods.sh | 46 ++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 thinkcentre/minecraft/unsupported.sh create mode 100755 thinkcentre/minecraft/upgrade-mods.sh diff --git a/thinkcentre/minecraft/docker-compose.yml b/thinkcentre/minecraft/docker-compose.yml index 93ab9b9..f4bf60c 100644 --- a/thinkcentre/minecraft/docker-compose.yml +++ b/thinkcentre/minecraft/docker-compose.yml @@ -1,18 +1,17 @@ -version: '3.3' - services: minecraft-server: volumes: - - ./server:/data - - ./mods:/data/mods + - /mnt/data/minecraft/server:/data + - /mnt/data/minecraft/mods/server:/data/mods environment: - TYPE=FABRIC - MEMORY=4G - - VERSION=1.20.4 + - VERSION=1.20.1 - EULA=TRUE - MOTD=Hej och välkommen! ports: - '25565:25565' + - '8123:8123' # dynmap container_name: minecraft image: itzg/minecraft-server diff --git a/thinkcentre/minecraft/unsupported.sh b/thinkcentre/minecraft/unsupported.sh new file mode 100644 index 0000000..8270fe0 --- /dev/null +++ b/thinkcentre/minecraft/unsupported.sh @@ -0,0 +1,5 @@ +unsupported_mods=( + "distant" + "mod-loading" + "sound-physics-remastered" +) diff --git a/thinkcentre/minecraft/upgrade-mods.sh b/thinkcentre/minecraft/upgrade-mods.sh new file mode 100755 index 0000000..df403be --- /dev/null +++ b/thinkcentre/minecraft/upgrade-mods.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +#echo "Stopping container..." +docker-compose down + +if [ $? -ne 0 ]; then + exit $? +fi + +echo "Container stopped" +echo "Performing upgrade..." +sleep 2 + +# Function to upgrade ferium and copy mods +upgrade_mods() { + rm mods/*.jar && + ferium upgrade && + rm mods/server/*.jar && + rm mods/client/*.jar && + cp mods/*.jar mods/server/ && + cp mods/*.jar mods/client/ && + chown -R thord:docker mods/* + chmod -R 755 mods/* +} + +remove_unsupported_mod() { + local mod_name="$1" + + find ./mods/server/ -maxdepth 1 -iname "${mod_name}*.jar" -exec rm {} \; && \ + echo "Removed non-server mod: $mod_name" +} + +# Call the functions +upgrade_mods + +# List of unsupported mods to remove +source unsupported.sh + +# Loop through unsupported mods and remove them +for mod in "${unsupported_mods[@]}"; do + remove_unsupported_mod "$mod" +done + +echo "Starting container" + +docker-compose up -d