malilib icon indicating copy to clipboard operation
malilib copied to clipboard

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

Open globau opened this issue 3 years ago • 1 comments

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.

globau avatar Dec 11 '22 06:12 globau

Looks like 1.20 no longer accepts the -server option.

(edit)

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

globau avatar Jun 17 '23 06:06 globau