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.
If Minecraft is started with the
-server
option to automatically connect to a multiplayer server on launch, sadlyMinecraftClient
'sgetCurrentServerData/getCurrentServerEntry
method returnsnull
, which is then the result ofStringUtils.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 toargs.autoConnect.serverAddress
ifMinecraftClient.getCurrentServerEntry()
returns null.