fix[Login]: Fix offline profile launching modded instances

Addresses https://github.com/PojavLauncherTeam/PojavLauncher/issues/6829
This commit is contained in:
alexytomi 2025-05-20 17:08:33 +08:00
parent f6284f4ab0
commit e4d070f9ef

View File

@ -27,6 +27,7 @@ import net.kdt.pojavlaunch.value.MinecraftLibraryArtifact;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.UnknownHostException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -76,8 +77,14 @@ public class MinecraftDownloader {
sExecutorService.execute(() -> { sExecutorService.execute(() -> {
try { try {
if(isLocalProfile){
throw new RuntimeException("Download failed. Please make sure you are logged in with a Microsoft Account.");
}
downloadGame(activity, version, realVersion); downloadGame(activity, version, realVersion);
listener.onDownloadDone(); listener.onDownloadDone();
}catch (UnknownHostException e){
Log.i("DownloadMirror", e.toString());
Tools.showErrorRemote("Can't download Minecraft, no internet connection found", e);
}catch (Exception e) { }catch (Exception e) {
listener.onDownloadFailed(e); listener.onDownloadFailed(e);
} }
@ -516,10 +523,6 @@ public class MinecraftDownloader {
} }
private void downloadFile() throws Exception { private void downloadFile() throws Exception {
if(isLocalProfile){
throw new RuntimeException("Download failed. Please make sure you are logged in with a Microsoft Account.");
}
try { try {
DownloadUtils.ensureSha1(mTargetPath, mTargetSha1, () -> { DownloadUtils.ensureSha1(mTargetPath, mTargetSha1, () -> {
DownloadMirror.downloadFileMirrored(mDownloadClass, mTargetUrl, mTargetPath, DownloadMirror.downloadFileMirrored(mDownloadClass, mTargetUrl, mTargetPath,