Might fix some problems

This commit is contained in:
huangyuhui 2016-03-09 13:14:53 +08:00
parent 2eaf32b23d
commit c839d045cc
4 changed files with 16 additions and 11 deletions

View File

@ -32,6 +32,7 @@ import org.jackhuang.hellominecraft.util.system.IOUtils;
import org.jackhuang.hellominecraft.util.StrUtils;
import org.jackhuang.hellominecraft.launcher.core.download.IDownloadProvider;
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersion;
import org.jackhuang.hellominecraft.util.Utils;
import org.jackhuang.hellominecraft.util.VersionNumber;
import org.jackhuang.hellominecraft.util.tasks.TaskInfo;
@ -47,8 +48,7 @@ public class AssetsMojangLoader extends IAssetsHandler {
@Override
public Task getList(final MinecraftVersion mv, final IMinecraftAssetService mp) {
if (mv == null)
throw new IllegalArgumentException("AssetsMojangLoader: null argument: MinecraftVersion");
Utils.requireNonNull(mv);
String assetsId = mv.getAssetsIndex().getId();
File assets = mp.getAssets();
HMCLog.log("Gathering asset index: " + assetsId);

View File

@ -30,6 +30,7 @@ import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftService;
import org.jackhuang.hellominecraft.launcher.core.version.AssetIndexDownloadInfo;
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersion;
import org.jackhuang.hellominecraft.util.MessageBox;
import org.jackhuang.hellominecraft.util.Utils;
import org.jackhuang.hellominecraft.util.func.Function;
import org.jackhuang.hellominecraft.util.logging.HMCLog;
import org.jackhuang.hellominecraft.util.tasks.Task;
@ -55,6 +56,7 @@ public class MinecraftAssetService extends IMinecraftAssetService {
}
public Task downloadAssets(final MinecraftVersion mv) {
Utils.requireNonNull(mv);
return new TaskInfo("Download Assets") {
Collection<Task> afters = new HashSet<>();

View File

@ -54,16 +54,15 @@ public class MinecraftDownloadService extends IMinecraftDownloadService {
if (mv == null)
return downloadLibraries;
MinecraftVersion v = mv.resolve(service.version());
if (v.libraries != null)
for (IMinecraftLibrary l : v.libraries)
if (l.allow()) {
File ff = l.getFilePath(service.baseDirectory());
if (!ff.exists()) {
String libURL = l.getDownloadInfo().getUrl(service.getDownloadType());
if (libURL != null)
downloadLibraries.add(new DownloadLibraryJob(l, libURL, ff));
}
for (IMinecraftLibrary l : v.getLibraries())
if (l != null && l.allow()) {
File ff = l.getFilePath(service.baseDirectory());
if (!ff.exists()) {
String libURL = l.getDownloadInfo().getUrl(service.getDownloadType());
if (libURL != null)
downloadLibraries.add(new DownloadLibraryJob(l, libURL, ff));
}
}
return downloadLibraries;
}

View File

@ -168,4 +168,8 @@ public class MinecraftVersion implements Cloneable, Comparable<MinecraftVersion>
i.id = id;
return i;
}
public Set<IMinecraftLibrary> getLibraries() {
return libraries == null ? new HashSet() : new HashSet(libraries);
}
}