MinecraftServerControl / mscs

Powerful command-line control for UNIX and Linux powered Minecraft servers
https://minecraftservercontrol.github.io
BSD 2-Clause "Simplified" License
479 stars 61 forks source link

Forge 1.17.1 no longer creates a .jar #302

Closed TulipanJones closed 2 years ago

TulipanJones commented 2 years ago

When running the 1.17.1 forge installer (I used forge-1.17.1-37.1.1-installer.jar), it no longer creates a forge-*-universal.jar (https://forums.minecraftforge.net/topic/102544-forge-370-minecraft-1171/) (It's explained under the Installers and the Server subheading). Instead, it creates the following:

The run.sh file contains this:

#!/usr/bin/env sh
# Forge requires a configured set of both JVM and program arguments.
# Add custom JVM arguments to the user_jvm_args.txt
# Add custom program arguments {such as nogui} to this file in the next line before the "$@" or
#  pass them to this script directly
java @user_jvm_args.txt @libraries/net/minecraftforge/forge/1.17.1-37.1.1/unix_args.txt "$@"

The user_jvm_args.txt contains this:

# Xmx and Xms set the maximum and minimum RAM usage, respectively.
# They can take any number, followed by an M or a G.
# M means Megabyte, G means Gigabyte.
# For example, to set the maximum to 3GB: -Xmx3G
# To set the minimum to 2.5GB: -Xms2500M

# A good default for a modded server is 4GB.
# Uncomment the next line to set it.
# -Xmx4G

The directory that the run.sh leads to (/opt/mscs/server/forge_server_folder/libraries/net/minecraftforge/forge/1.7.1-37.1.1/) contains the following:

The unix_args.txt says

-p libraries/cpw/mods/bootstraplauncher/0.1.17/bootstraplauncher-0.1.17.jar:libraries/cpw/mods/securejarhandler/0.9.54/securejarhandler-0.9.54.jar:libraries/org/ow2/asm/asm-commons/9.1/asm-commons-9.1.jar:libraries/org/ow2/asm/asm-util/9.1/asm-util-9.1.jar:libraries/org/ow2/asm/asm-analysis/9.1/asm-analysis-9.1.jar:libraries/org/ow2/asm/asm-tree/9.1/asm-tree-9.1.jar:libraries/org/ow2/asm/asm/9.1/asm-9.1.jar
--add-modules ALL-MODULE-PATH
--add-opens java.base/java.util.jar=cpw.mods.securejarhandler
--add-exports java.base/sun.security.util=cpw.mods.securejarhandler
-DignoreList=bootstraplauncher-0.1.17.jar,securejarhandler-0.9.54.jar,asm-commons-9.1.jar,asm-util-9.1.jar,asm-analysis-9.1.jar,asm-tree-9.1.jar,asm-9.1.jar
-DlibraryDirectory=libraries
-DlegacyClassPath=libraries/cpw/mods/securejarhandler/0.9.54/securejarhandler-0.9.54.jar:libraries/org/ow2/asm/asm/9.1/asm-9.1.jar:libraries/org/ow2/asm/asm-commons/9.1/asm-commons-9.1.jar:libraries/org/ow2/asm/asm-tree/9.1/asm-tree-9.1.jar:libraries/org/ow2/asm/asm-util/9.1/asm-util-9.1.jar:libraries/org/ow2/asm/asm-analysis/9.1/asm-analysis-9.1.jar:libraries/net/minecraftforge/accesstransformers/8.0.4/accesstransformers-8.0.4.jar:libraries/org/antlr/antlr4-runtime/4.9.1/antlr4-runtime-4.9.1.jar:libraries/net/minecraftforge/eventbus/5.0.3/eventbus-5.0.3.jar:libraries/net/minecraftforge/forgespi/4.0.10/forgespi-4.0.10.jar:libraries/net/minecraftforge/coremods/5.0.1/coremods-5.0.1.jar:libraries/cpw/mods/modlauncher/9.0.7/modlauncher-9.0.7.jar:libraries/net/minecraftforge/unsafe/0.2.0/unsafe-0.2.0.jar:libraries/com/electronwill/night-config/core/3.6.3/core-3.6.3.jar:libraries/com/electronwill/night-config/toml/3.6.3/toml-3.6.3.jar:libraries/org/apache/maven/maven-artifact/3.6.3/maven-artifact-3.6.3.jar:libraries/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1.jar:libraries/net/jodah/typetools/0.8.3/typetools-0.8.3.jar:libraries/org/apache/logging/log4j/log4j-api/2.15.0/log4j-api-2.15.0.jar:libraries/org/apache/logging/log4j/log4j-core/2.15.0/log4j-core-2.15.0.jar:libraries/org/apache/logging/log4j/log4j-slf4j18-impl/2.15.0/log4j-slf4j18-impl-2.15.0.jar:libraries/net/minecrell/terminalconsoleappender/1.2.0/terminalconsoleappender-1.2.0.jar:libraries/org/jline/jline-reader/3.12.1/jline-reader-3.12.1.jar:libraries/org/jline/jline-terminal/3.12.1/jline-terminal-3.12.1.jar:libraries/net/sf/jopt-simple/jopt-simple/5.0.4/jopt-simple-5.0.4.jar:libraries/org/spongepowered/mixin/0.8.4/mixin-0.8.4.jar:libraries/org/openjdk/nashorn/nashorn-core/15.3/nashorn-core-15.3.jar:libraries/com/google/guava/guava/21.0/guava-21.0.jar:libraries/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar:libraries/net/minecraftforge/fmlloader/1.17.1-37.1.1/fmlloader-1.17.1-37.1.1.jar:libraries/net/minecraft/server/1.17.1-20210706.113038/server-1.17.1-20210706.113038-extra.jar
cpw.mods.bootstraplauncher.BootstrapLauncher
--launchTarget forgeserver
--fml.forgeVersion 37.1.1
--fml.mcVersion 1.17.1
--fml.forgeGroup net.minecraftforge
--fml.mcpVersion 20210706.113038

I'm in over my head. I can't point the mscs.properties file to a forge-*-universal.jar like before. I've tried mscs-server-jar=forge_server_folder/run.sh, which didn't work for me, but should it have? Should I instead try mscs-server-jar=forge_server_folder/libraries/net/minecraftforge/forge/1.17.1-37.1.1/forge-1.17.1.1-server.jar? Or should I be pointing it to the forge-*-universal.jar in the same directory? Any help is much appreciated :)

sandain commented 2 years ago

Hi @Manuel-A-Aviles. I'm fairly certain that you could use a combination of mscs-jvm-args, mscs-server-jar, mscs-initial-memory, and mscs-maximum-memory to re-implement the provided run.sh script. However, it might just be easier to set the mscs-server-command instead.

Something like:

mscs-server-command=run.sh

Assuming the run.sh is in the same location as mscs-server-location, which defaults to /opt/mscs/server.

I hope this helps.

TulipanJones commented 2 years ago

Hello! That was a great suggestion, however when I tried it out, the server wouldn't start.

The console.out said:

Error: could not open `user_jvm_args.txt'

So I edited the run.sh file. I replaced "@user_jvm_args.txt" and "@libraries/net/minecraftforge/forge/1.17.1-37.0.112/unix_args.txt" with their respective full paths. My run.sh now said:

#!/usr/bin/env sh
# Forge requires a configured set of both JVM and program arguments.
# Add custom JVM arguments to the user_jvm_args.txt
# Add custom program arguments {such as nogui} to this file in the next line before the "$@" or
#  pass them to this script directly
java  @/opt/mscs/server/forge_server_folder/user_jvm_args.txt @/opt/mscs/server/forge_server_folder/libraries/net/minecraftforge/forge/1.17.1-37.0.112/unix_args.txt "$@"

The server wouldn't start, and the console.out this time said:

WARNING: Unknown module: cpw.mods.securejarhandler specified to --add-exports
WARNING: Unknown module: cpw.mods.securejarhandler specified to --add-opens
Error: Could not find or load main class cpw.mods.bootstraplauncher.BootstrapLauncher
Caused by: java.lang.ClassNotFoundException: cpw.mods.bootstraplauncher.BootstrapLauncher
sandain commented 2 years ago

I think you need to set mscs-server-location:

mscs-server-location=/opt/mscs/server/forge_server_folder
sandain commented 2 years ago

Or, edit the unix-args.txt file to include the full path as well:

-p /opt/mscs/server/forge_server_folder/libraries/cpw/mods/bootstraplauncher/0.1.17/bootstraplauncher-0.1.17.jar:/opt/mscs/server/forge_server_folder/libraries/cpw/mods/securejarhandler/0.9.54/securejarhandler-0.9.54.jar:/opt/mscs/server/forge_server_folder/libraries/org/ow2/asm/asm-commons/9.1/asm-commons-9.1.jar:/opt/mscs/server/forge_server_folder/libraries/org/ow2/asm/asm-util/9.1/asm-util-9.1.jar:/opt/mscs/server/forge_server_folder/libraries/org/ow2/asm/asm-analysis/9.1/asm-analysis-9.1.jar:/opt/mscs/server/forge_server_folder/libraries/org/ow2/asm/asm-tree/9.1/asm-tree-9.1.jar:/opt/mscs/server/forge_server_folder/libraries/org/ow2/asm/asm/9.1/asm-9.1.jar
--add-modules ALL-MODULE-PATH
--add-opens java.base/java.util.jar=cpw.mods.securejarhandler
--add-exports java.base/sun.security.util=cpw.mods.securejarhandler
-DignoreList=bootstraplauncher-0.1.17.jar,securejarhandler-0.9.54.jar,asm-commons-9.1.jar,asm-util-9.1.jar,asm-analysis-9.1.jar,asm-tree-9.1.jar,asm-9.1.jar
-DlibraryDirectory=/opt/mscs/server/forge_server_folder/libraries
-DlegacyClassPath=/opt/mscs/server/forge_server_folder/libraries/cpw/mods/securejarhandler/0.9.54/securejarhandler-0.9.54.jar:/opt/mscs/server/forge_server_folder/libraries/org/ow2/asm/asm/9.1/asm-9.1.jar:/opt/mscs/server/forge_server_folder/libraries/org/ow2/asm/asm-commons/9.1/asm-commons-9.1.jar:/opt/mscs/server/forge_server_folder/libraries/org/ow2/asm/asm-tree/9.1/asm-tree-9.1.jar:/opt/mscs/server/forge_server_folder/libraries/org/ow2/asm/asm-util/9.1/asm-util-9.1.jar:/opt/mscs/server/forge_server_folder/libraries/org/ow2/asm/asm-analysis/9.1/asm-analysis-9.1.jar:/opt/mscs/server/forge_server_folder/libraries/net/minecraftforge/accesstransformers/8.0.4/accesstransformers-8.0.4.jar:/opt/mscs/server/forge_server_folder/libraries/org/antlr/antlr4-runtime/4.9.1/antlr4-runtime-4.9.1.jar:/opt/mscs/server/forge_server_folder/libraries/net/minecraftforge/eventbus/5.0.3/eventbus-5.0.3.jar:/opt/mscs/server/forge_server_folder/libraries/net/minecraftforge/forgespi/4.0.10/forgespi-4.0.10.jar:/opt/mscs/server/forge_server_folder/libraries/net/minecraftforge/coremods/5.0.1/coremods-5.0.1.jar:/opt/mscs/server/forge_server_folder/libraries/cpw/mods/modlauncher/9.0.7/modlauncher-9.0.7.jar:/opt/mscs/server/forge_server_folder/libraries/net/minecraftforge/unsafe/0.2.0/unsafe-0.2.0.jar:/opt/mscs/server/forge_server_folder/libraries/com/electronwill/night-config/core/3.6.3/core-3.6.3.jar:/opt/mscs/server/forge_server_folder/libraries/com/electronwill/night-config/toml/3.6.3/toml-3.6.3.jar:/opt/mscs/server/forge_server_folder/libraries/org/apache/maven/maven-artifact/3.6.3/maven-artifact-3.6.3.jar:/opt/mscs/server/forge_server_folder/libraries/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1.jar:/opt/mscs/server/forge_server_folder/libraries/net/jodah/typetools/0.8.3/typetools-0.8.3.jar:/opt/mscs/server/forge_server_folder/libraries/org/apache/logging/log4j/log4j-api/2.15.0/log4j-api-2.15.0.jar:/opt/mscs/server/forge_server_folder/libraries/org/apache/logging/log4j/log4j-core/2.15.0/log4j-core-2.15.0.jar:/opt/mscs/server/forge_server_folder/libraries/org/apache/logging/log4j/log4j-slf4j18-impl/2.15.0/log4j-slf4j18-impl-2.15.0.jar:/opt/mscs/server/forge_server_folder/libraries/net/minecrell/terminalconsoleappender/1.2.0/terminalconsoleappender-1.2.0.jar:/opt/mscs/server/forge_server_folder/libraries/org/jline/jline-reader/3.12.1/jline-reader-3.12.1.jar:/opt/mscs/server/forge_server_folder/libraries/org/jline/jline-terminal/3.12.1/jline-terminal-3.12.1.jar:/opt/mscs/server/forge_server_folder/libraries/net/sf/jopt-simple/jopt-simple/5.0.4/jopt-simple-5.0.4.jar:/opt/mscs/server/forge_server_folder/libraries/org/spongepowered/mixin/0.8.4/mixin-0.8.4.jar:/opt/mscs/server/forge_server_folder/libraries/org/openjdk/nashorn/nashorn-core/15.3/nashorn-core-15.3.jar:/opt/mscs/server/forge_server_folder/libraries/com/google/guava/guava/21.0/guava-21.0.jar:/opt/mscs/server/forge_server_folder/libraries/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar:/opt/mscs/server/forge_server_folder/libraries/net/minecraftforge/fmlloader/1.17.1-37.1.1/fmlloader-1.17.1-37.1.1.jar:/opt/mscs/server/forge_server_folder/libraries/net/minecraft/server/1.17.1-20210706.113038/server-1.17.1-20210706.113038-extra.jar
cpw.mods.bootstraplauncher.BootstrapLauncher
--launchTarget forgeserver
--fml.forgeVersion 37.1.1
--fml.mcVersion 1.17.1
--fml.forgeGroup net.minecraftforge
--fml.mcpVersion 20210706.113038
TulipanJones commented 2 years ago

Editing the unix-args.txt file worked!

My mscs-server-location is set to /opt/mscs/server. This is because I have a few different servers that my friends and I use, and it's more convenient to create folders in the /opt/mscs/server (like a fabric-1.16.5, forge-1.12.2, forge_1.17.1) and edit the mscs-server-jar= to include the folder. For example, mscs-server-jar= /fabric_server/fabric.jar. I've been using the directory name 'forge_server_folder' to generalize.

I hadn't thought about editing the unix-args.txt file. I copied yours onto mine and I got an error that made me realize we were using different versions of forge (I'm using the version that came with a modpack). After including the full path names in the unix-args.txt that mine came with, it launched perfectly.

I can't thank you enough for all your help :D I was banging my head against the wall most of the day yesterday trying to understand what was going wrong before asking for help today. I really appreciate, and best wishes to you and your loved ones!

TulipanJones commented 2 years ago

For posterity's sake, here's what you need to edit assuming that you installed the forge-*-installer.jar in /opt/mscs/server. In the mscs.properties, don't include mscs-server-jar=. Instead do:

mscs-server-command=run.sh

In the /opt/mscs/server folder, edit run.sh. Replace "@user_jvm_args.txt" and "@libraries/net/minecraftforge/forge/1.17.1-37.0.112/unix_args.txt" with their respective full paths. For example:

java  @/opt/mscs/server/user_jvm_args.txt @/opt/mscs/server/libraries/net/minecraftforge/forge/1.17.1-37.0.112/unix_args.txt "$@"

Next, go find the unix-args.txt file mentioned in run.sh. For me, it was in /opt/mscs/server/ibraries/net/minecraftforge/forge/1.17.1-37.0.112/unix-args.txt. Replace everywhere that says "libraries/" to the full path name. So instead of "-p libraries/cpw/mods [...]" it should be "-p /opt/mscs/server/libraries/cpw/mods [...]

Mine was forge-1.17.1-37.0.112-installer.jar. @sandain did it for, what I am assuming, is forge-1.17.1-37.1.1-installer.jar. I don't recommend you copy-paste the unix-args.txt unless you're using the same version of forge that @sandain did. It's here as an example of what unix-args.txt should look like:

-p /opt/mscs/server/libraries/cpw/mods/bootstraplauncher/0.1.17/bootstraplauncher-0.1.17.jar:/opt/mscs/server/libraries/cpw/mods/securejarhandler/0.9.54/securejarhandler-0.9.54.jar:/opt/mscs/server/libraries/org/ow2/asm/asm-commons/9.1/asm-commons-9.1.jar:/opt/mscs/server/libraries/org/ow2/asm/asm-util/9.1/asm-util-9.1.jar:/opt/mscs/server/libraries/org/ow2/asm/asm-analysis/9.1/asm-analysis-9.1.jar:/opt/mscs/server/libraries/org/ow2/asm/asm-tree/9.1/asm-tree-9.1.jar:/opt/mscs/server/libraries/org/ow2/asm/asm/9.1/asm-9.1.jar
--add-modules ALL-MODULE-PATH/opt/mscs/server/libraries
--add-opens java.base/java.util.jar=cpw.mods.securejarhandler
--add-exports java.base/sun.security.util=cpw.mods.securejarhandler
-DignoreList=bootstraplauncher-0.1.17.jar,securejarhandler-0.9.54.jar,asm-commons-9.1.jar,asm-util-9.1.jar,asm-analysis-9.1.jar,asm-tree-9.1.jar,asm-9.1.jar
-DlibraryDirectory=/opt/mscs/server/libraries
-DlegacyClassPath=/opt/mscs/server/libraries/cpw/mods/securejarhandler/0.9.54/securejarhandler-0.9.54.jar:/opt/mscs/server/libraries/org/ow2/asm/asm/9.1/asm-9.1.jar:/opt/mscs/server/libraries/org/ow2/asm/asm-commons/9.1/asm-commons-9.1.jar:/opt/mscs/server/libraries/org/ow2/asm/asm-tree/9.1/asm-tree-9.1.jar:/opt/mscs/server/libraries/org/ow2/asm/asm-util/9.1/asm-util-9.1.jar:/opt/mscs/server/libraries/org/ow2/asm/asm-analysis/9.1/asm-analysis-9.1.jar:/opt/mscs/server/libraries/net/minecraftforge/accesstransformers/8.0.4/accesstransformers-8.0.4.jar:/opt/mscs/server/libraries/org/antlr/antlr4-runtime/4.9.1/antlr4-runtime-4.9.1.jar:/opt/mscs/server/libraries/net/minecraftforge/eventbus/5.0.3/eventbus-5.0.3.jar:/opt/mscs/server/libraries/net/minecraftforge/forgespi/4.0.10/forgespi-4.0.10.jar:/opt/mscs/server/libraries/net/minecraftforge/coremods/5.0.1/coremods-5.0.1.jar:/opt/mscs/server/libraries/cpw/mods/modlauncher/9.0.7/modlauncher-9.0.7.jar:/opt/mscs/server/libraries/net/minecraftforge/unsafe/0.2.0/unsafe-0.2.0.jar:/opt/mscs/server/libraries/com/electronwill/night-config/core/3.6.3/core-3.6.3.jar:/opt/mscs/server/libraries/com/electronwill/night-config/toml/3.6.3/toml-3.6.3.jar:/opt/mscs/server/libraries/org/apache/maven/maven-artifact/3.6.3/maven-artifact-3.6.3.jar:/opt/mscs/server/libraries/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1.jar:/opt/mscs/server/libraries/net/jodah/typetools/0.8.3/typetools-0.8.3.jar:/opt/mscs/server/libraries/org/apache/logging/log4j/log4j-api/2.15.0/log4j-api-2.15.0.jar:/opt/mscs/server/libraries/org/apache/logging/log4j/log4j-core/2.15.0/log4j-core-2.15.0.jar:/opt/mscs/server/libraries/org/apache/logging/log4j/log4j-slf4j18-impl/2.15.0/log4j-slf4j18-impl-2.15.0.jar:/opt/mscs/server/libraries/net/minecrell/terminalconsoleappender/1.2.0/terminalconsoleappender-1.2.0.jar:/opt/mscs/server/libraries/org/jline/jline-reader/3.12.1/jline-reader-3.12.1.jar:/opt/mscs/server/libraries/org/jline/jline-terminal/3.12.1/jline-terminal-3.12.1.jar:/opt/mscs/server/libraries/net/sf/jopt-simple/jopt-simple/5.0.4/jopt-simple-5.0.4.jar:/opt/mscs/server/libraries/org/spongepowered/mixin/0.8.4/mixin-0.8.4.jar:/opt/mscs/server/libraries/org/openjdk/nashorn/nashorn-core/15.3/nashorn-core-15.3.jar:/opt/mscs/server/libraries/com/google/guava/guava/21.0/guava-21.0.jar:/opt/mscs/server/libraries/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar:/opt/mscs/server/libraries/net/minecraftforge/fmlloader/1.17.1-37.1.1/fmlloader-1.17.1-37.1.1.jar:/opt/mscs/server/libraries/net/minecraft/server/1.17.1-20210706.113038/server-1.17.1-20210706.113038-extra.jar
cpw.mods.bootstraplauncher.BootstrapLauncher
--launchTarget forgeserver
--fml.forgeVersion 37.1.1
--fml.mcVersion 1.17.1
--fml.forgeGroup net.minecraftforge
--fml.mcpVersion 20210706.113038
zanix commented 2 years ago

Thanks for the final write-up, now someone can update the documentation https://minecraftservercontrol.github.io https://github.com/MinecraftServerControl/MinecraftServerControl.github.io

sandain commented 2 years ago

My mscs-server-location is set to /opt/mscs/server. This is because I have a few different servers that my friends and I use, and it's more convenient to create folders in the /opt/mscs/server (like a fabric-1.16.5, forge-1.12.2, forge_1.17.1) and edit the mscs-server-jar= to include the folder. For example, mscs-server-jar= /fabric_server/fabric.jar. I've been using the directory name 'forge_server_folder' to generalize.

I just wanted to point out that you can adjust world settings globally, and you can adjust settings for each individual world as well.

With that said, I'm glad that you were able to get it working. If you have the time, could you please update the documentation for Forge installs here: https://github.com/MinecraftServerControl/MinecraftServerControl.github.io/blob/main/docs/mscs/adjusting-world-server-properties/forge.md

TulipanJones commented 2 years ago

Yeah that sounds alright. There's just one detail that I'd like to get clear before editing the documentation. The user_jvm_args.txt file that the forge-1.17-installer.jar creates is where the java arguments go, such as allocating RAM and such. When the server is started with the "mscs start" command, then checked with the "mscs status" command, the allocated RAM says 0. I'm not sure if there is a way for "mscs status" to display the correct RAM because mscs isn't reading the user_jvm_args.txt file.

sandain commented 2 years ago

RAM saying 0 is a legitimate bug, open a new issue for that. It is reporting actual usage, not what is set for the min/max values in the Java args. The reason this happens is the script expects the server to be running Java (the method is even called getJavaMemory, which calls getJavaPID). This would have to be made more generic to support situations like this (or when the server is not actually using Java).