mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-04-12 18:30:26 +08:00
Fixed #1
This commit is contained in:
parent
0d03e965d2
commit
67a61493dd
@ -23,6 +23,7 @@ import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import org.jackhuang.hellominecraft.launcher.core.GameException;
|
||||
import org.jackhuang.hellominecraft.util.C;
|
||||
import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftAssetService;
|
||||
import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftService;
|
||||
@ -49,8 +50,8 @@ public class MinecraftAssetService extends IMinecraftAssetService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Task downloadAssets(final String mcVersion) {
|
||||
return downloadAssets(service.version().getVersionById(mcVersion));
|
||||
public Task downloadAssets(final String mcVersion) throws GameException {
|
||||
return downloadAssets(service.version().getVersionById(mcVersion).resolve(service.version()));
|
||||
}
|
||||
|
||||
public Task downloadAssets(final MinecraftVersion mv) {
|
||||
@ -60,8 +61,8 @@ public class MinecraftAssetService extends IMinecraftAssetService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean refreshAssetsIndex(String id) {
|
||||
MinecraftVersion mv = service.version().getVersionById(id);
|
||||
public boolean refreshAssetsIndex(String id) throws GameException {
|
||||
MinecraftVersion mv = service.version().getVersionById(id).resolve(service.version());
|
||||
if (mv == null)
|
||||
return false;
|
||||
return downloadMinecraftAssetsIndexAsync(mv.getAssetsIndex());
|
||||
|
@ -19,6 +19,7 @@ package org.jackhuang.hellominecraft.launcher.core.service;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import org.jackhuang.hellominecraft.launcher.core.GameException;
|
||||
import org.jackhuang.hellominecraft.launcher.core.version.AssetIndexDownloadInfo;
|
||||
import org.jackhuang.hellominecraft.util.tasks.Task;
|
||||
|
||||
@ -32,7 +33,7 @@ public abstract class IMinecraftAssetService extends IMinecraftBasicService {
|
||||
super(service);
|
||||
}
|
||||
|
||||
public abstract Task downloadAssets(String mcVersion);
|
||||
public abstract Task downloadAssets(String mcVersion) throws GameException;
|
||||
|
||||
public abstract File getAssets();
|
||||
|
||||
@ -43,7 +44,7 @@ public abstract class IMinecraftAssetService extends IMinecraftBasicService {
|
||||
*
|
||||
* @return Is the action successful?
|
||||
*/
|
||||
public abstract boolean refreshAssetsIndex(String a);
|
||||
public abstract boolean refreshAssetsIndex(String a) throws GameException;
|
||||
|
||||
public abstract boolean downloadMinecraftAssetsIndexAsync(AssetIndexDownloadInfo assetsId);
|
||||
|
||||
|
@ -41,6 +41,7 @@ import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.event.TableModelEvent;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import org.jackhuang.hellominecraft.launcher.core.GameException;
|
||||
import org.jackhuang.hellominecraft.util.C;
|
||||
import org.jackhuang.hellominecraft.util.logging.HMCLog;
|
||||
import org.jackhuang.hellominecraft.launcher.util.LauncherVisibility;
|
||||
@ -184,7 +185,12 @@ public final class GameSettingsPanel extends RepaintPage implements DropTargetLi
|
||||
itm = new JMenuItem(C.i18n("versions.manage.redownload_assets_index"));
|
||||
itm.addActionListener((e) -> {
|
||||
if (mcVersion != null)
|
||||
Settings.getLastProfile().service().asset().refreshAssetsIndex(mcVersion);
|
||||
try {
|
||||
Settings.getLastProfile().service().asset().refreshAssetsIndex(mcVersion);
|
||||
} catch (GameException ex) {
|
||||
HMCLog.err("Failed to download assets", ex);
|
||||
MessageBox.showLocalized("assets.failed_download");
|
||||
}
|
||||
});
|
||||
ppmManage.add(itm);
|
||||
itm = new JMenuItem(C.i18n("versions.mamage.remove_libraries"));
|
||||
@ -1151,7 +1157,12 @@ public final class GameSettingsPanel extends RepaintPage implements DropTargetLi
|
||||
|
||||
private void btnDownloadAllAssetsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDownloadAllAssetsActionPerformed
|
||||
if (mcVersion != null)
|
||||
TaskWindow.factory().execute(Settings.getLastProfile().service().asset().downloadAssets(mcVersion));
|
||||
try {
|
||||
TaskWindow.factory().execute(Settings.getLastProfile().service().asset().downloadAssets(mcVersion));
|
||||
} catch (GameException ex) {
|
||||
HMCLog.err("Failed to download assets", ex);
|
||||
MessageBox.showLocalized("assets.failed_download");
|
||||
}
|
||||
}//GEN-LAST:event_btnDownloadAllAssetsActionPerformed
|
||||
|
||||
private void txtMaxMemoryFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtMaxMemoryFocusLost
|
||||
@ -1269,7 +1280,7 @@ public final class GameSettingsPanel extends RepaintPage implements DropTargetLi
|
||||
new OverridableSwingWorkerImpl().reg(t -> {
|
||||
synchronized (modLock) {
|
||||
for (ModInfo x : t)
|
||||
model.addRow(new Object[]{x.isActive(), x, x.version});
|
||||
model.addRow(new Object[] { x.isActive(), x, x.version });
|
||||
reloadingMods = false;
|
||||
}
|
||||
}).execute();
|
||||
|
Loading…
x
Reference in New Issue
Block a user