Fixed forge not downloading from BMCL

This commit is contained in:
huangyuhui
2017-02-24 13:13:55 +08:00
parent 0bda79c0d5
commit c67caafdb4
9 changed files with 53 additions and 133 deletions

View File

@@ -1,40 +0,0 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see {http://www.gnu.org/licenses/}.
*/
package org.jackhuang.hmcl.api.event.launch;
import org.jackhuang.hmcl.api.game.DecompressLibraryJob;
import org.jackhuang.hmcl.api.event.ResultedSimpleEvent;
/**
* This event gets fired when we are launching a game and going to decompress natives.
* <br>
* This event is {@link org.jackhuang.hmcl.api.event.ResultedEvent}
* If this event is failed, the launching process will be terminated.
* <br>
* This event is fired on the {@link org.jackhuang.hmcl.api.HMCLApi#EVENT_BUS}
* @param source {@link org.jackhuang.hmcl.core.launch.GameLauncher}
* @param DecompressLibraryJob libraries to be decompressed
* @author huangyuhui
*/
public class DecompressLibrariesEvent extends ResultedSimpleEvent<DecompressLibraryJob> {
public DecompressLibrariesEvent(Object source, DecompressLibraryJob value) {
super(source, value);
}
}

View File

@@ -1,39 +0,0 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see {http://www.gnu.org/licenses/}.
*/
package org.jackhuang.hmcl.api.event.launch;
import java.util.List;
import org.jackhuang.hmcl.api.event.ResultedSimpleEvent;
/**
* This event gets fired when we are launching a game and there are some libraries to be downloaded.
* <br>
* This event is {@link org.jackhuang.hmcl.api.event.ResultedEvent}
* If this event is failed, the launching process will be terminated.
* <br>
* This event is fired on the {@link org.jackhuang.hmcl.api.HMCLApi#EVENT_BUS}
* @param source {@link org.jackhuang.hmcl.core.launch.GameLauncher}
* Passed value List&lt;DownloadLibraryJob&gt;: libraries to be downloaded.
* @author huangyuhui
*/
public class DownloadLibrariesEvent extends ResultedSimpleEvent<List<DownloadLibraryJob>> {
public DownloadLibrariesEvent(Object sender, List<DownloadLibraryJob> lists) {
super(sender, lists);
}
}

View File

@@ -1,53 +0,0 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see {http://www.gnu.org/licenses/}.
*/
package org.jackhuang.hmcl.api.event.launch;
import java.io.File;
import org.jackhuang.hmcl.api.game.IMinecraftLibrary;
/**
*
* @author huangyuhui
*/
public class DownloadLibraryJob {
public IMinecraftLibrary lib;
public String url;
public File path;
public DownloadLibraryJob(IMinecraftLibrary n, String u, File p) {
url = u;
lib = n;
path = p;
}
public DownloadLibraryJob parse() {
String name = lib.getName();
if (name.startsWith("net.minecraftforge:forge:")) {
String[] s = name.split(":");
if (s.length == 3)
url = "http://files.minecraftforge.net/maven/net/minecraftforge/forge/" + s[2] + "/forge-" + s[2] + "-universal.jar";
}
if (name.startsWith("com.mumfrey:liteloader:")) {
String[] s = name.split(":");
if (s.length == 3 && s[2].length() > 3)
url = "http://dl.liteloader.com/versions/com/mumfrey/liteloader/" + s[2].substring(0, s[2].length() - 3) + "/liteloader-" + s[2] + ".jar";
}
return this;
}
}