From c50caee9dc3ede7164f7da588d6f5a7edc2feb5a Mon Sep 17 00:00:00 2001 From: 0xC4DE <0xC4DE@piethon.party> Date: Sat, 8 Apr 2023 05:08:03 -0500 Subject: [PATCH] Pack Mode Switcher changes to address #241 (#292) Difficulty cannot be inforced by the difficulty locker mod. Meaning it's not only not required by the server, but the difficulty needs to be manually set by server.properties. I added a second server.properties.expert that just sets difficulty to 0 initially. Obviously a user can change this but they should just know that expert is supposed to be peaceful at that point. I then updated the script to switch between the two configs, if and only if they exist, so it should still work on ssp just the same. This was made to address #241 Since it is impossible for a mod to enforce server difficulty (Source: Trust me and dig through the code yourself I suggest starting with Forge's DedicatedServer object) /* Commits: */ * Pack Mode Switcher changes to address 241 in the most roundabout way possible * pack mode switcher updates and changing server.properties * added the properties files * made the readme's more friendly * more readme-bility * Made README more tutorial * typofix/capitialization is my passion * readme updates * forced * repalace * expert mode, again * script disclaimer * Script disclaimer * hopefully fixed jank formatting * fixed jank formatting * beautify --- README.md | 30 ++++++++----- overrides/README.md | 23 +++++++--- .../config-overrides/expert/server.properties | 32 +++++++++++++ .../config-overrides/normal/server.properties | 32 +++++++++++++ pack-mode-switcher.bat | 22 ++++++--- pack-mode-switcher.sh | 45 ++++++++++++++----- 6 files changed, 150 insertions(+), 34 deletions(-) create mode 100644 overrides/config-overrides/expert/server.properties create mode 100644 overrides/config-overrides/normal/server.properties diff --git a/README.md b/README.md index d2fb9f5..6dff75a 100644 --- a/README.md +++ b/README.md @@ -20,21 +20,29 @@ nomi-ceu comes with compatibility scripts for the following mods. You can drop t \* Note: If you are adding these mods via the CurseForge app, remove the copy of non-Extended Life AE2 it might automatically download. -## Hard mode info +## Expert Mode If you want a harder, or perhaps a more "true" GregTech experience, check out the Expert mode. This pack mode is based on the [Self-Torture Edition fork](https://github.com/NotMyWing/Omnifactory-Self-Torture-Edition) of the original pack. Highlights include: -- No DME for easy infinite resources -- Nomicoins can't be spent -- The Steam Age -- No Creative Tank; instead... -- Stabilized Micro Miners for late-game infinite resources +- Forced Peaceful Mode +- No DME for easy infinite resources +- Nomicoins can't be spent +- The Steam Age +- No Creative Tank; instead... + - Stabilized Micro Miners for late-game infinite resources - Harder recipes for assorted things like Iridium, Graphene, Numismatic Dynamos, and more -Installation instructions: -- Install the hardmode config files from [here](https://github.com/tracer4b/nomi-ceu/tree/main/overrides). Restart the pack for this to take effect. - - Windows users may grab the utility [here](https://raw.githubusercontent.com/tracer4b/nomi-ceu/main/pack-mode-switcher.bat)(right click - save as), save it to the root directory of the pack (the same level as `\config`). - - MacOS and GNU/Linux users can run `curl -O https://raw.githubusercontent.com/tracer4b/nomi-ceu/main/pack-mode-switcher.sh` then verify the contents with your editor of choice before running `chmod +x pack-mode-switcher.sh; sh pack-mode-switcher.sh` in the pack root directory (the one containing `/config`). -- If you are on an existing world, run `/bq_admin default load` to load the hard mode questbook. +Installation: +NOTE: Scripts may not fully work on versions <1.5.3, thus manual installation may be necessary. +- Windows: + - Download [here](https://raw.githubusercontent.com/tracer4b/nomi-ceu/main/pack-mode-switcher.bat)(right click - save as) save it to the root directory of the pack (the same level as `\config`). + - Run the pack mode switcher in a terminal with `./pack-mode-switcher.bat` + +- Any GNU/Linux (Mac and Linux): + - Run `curl -O https://raw.githubusercontent.com/tracer4b/nomi-ceu/main/pack-mode-switcher.sh` to download the file. + - Verify the contents with your editor of choice. + - Run `chmod +x pack-mode-switcher.sh; sh pack-mode-switcher.sh` in the pack root directory (the one containing `/config`). + +Manual installation instructions: [here](overrides/README.md) ## Bansoukou This pack uses two bansoukou patches. diff --git a/overrides/README.md b/overrides/README.md index 490eee3..a8eadd4 100644 --- a/overrides/README.md +++ b/overrides/README.md @@ -1,10 +1,19 @@ -# Hard mode config files -Config files for normal and hard modes are found in `\config-overrides\normal` and `\config-overrides\expert` respectively. +# Expert Mode config files +Config files for normal and expert mode are found in `\config-overrides\normal` and `\config-overrides\expert` respectively. -To install hard mode, drag the files inside `\config-overrides\expert` into the main `config` folder, as below: +Users can use any of the below methods to replace configs: +Manual (All versions): +- Drag the files inside `\config-overrides\expert` into the main `config` folder, as shown in below image + - If on a server move the `server.properties` out of the config directory and into the root directory of your server (the path containing your launch script) + - If on a client you can safely delete `server.properties` ![image](https://user-images.githubusercontent.com/61507029/168111281-65006a94-4b4d-4255-aca1-1f5039eec705.png) - -The same for reverting back to normal mode, plus manually deleting `\config\globalgamerules.cfg` to cancel forced peaceful. - -Windows users may also use `pack-mode-switcher.bat` found in the root directory. (It was here so it comes with the pack, but curseforge clearly doesn't want suspicious file in the release.') + +Scripted Installation (>1.5.3) +- Windows: + - Download [here](https://raw.githubusercontent.com/tracer4b/nomi-ceu/main/pack-mode-switcher.bat)(right click - save as) save it to the root directory of the pack (the same level as `\config`). + - Run the pack mode switcher in a terminal with `./pack-mode-switcher.bat` + - Any GNU/Linux (Mac and Linux) System: + - Run `curl -O https://raw.githubusercontent.com/tracer4b/nomi-ceu/main/pack-mode-switcher.sh` to download the file. + - Verify the contents with your editor of choice. + - Run `chmod +x pack-mode-switcher.sh; sh pack-mode-switcher.sh` in the pack root directory (the one containing `/config`). diff --git a/overrides/config-overrides/expert/server.properties b/overrides/config-overrides/expert/server.properties new file mode 100644 index 0000000..ebbaad5 --- /dev/null +++ b/overrides/config-overrides/expert/server.properties @@ -0,0 +1,32 @@ +#Minecraft server properties +op-permission-level=4 +level-name=world +allow-flight=true +prevent-proxy-connections=false +server-port=25565 +max-world-size=29999984 +level-seed= +force-gamemode=false +server-ip= +network-compression-threshold=256 +max-build-height=256 +spawn-npcs=true +white-list=false +spawn-animals=true +hardcore=false +snooper-enabled=true +resource-pack-sha1= +online-mode=true +resource-pack= +pvp=true +difficulty=0 +enable-command-block=false +gamemode=0 +player-idle-timeout=0 +max-players=20 +spawn-monsters=true +view-distance=10 +generate-structures=true +motd=nomi-ceu Server +level-type=lostcities +generator-settings= diff --git a/overrides/config-overrides/normal/server.properties b/overrides/config-overrides/normal/server.properties new file mode 100644 index 0000000..b1c5b57 --- /dev/null +++ b/overrides/config-overrides/normal/server.properties @@ -0,0 +1,32 @@ +#Minecraft server properties +op-permission-level=4 +level-name=world +allow-flight=true +prevent-proxy-connections=false +server-port=25565 +max-world-size=29999984 +level-seed= +force-gamemode=false +server-ip= +network-compression-threshold=256 +max-build-height=256 +spawn-npcs=true +white-list=false +spawn-animals=true +hardcore=false +snooper-enabled=true +resource-pack-sha1= +online-mode=true +resource-pack= +pvp=true +difficulty=1 +enable-command-block=false +gamemode=0 +player-idle-timeout=0 +max-players=20 +spawn-monsters=true +view-distance=10 +generate-structures=true +motd=nomi-ceu Server +level-type=lostcities +generator-settings= diff --git a/pack-mode-switcher.bat b/pack-mode-switcher.bat index 18e656a..d22d79a 100644 --- a/pack-mode-switcher.bat +++ b/pack-mode-switcher.bat @@ -1,7 +1,8 @@ @echo off + echo Nomifactory GTCEu Port / Pack mode switcher -setlocal +setlocal set normalCfgPath=%~dp0config-overrides\normal set expertCfgPath=%~dp0config-overrides\expert set targetPath=%~dp0config @@ -16,13 +17,22 @@ if "%errorlevel%" == "2" goto copyExpert :copyNormal robocopy "%normalCfgPath%" "%targetPath%" *.* /e /nfl /ndl -del "%targetPath%\globalgamerules.cfg" -goto end -:copyExpert -robocopy "%expertCfgPath%" "%targetPath%" *.* /e /nfl /ndl + +rem If server.properties exists, update server config +IF EXIST server.properties (move "%targetPath%\server.properties" .\) +echo normal > .mode goto end +:copyExpert +robocopy "%expertCfgPath%" "%targetPath%" *.* /e /nfl /ndl + +rem If server.properties exists, update server config +IF EXIST server.properties (move "%targetPath%\server.properties" .\) +echo expert > .mode + :end +rem if server.properties is left over in the config path, remove it +IF EXIST "%targetPath%/server.properties" DEL "%targetPath%\server.properties" echo Switch completed pause -exit \ No newline at end of file +exit diff --git a/pack-mode-switcher.sh b/pack-mode-switcher.sh index b1a6e32..6cffad2 100644 --- a/pack-mode-switcher.sh +++ b/pack-mode-switcher.sh @@ -1,30 +1,55 @@ #!/usr/bin/env sh +touch .mode set -e -echo -e "Nomifactory GTCEu Port / Pack mode switcher" +echo "Nomifactory GTCEu Port / Pack mode switcher" -NORMAL_CFG=./config-overrides/normal -EXPERT_CFG=./config-overrides/expert +NORMAL_CFG=config-overrides/normal +EXPERT_CFG=config-overrides/expert TARGET=./config +CURRENT_MODE="$(head .mode)" +CURRENT_MODE=${CURRENT_MODE:="normal"} + +echo "Current Mode: $CURRENT_MODE" if [ -z "$1" ]; then - echo -en "Set pack mode (Normal / Expert): " + echo -n "Set pack mode (Normal / Expert): " read MODE else MODE="$1" fi -case "$MODE" in - N|n|normal) - cp -rf "$NORMAL_CFG"/* "$TARGET" - rm -f "$TARGET/globalgamerules.cfg" +case $MODE in + N|n|normal) + + cp -rf "$NORMAL_CFG/." ${TARGET} + + # Only copy server.properties if it exists. + if [ -f "server.properties" ]; then + mv "${TARGET}/server.properties" ./ + else + rm "${TARGET}/server.properties" + fi + + # Update Mode + echo normal > .mode ;; E|e|expert) - cp -rf "$EXPERT_CFG"/* "$TARGET" + + cp -rf "$EXPERT_CFG/." ${TARGET} + + if [ -f "server.properties" ]; then + mv "${TARGET}/server.properties" ./ + else + rm "${TARGET}/server.properties" + fi + + # Update Mode + echo expert > .mode ;; *) - echo -e "Error: Invalid mode $MODE" + echo -e "Error: Invalid input $MODE" exit 1 ;; esac