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 { plugins {
id 'java' id 'java'
id 'maven-publish' id 'maven-publish'
@ -32,7 +33,7 @@ task sourceJar(type: Jar) {
publishing { publishing {
publications { publications {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {
artifactId "addonscript-java" artifactId "addonscript"
from components.java from components.java
artifact tasks.sourceJar artifact tasks.sourceJar
} }
@ -52,6 +53,5 @@ publishing {
} }
url = "https://maven.pkg.github.com/Anvilcraft/addonscript-java" 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 com.google.gson.annotations.Expose;
import ley.anvil.addonscript.util.ASBase; import ley.anvil.addonscript.util.ASBase;
import ley.anvil.addonscript.util.Upcoming;
import java.io.Reader; import java.io.Reader;
import java.util.List; import java.util.List;
@ -196,7 +197,14 @@ public class AddonscriptJSON extends ASBase {
* Installer ID can be internal.<some internal installer> * Installer ID can be internal.<some internal installer>
*/ */
@Expose @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 * 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;. * 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 @Expose
public String id; public String id;
@Deprecated
@Expose @Expose
public String loaderfile; public String loaderfile;

View File

@ -329,6 +329,19 @@ public class ASWrapper {
return defaultOptions(); 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) { public static Map<ArtifactDestination, MetaData> getMetaData(ArtifactDestination[] artifacts) {