QuiltMC / quilt-loader

The loader for Quilt mods.
Apache License 2.0
472 stars 87 forks source link

allow to specify path of server.jar via command line argument #441

Closed Zh40Le1ZOOB closed 4 months ago

Zh40Le1ZOOB commented 4 months ago

Just like the title says.

AlexIIL commented 4 months ago

You should be able to already - try adding -Dloader.gameJarPath=custom_file.jar?

Zh40Le1ZOOB commented 4 months ago

-Dloader.gameJarPath=

Not work for server :(

AlexIIL commented 4 months ago

Can you show:

  1. The folder you are launching the game from
  2. The command line you are currently using?
Zh40Le1ZOOB commented 4 months ago

Can you show:

  1. The folder you are launching the game from
  2. The command line you are currently using?

I'm running NixOS so there are something different with normal Linux distros.

1. /var/lib/minecraft ❯ ls libraries quilt-server-launch.jar

server.jar is a Nix derivation so it cannot be found manually.

2. java -jar quilt-server-launch.jar nogui -Dloader.gameJarPath=${pkgs.minecraft-server}/server.jar < this will be replace with the real path by Nix.

output:

The Minecraft server .JAR is missing (/var/lib/minecraft/server.jar)!

Quilt's server-side launcher expects the server .JAR to be provided.
You can edit its location in quilt-server-launcher.properties.

Without the official Minecraft server .JAR, Quilt Loader cannot launch.
Exception in thread "main" java.lang.RuntimeException: Failed to setup Quilt server environment!
    at org.quiltmc.loader.impl.launch.server.QuiltServerLauncher.main(QuiltServerLauncher.java:60)
Caused by: java.lang.RuntimeException: Missing game jar at /var/lib/minecraft/server.jar
    at org.quiltmc.loader.impl.launch.server.QuiltServerLauncher.setup(QuiltServerLauncher.java:86)
    at org.quiltmc.loader.impl.launch.server.QuiltServerLauncher.main(QuiltServerLauncher.java:58)
AlexIIL commented 4 months ago

For some reason quilt loader is unable to find the file - does NixOS have a permissions system or something else that would prevent loader from being able to read the file?

Zh40Le1ZOOB commented 4 months ago

For some reason quilt loader is unable to find the file - does NixOS have a permissions system or something else that would prevent loader from being able to read the file?

It's not permisson problem. I wrote a systemd service for minecraft server, the work directory is /var/lib/minecraft, so Quilt would find server.jar in /var/lib/minecraft. But I want to manage the service using Nix completely, so I can't put server.jar to /var/lib/minecraft, server.jar is actully not in a same directory with Quilt Loader. Insteadly, server.jar is located in Nix Store, so the only thing I need to do is specify path of server.jar via CLI args.

Is there any way to tell Quilt where to find server.jar or pass options in quilt-server-launcher.properties via CLI? Sorry to make misunderstanding.

AlexIIL commented 4 months ago

Oh, sorry, I should have noticed sooner - java system properties need to be earlier in the command line than the -jar - so if you change the command to java -Dloader.gameJarPath=${pkgs.minecraft-server}/server.jar -jar quilt-server-launch.jar nogui it should work.

Zh40Le1ZOOB commented 4 months ago

Oh, sorry, I should have noticed sooner - java system properties need to be earlier in the command line than the -jar - so if you change the command to java -Dloader.gameJarPath=${pkgs.minecraft-server}/server.jar -jar quilt-server-launch.jar nogui it should work.

It works! Thank you very much!