Updated AddonscriptJSON and fixed ManifestJSON

This commit is contained in:
Timo Ley 2020-07-24 19:22:23 +02:00
parent 425271587d
commit 0a81452d98
2 changed files with 19 additions and 7 deletions

View File

@ -38,13 +38,17 @@ public class ManifestJSON extends JSON {
public String id;
public boolean primary;
public AddonscriptJSON.Relation toRelation() {
public AddonscriptJSON.Relation toRelation(String mcv) {
if (id != null && id.startsWith("forge-")) {
AddonscriptJSON.Relation rel = new AddonscriptJSON.Relation();
rel.type = "included";
rel.file = new AddonscriptJSON.File();
rel.file.installer = "internal.forge";
rel.file.artifact = "forge:" + id.replaceAll("forge-", "");
rel.type = "modloader";
rel.id = "forge";
rel.versions = "[" + mcv + id.replaceAll("forge", "") + "]";
rel.options = new ArrayList<>();
rel.options.add("required");
rel.options.add("client");
rel.options.add("required");
rel.options.add("included");
return rel;
}
return null;
@ -62,6 +66,11 @@ public class ManifestJSON extends JSON {
rel.file = CurseTools.toArtifact(projectID, fileID);
rel.options = new ArrayList<>();
rel.options.add(required ? "required" : "optional");
rel.options.add("client");
rel.options.add("server");
rel.options.add("included");
rel.id = "" + projectID;
rel.type = "mod";
return rel;
}
@ -96,7 +105,7 @@ public class ManifestJSON extends JSON {
if (minecraft != null) {
for (Modloader l : minecraft.modLoaders) {
version.relations.add(l.toRelation());
version.relations.add(l.toRelation(minecraft.version));
}
}
@ -114,7 +123,6 @@ public class ManifestJSON extends JSON {
as.versions.add(getVersion());
CurseTools.addCurseRepo(as);
ForgeTools.addForgeRepo(as);
return as;
}

View File

@ -421,6 +421,10 @@ public class AddonscriptJSON extends ASBase {
*/
@Expose
public String id;
@Expose
public String loaderfile;
/**
* Optional: Wildcard if empty
* A version range string, which specifies, which versions of the addon can be used