Added getForgeUniversal to the relation and prepared for a more generic way to get modloaders in the future.

This commit is contained in:
Timo Ley 2020-08-14 19:32:38 +02:00
parent dcc02fd6b2
commit 20c0997b10
4 changed files with 29 additions and 3 deletions

View File

@ -1,3 +1,4 @@
plugins {
id 'java'
id 'maven-publish'
@ -32,7 +33,7 @@ task sourceJar(type: Jar) {
publishing {
publications {
mavenJava(MavenPublication) {
artifactId "addonscript-java"
artifactId "addonscript"
from components.java
artifact tasks.sourceJar
}
@ -52,6 +53,5 @@ publishing {
}
url = "https://maven.pkg.github.com/Anvilcraft/addonscript-java"
}
mavenLocal()
}
}

View File

@ -0,0 +1,4 @@
package ley.anvil.addonscript.util;
public @interface Upcoming {
}

View File

@ -2,6 +2,7 @@ package ley.anvil.addonscript.v1;
import com.google.gson.annotations.Expose;
import ley.anvil.addonscript.util.ASBase;
import ley.anvil.addonscript.util.Upcoming;
import java.io.Reader;
import java.util.List;
@ -196,7 +197,14 @@ public class AddonscriptJSON extends ASBase {
* Installer ID can be internal.<some internal installer>
*/
@Expose
public String installer = "internal.dir:mods";
public String installer = "internal.dir";
/**
* This are the arguments for the installer
* Each installer needs other arguments and others need none.
*/
@Upcoming
@Expose
public List<String> arguments;
/**
* Optional: Use this or artifact
* A link to this file. Can also point to a relative file or directory by using file://&lt;relative path&gt;.
@ -237,6 +245,7 @@ public class AddonscriptJSON extends ASBase {
@Expose
public String id;
@Deprecated
@Expose
public String loaderfile;

View File

@ -329,6 +329,19 @@ public class ASWrapper {
return defaultOptions();
}
@Deprecated
public FileOrLink getForgeUniversal() {
Versions v = getVersions();
String lat = v.latest;
if (!lat.contains("-"))
throw new RuntimeException("Invalid Forge version: " + lat + " must include the Minecraft version at the beginning seperated with a - from the forge version.");
if (Utils.notEmpty(lat)) {
String link = new ArtifactDestination("net.minecraftforge:forge:" + lat + ":universal", "https://files.minecraftforge.net/maven/").getPath();
return new FileOrLink(link);
}
throw new RuntimeException("No version specified for forge");
}
}
public static Map<ArtifactDestination, MetaData> getMetaData(ArtifactDestination[] artifacts) {