AddonscriptJSON updated
This commit is contained in:
parent
4849dfeaef
commit
4ff9f44e50
|
@ -29,8 +29,10 @@ public class CurseTools {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String toArtifact(int projectID, int fileID) {
|
public static AddonscriptJSON.File toArtifact(int projectID, int fileID) {
|
||||||
return "curse>" + projectID + ":" + fileID;
|
AddonscriptJSON.File artifact = new AddonscriptJSON.File();
|
||||||
|
artifact.artifact = "curse:" + projectID + ":" + fileID;
|
||||||
|
return artifact;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isCurseArtifact(String artifact, AddonscriptJSON as) {
|
public static boolean isCurseArtifact(String artifact, AddonscriptJSON as) {
|
||||||
|
|
|
@ -41,9 +41,10 @@ public class ManifestJSON extends JSON {
|
||||||
public AddonscriptJSON.Relation toRelation() {
|
public AddonscriptJSON.Relation toRelation() {
|
||||||
if (id != null && id.startsWith("forge-")) {
|
if (id != null && id.startsWith("forge-")) {
|
||||||
AddonscriptJSON.Relation rel = new AddonscriptJSON.Relation();
|
AddonscriptJSON.Relation rel = new AddonscriptJSON.Relation();
|
||||||
rel.installer = "internal.forge";
|
|
||||||
rel.type = "included";
|
rel.type = "included";
|
||||||
rel.file = id.replaceAll("forge-", "");
|
rel.file = new AddonscriptJSON.File();
|
||||||
|
rel.file.installer = "internal.forge";
|
||||||
|
rel.file.artifact = "forge:" + id.replaceAll("forge-", "");
|
||||||
return rel;
|
return rel;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -59,6 +60,8 @@ public class ManifestJSON extends JSON {
|
||||||
public AddonscriptJSON.Relation toRelation() {
|
public AddonscriptJSON.Relation toRelation() {
|
||||||
AddonscriptJSON.Relation rel = new AddonscriptJSON.Relation();
|
AddonscriptJSON.Relation rel = new AddonscriptJSON.Relation();
|
||||||
rel.file = CurseTools.toArtifact(projectID, fileID);
|
rel.file = CurseTools.toArtifact(projectID, fileID);
|
||||||
|
rel.options = new ArrayList<>();
|
||||||
|
rel.options.add(required ? "required" : "optional");
|
||||||
return rel;
|
return rel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +86,8 @@ public class ManifestJSON extends JSON {
|
||||||
|
|
||||||
AddonscriptJSON.File overrides = new AddonscriptJSON.File();
|
AddonscriptJSON.File overrides = new AddonscriptJSON.File();
|
||||||
overrides.id = "overrides";
|
overrides.id = "overrides";
|
||||||
overrides.file = this.overrides;
|
overrides.installer = "internal.override";
|
||||||
|
overrides.path = this.overrides;
|
||||||
version.files.add(overrides);
|
version.files.add(overrides);
|
||||||
|
|
||||||
for (File f : files) {
|
for (File f : files) {
|
||||||
|
|
|
@ -44,8 +44,9 @@ public class ForgeTools {
|
||||||
if (as.type != null && as.type.equals("modpack")) {
|
if (as.type != null && as.type.equals("modpack")) {
|
||||||
rel.type = "included";
|
rel.type = "included";
|
||||||
}
|
}
|
||||||
rel.installer = "internal.forge";
|
rel.file = new AddonscriptJSON.File();
|
||||||
rel.file = "forge>"+ forgeVersion;
|
rel.file.installer = "internal.forge";
|
||||||
|
rel.file.artifact = "forge:"+ forgeVersion;
|
||||||
if (ver.relations == null) {
|
if (ver.relations == null) {
|
||||||
ver.relations = new ArrayList<>();
|
ver.relations = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class AddonscriptJSON extends ASBase {
|
||||||
REPOSITORIES.put(r.id, r.getRepository());
|
REPOSITORIES.put(r.id, r.getRepository());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ID of the addon
|
* The ID of the addon
|
||||||
*/
|
*/
|
||||||
|
@ -58,11 +58,13 @@ public class AddonscriptJSON extends ASBase {
|
||||||
public String type;
|
public String type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Optional
|
||||||
* External Addonscript files for this Addon, specific versions of specific editions
|
* External Addonscript files for this Addon, specific versions of specific editions
|
||||||
*/
|
*/
|
||||||
public List<External> external;
|
public List<External> external;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Optional
|
||||||
* Links to external Addonscript files, that should be applied/merged to this
|
* Links to external Addonscript files, that should be applied/merged to this
|
||||||
*/
|
*/
|
||||||
public List<String> apply;
|
public List<String> apply;
|
||||||
|
@ -83,6 +85,7 @@ public class AddonscriptJSON extends ASBase {
|
||||||
public List<Installer> installers;
|
public List<Installer> installers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Optional
|
||||||
* Meta information for this addon
|
* Meta information for this addon
|
||||||
*/
|
*/
|
||||||
public Meta meta;
|
public Meta meta;
|
||||||
|
@ -236,13 +239,26 @@ public class AddonscriptJSON extends ASBase {
|
||||||
* Format: <installerid>:<param 1>:<param 2>...
|
* Format: <installerid>:<param 1>:<param 2>...
|
||||||
* Installer ID can be internal.<some internal installer>
|
* Installer ID can be internal.<some internal installer>
|
||||||
*/
|
*/
|
||||||
public String installer = "internal.override";
|
public String installer = "internal.dir:mods";
|
||||||
/**
|
/**
|
||||||
* A link or relative path to this file.
|
* Optional: Use this, path or artifact
|
||||||
|
* A link to this file.
|
||||||
|
*/
|
||||||
|
public String link;
|
||||||
|
/**
|
||||||
|
* Optional: Use this, link or artifact
|
||||||
|
* A relative path to this file.
|
||||||
* It can also be a path to a directory, if the installer supports directories
|
* It can also be a path to a directory, if the installer supports directories
|
||||||
*/
|
*/
|
||||||
public Artifact file;
|
public String path;
|
||||||
/**
|
/**
|
||||||
|
* Optional: Use this, link or path
|
||||||
|
* An artifact from a repository, which is this file
|
||||||
|
*/
|
||||||
|
public String artifact;
|
||||||
|
/**
|
||||||
|
* Optional: Defaults if empty
|
||||||
|
* (Defaults = required, client, server)
|
||||||
* A list of options for this file.
|
* A list of options for this file.
|
||||||
* Currently supported parameters:
|
* Currently supported parameters:
|
||||||
* "required" - This file is required for the addon
|
* "required" - This file is required for the addon
|
||||||
|
@ -264,6 +280,7 @@ public class AddonscriptJSON extends ASBase {
|
||||||
|
|
||||||
public static class Relation {
|
public static class Relation {
|
||||||
/**
|
/**
|
||||||
|
* Optional: Use either this or file
|
||||||
* An external Addonscript for this relation
|
* An external Addonscript for this relation
|
||||||
*/
|
*/
|
||||||
public Script script;
|
public Script script;
|
||||||
|
@ -273,28 +290,26 @@ public class AddonscriptJSON extends ASBase {
|
||||||
*/
|
*/
|
||||||
public String id;
|
public String id;
|
||||||
/**
|
/**
|
||||||
* The installer for this file
|
* Optional: Use either this or script
|
||||||
* Format: <installerid>:<param 1>:<param 2>...
|
|
||||||
* Installer ID can be internal.<some internal installer>
|
|
||||||
*/
|
|
||||||
public String installer = "internal.dir:mods";
|
|
||||||
/**
|
|
||||||
* The file of this relation
|
* The file of this relation
|
||||||
* Can be a direct link or an artifact from a repository
|
* Can be a direct link or an artifact from a repository
|
||||||
*/
|
*/
|
||||||
public Artifact file;
|
public File file;
|
||||||
/**
|
/**
|
||||||
* The addon type of this relation
|
* The addon type of this relation
|
||||||
* For example: mod, modloader, config, script...
|
* For example: mod, modloader, config, script...
|
||||||
*/
|
*/
|
||||||
public String type;
|
public String type;
|
||||||
/**
|
/**
|
||||||
|
* Optional
|
||||||
* Meta information for this relation
|
* Meta information for this relation
|
||||||
* This is not always useful, because some repositories, like curseforge, are
|
* This is not always useful, because some repositories, like curseforge, are
|
||||||
* already exposing this information
|
* already exposing this information
|
||||||
*/
|
*/
|
||||||
public Meta meta;
|
public Meta meta;
|
||||||
/**
|
/**
|
||||||
|
* Optional: Defaults if empty
|
||||||
|
* (Defaults = required[included instead, if this is a modpack], client, server)
|
||||||
* A list of options for this relation.
|
* A list of options for this relation.
|
||||||
* Currently supportet parameters:
|
* Currently supportet parameters:
|
||||||
* "required" - This relation is required for the addon
|
* "required" - This relation is required for the addon
|
||||||
|
@ -318,26 +333,49 @@ public class AddonscriptJSON extends ASBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class External {
|
public static class External {
|
||||||
|
/**
|
||||||
|
* Optional: Wildcard if empty
|
||||||
|
* The versionid of the version, for which this external script should be used
|
||||||
|
*/
|
||||||
public int versionid;
|
public int versionid;
|
||||||
|
/**
|
||||||
|
* Optional: Wildcard if empty
|
||||||
|
* The edition id of the edition, for which this external script should be used
|
||||||
|
*/
|
||||||
public String edition;
|
public String edition;
|
||||||
|
/**
|
||||||
|
* The link to the external script
|
||||||
|
*/
|
||||||
public String link;
|
public String link;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Script {
|
public static class Script {
|
||||||
|
/**
|
||||||
|
* The link to the script
|
||||||
|
*/
|
||||||
public String link;
|
public String link;
|
||||||
|
/**
|
||||||
|
* Optional: Wildcard if empty
|
||||||
|
* A version range string, which specifies, which versions of the addon can be used
|
||||||
|
*/
|
||||||
public String version;
|
public String version;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Artifact {
|
public static class Edition {
|
||||||
|
/**
|
||||||
public String link;
|
* The id of the edition
|
||||||
public String path;
|
*/
|
||||||
public String artifact;
|
public String id;
|
||||||
|
/**
|
||||||
|
* Optional: Wildcard if empty
|
||||||
|
* A version range string, which specifies, which versions have this edition
|
||||||
|
*/
|
||||||
|
public String version;
|
||||||
|
/**
|
||||||
|
* Optional
|
||||||
|
* Meta information about this edition
|
||||||
|
*/
|
||||||
|
public Meta meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue