Fix forge 1.13 installation

This commit is contained in:
huanghongxun
2019-03-04 11:39:30 +08:00
parent dc1df98277
commit 266c686a3a
10 changed files with 29 additions and 9 deletions

View File

@@ -112,7 +112,7 @@ def createExecutable(String suffix, String header) {
processResources { processResources {
ext.convertToBSS = { String resource -> ext.convertToBSS = { String resource ->
exclude resource // exclude resource
doFirst { doFirst {
def cssFile = new File(this.projectDir, "src/main/resources/" + resource) def cssFile = new File(this.projectDir, "src/main/resources/" + resource)
def bssFile = new File(this.projectDir, "build/compiled-resources/" + resource[0..-4] + "bss") def bssFile = new File(this.projectDir, "build/compiled-resources/" + resource[0..-4] + "bss")

View File

@@ -95,7 +95,7 @@ download.failed=Failed to download
download.failed.empty=No candidates. Click here to return. download.failed.empty=No candidates. Click here to return.
download.failed.refresh=Unable to load version list. Click here to retry. download.failed.refresh=Unable to load version list. Click here to retry.
download.provider.bmclapi=BMCLAPI (bangbang93, https://bmclapi2.bangbang93.com/) download.provider.bmclapi=BMCLAPI (bangbang93, https://bmclapi2.bangbang93.com/)
download.provider.mojang=Mojang download.provider.mojang=Mojang (Forge and OptiFine installation being downloaded from BMCLAPI)
extension.bat=Windows Bat file extension.bat=Windows Bat file
extension.mod=Mod file extension.mod=Mod file

View File

@@ -94,7 +94,7 @@ download.failed=下載失敗
download.failed.empty=沒有可供安裝的版本,點擊此處返回。 download.failed.empty=沒有可供安裝的版本,點擊此處返回。
download.failed.refresh=載入版本列表失敗,點擊此處重試。 download.failed.refresh=載入版本列表失敗,點擊此處重試。
download.provider.bmclapi=BMCLAPIbangbang93https://bmclapi2.bangbang93.com/ download.provider.bmclapi=BMCLAPIbangbang93https://bmclapi2.bangbang93.com/
download.provider.mojang=官方伺服器(Mojang download.provider.mojang=官方伺服器(Forge 和 OptiFine 自動安裝的下載來源是 BMCLAPI
extension.bat=Windows 腳本 extension.bat=Windows 腳本
extension.mod=模組檔案 extension.mod=模組檔案

View File

@@ -94,7 +94,7 @@ download.failed=下载失败
download.failed.empty=没有可供安装的版本,点击此处返回。 download.failed.empty=没有可供安装的版本,点击此处返回。
download.failed.refresh=加载版本列表失败,点击此处重试。 download.failed.refresh=加载版本列表失败,点击此处重试。
download.provider.bmclapi=BMCLAPIbangbang93https://bmclapi2.bangbang93.com/ download.provider.bmclapi=BMCLAPIbangbang93https://bmclapi2.bangbang93.com/
download.provider.mojang=官方(Mojang download.provider.mojang=官方(Forge 和 OptiFine 自动安装使用 BMCLAPI 下载源
extension.bat=Windows 脚本 extension.bat=Windows 脚本
extension.mod=模组文件 extension.mod=模组文件

View File

@@ -58,7 +58,8 @@ public final class ForgeInstallTask extends TaskResult<Version> {
public void preExecute() throws Exception { public void preExecute() throws Exception {
installer = Files.createTempFile("forge-installer", ".jar"); installer = Files.createTempFile("forge-installer", ".jar");
dependent = new FileDownloadTask(NetworkUtils.toURL(remote.getUrl()), installer.toFile()); dependent = new FileDownloadTask(NetworkUtils.toURL(remote.getUrl()), installer.toFile())
.setCaching(true);
} }
@Override @Override

View File

@@ -34,14 +34,16 @@ public class ForgeNewInstallProfile {
private final int spec; private final int spec;
private final String minecraft; private final String minecraft;
private final String json; private final String json;
private final Artifact path;
private final List<Library> libraries; private final List<Library> libraries;
private final List<Processor> processors; private final List<Processor> processors;
private final Map<String, Datum> data; private final Map<String, Datum> data;
public ForgeNewInstallProfile(int spec, String minecraft, String json, List<Library> libraries, List<Processor> processors, Map<String, Datum> data) { public ForgeNewInstallProfile(int spec, String minecraft, String json, Artifact path, List<Library> libraries, List<Processor> processors, Map<String, Datum> data) {
this.spec = spec; this.spec = spec;
this.minecraft = minecraft; this.minecraft = minecraft;
this.json = json; this.json = json;
this.path = path;
this.libraries = libraries; this.libraries = libraries;
this.processors = processors; this.processors = processors;
this.data = data; this.data = data;
@@ -69,6 +71,14 @@ public class ForgeNewInstallProfile {
return json; return json;
} }
/**
* Maven artifact path for the main jar to install.
* @return artifact path of the main jar.
*/
public Artifact getPath() {
return path;
}
/** /**
* Libraries that processors depend on. * Libraries that processors depend on.
* @return the required dependencies. * @return the required dependencies.

View File

@@ -107,6 +107,14 @@ public class ForgeNewInstallTask extends TaskResult<Version> {
FileUtils.copyFile(file, dest); FileUtils.copyFile(file, dest);
} }
} }
{
Path mainJar = profile.getPath().getPath(fs.getPath("maven"));
if (Files.exists(mainJar)) {
Path dest = gameRepository.getArtifactFile(version, profile.getPath());
FileUtils.copyFile(mainJar, dest);
}
}
} }
dependents.add(new GameLibrariesTask(dependencyManager, version, profile.getLibraries())); dependents.add(new GameLibrariesTask(dependencyManager, version, profile.getLibraries()));

View File

@@ -89,6 +89,7 @@ public final class GameAssetDownloadTask extends Task {
String url = dependencyManager.getDownloadProvider().getAssetBaseURL() + assetObject.getLocation(); String url = dependencyManager.getDownloadProvider().getAssetBaseURL() + assetObject.getLocation();
FileDownloadTask task = new FileDownloadTask(NetworkUtils.toURL(url), file, new FileDownloadTask.IntegrityCheck("SHA-1", assetObject.getHash())); FileDownloadTask task = new FileDownloadTask(NetworkUtils.toURL(url), file, new FileDownloadTask.IntegrityCheck("SHA-1", assetObject.getHash()));
task.setName(assetObject.getHash()); task.setName(assetObject.getHash());
task.setCaching(true);
dependencies.add(task dependencies.add(task
.setCacheRepository(dependencyManager.getCacheRepository()) .setCacheRepository(dependencyManager.getCacheRepository())
.setCaching(true) .setCaching(true)

View File

@@ -128,12 +128,12 @@ public class LibraryDownloadTask extends Task {
try { try {
URL packXz = NetworkUtils.toURL(url + ".pack.xz"); URL packXz = NetworkUtils.toURL(url + ".pack.xz");
if (NetworkUtils.urlExists(packXz)) { if (NetworkUtils.urlExists(packXz)) {
task = new FileDownloadTask(packXz, xzFile, null); task = new FileDownloadTask(packXz, xzFile, null).setCaching(true);
xz = true; xz = true;
} else { } else {
task = new FileDownloadTask(NetworkUtils.toURL(url), task = new FileDownloadTask(NetworkUtils.toURL(url),
jar, jar,
library.getDownload().getSha1() != null ? new IntegrityCheck("SHA-1", library.getDownload().getSha1()) : null); library.getDownload().getSha1() != null ? new IntegrityCheck("SHA-1", library.getDownload().getSha1()) : null).setCaching(true);
xz = false; xz = false;
} }
} catch (IOException e) { } catch (IOException e) {

View File

@@ -140,7 +140,7 @@ public final class CurseCompletionTask extends Task {
for (CurseManifestFile file : newManifest.getFiles()) for (CurseManifestFile file : newManifest.getFiles())
if (StringUtils.isNotBlank(file.getFileName())) { if (StringUtils.isNotBlank(file.getFileName())) {
if (!modManager.hasSimpleMod(file.getFileName())) { if (!modManager.hasSimpleMod(file.getFileName())) {
dependencies.add(new FileDownloadTask(file.getUrl(), modManager.getSimpleModPath(file.getFileName()).toFile())); dependencies.add(new FileDownloadTask(file.getUrl(), modManager.getSimpleModPath(file.getFileName()).toFile()).setCaching(true));
} }
} }