Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
globau opened this issue Dec 11, 2022 · 1 comment

Comments

@globau
Copy link

globau commented Dec 11, 2022

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.

maruohon added a commit that referenced this issue May 3, 2023
I'll probably do the suggested injection for the new code base to fix
this "fully".
@globau
Copy link
Author

globau commented Jun 17, 2023

Looks like 1.20 no longer accepts the -server option.

(edit)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant