MaLiLib (Forge)

MaLiLib (Forge)

291k Downloads

`StringUtils.getWorldOrServerName` returns `null` if Minecraft is started with `--server` option (autoconnect)

globau opened this issue ยท 1 comments

commented

If Minecraft is started with the -server option to automatically connect to a multiplayer server on launch, sadly MinecraftClient's getCurrentServerData/getCurrentServerEntry method returns null, which is then the result of StringUtils.getWorldOrServerName.

This results in some weirdness in Litematica - eg. placements are never saved.

One workaround is to inject MinecraftClient's constructor to grab the command line args, falling back to args.autoConnect.serverAddress if MinecraftClient.getCurrentServerEntry() returns null.

commented

Looks like 1.20 no longer accepts the -server option.

(edit)

23w14a replaced -server with --quickPlaySingleplayer, --quickPlayMultiplayer, and --quickPlayRealms