Add a quick way to specify custom minecraft manifest urls

dev/0.11
modmuss50 2019-08-15 17:45:08 +01:00
parent 3455e087ab
commit 0b07f1badf
2 changed files with 15 additions and 1 deletions

View File

@ -54,6 +54,7 @@ public class LoomGradleExtension {
public boolean remapMod = true;
public boolean autoGenIDERuns = true;
public boolean extractJars = false;
public String customManifest = null;
private List<Path> unmappedModsBuilt = new ArrayList<>();

View File

@ -133,7 +133,20 @@ public class MinecraftProvider extends DependencyProvider {
String versionManifest = Files.asCharSource(manifests, StandardCharsets.UTF_8).read();
ManifestVersion mcManifest = new GsonBuilder().create().fromJson(versionManifest, ManifestVersion.class);
Optional<ManifestVersion.Versions> optionalVersion = mcManifest.versions.stream().filter(versions -> versions.id.equalsIgnoreCase(minecraftVersion)).findFirst();
Optional<ManifestVersion.Versions> optionalVersion = Optional.empty();
if(extension.customManifest != null){
ManifestVersion.Versions customVersion = new ManifestVersion.Versions();
customVersion.id = minecraftVersion;
customVersion.url = extension.customManifest;
optionalVersion = Optional.of(customVersion);
project.getLogger().lifecycle("Using custom minecraft manifest");
}
if(!optionalVersion.isPresent()){
optionalVersion = mcManifest.versions.stream().filter(versions -> versions.id.equalsIgnoreCase(minecraftVersion)).findFirst();
}
if (optionalVersion.isPresent()) {
if (offline) {
if (MINECRAFT_JSON.exists()) {