Add a quick way to specify custom minecraft manifest urls
This commit is contained in:
parent
3455e087ab
commit
0b07f1badf
2 changed files with 15 additions and 1 deletions
|
@ -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<>();
|
||||
|
||||
|
|
|
@ -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()) {
|
||||
|
|
Loading…
Reference in a new issue