4
0
Fork 0
mirror of https://github.com/Anvilcraft/modpacktools synced 2024-06-10 22:49:26 +02:00

Updated Addonscript (reimport of Manifest needed)

This commit is contained in:
Timo Ley 2020-07-27 00:10:13 +02:00
parent 6e2941ef94
commit afe042be38
3 changed files with 24 additions and 10 deletions

View file

@ -22,7 +22,7 @@ dependencies {
compile 'org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.3.8'
//Other
compile 'com.github.Anvilcraft:addonscript-java:b560f84d5f'
compile 'com.github.Anvilcraft:addonscript-java:d83074cc1e'
compile 'com.squareup.okhttp3:okhttp:4.8.0'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.6'

View file

@ -3,7 +3,6 @@ package ley.anvil.modpacktools.commands;
import com.therandomlabs.curseapi.CurseAPI;
import com.therandomlabs.curseapi.CurseException;
import com.therandomlabs.curseapi.project.CurseProject;
import ley.anvil.addonscript.curse.CurseTools;
import ley.anvil.addonscript.v1.AddonscriptJSON;
import ley.anvil.modpacktools.Main;
import ley.anvil.modpacktools.command.CommandReturn;
@ -45,7 +44,6 @@ public class AddMod implements ICommand {
String regex = "(?m)^(http)(s)?://(www\\.)?(curseforge.com/minecraft/mc-mods/)[0-z,\\-]+/(files)/[0-9]+$";
String endPartRegex = "(/files/)[0-9]+$";
if(args[1].matches(regex)) {
CurseTools.addCurseRepo(json);
try {
//remove fileID
System.out.println("Getting ID");
@ -75,9 +73,17 @@ public class AddMod implements ICommand {
System.out.println("Adding Mod " + project.name());
//Construct Mod
AddonscriptJSON.Relation rel = new AddonscriptJSON.Relation();
rel.file = CurseTools.toArtifact(projectID, fileID);
rel.type = "included";
rel.file.installer = "internal.dir";
rel.file = new AddonscriptJSON.File();
rel.file.repository = "curse";
rel.file.artifact = "curse.maven:" + projectID + ":" + fileID;
rel.type = "mod";
rel.options = new ArrayList<>();
rel.options.add("client");
rel.options.add("server");
rel.options.add("required");
rel.options.add("included");
rel.id = ""+ projectID;
rel.file.installer = "internal.dir:mods";
//Add Mod to array
if(version.relations == null) {
version.relations = new ArrayList<>();
@ -90,8 +96,14 @@ public class AddMod implements ICommand {
AddonscriptJSON.Relation rel = new AddonscriptJSON.Relation();
rel.file = new AddonscriptJSON.File();
rel.file.link = args[1];
rel.type = "included";
rel.file.installer = "internal.dir";
rel.id = args[1];
rel.type = "mod";
rel.options = new ArrayList<>();
rel.options.add("client");
rel.options.add("server");
rel.options.add("required");
rel.options.add("included");
rel.file.installer = "internal.dir:mods";
if(version.relations == null) {
version.relations = new ArrayList<>();
}

View file

@ -1,6 +1,8 @@
package ley.anvil.modpacktools.commands
import j2html.TagCreator.*
import ley.anvil.addonscript.maven.ArtifactDestination
import ley.anvil.addonscript.wrapper.ASWrapper
import ley.anvil.addonscript.wrapper.MetaData
import ley.anvil.modpacktools.MPJH
import ley.anvil.modpacktools.command.CommandReturn
@ -124,7 +126,7 @@ object CreateModlist : ICommand {
println("Getting mods... this may take a while (TODO)")
val asJson = MPJH.asWrapper
val mods = mutableListOf<MetaData>()
val toGet = mutableListOf<String>()
val toGet = ArrayList<ArtifactDestination>()
for(rel in asJson!!.defaultVersion.getRelations(arrayOf("client"), null)) {
if (rel.hasLocalMeta())
@ -132,7 +134,7 @@ object CreateModlist : ICommand {
else if (rel.hasFile() && rel.file.isArtifact)
toGet.add(rel.file.artifact)
}
mods.addAll(asJson.repositories.getMeta(toGet.toTypedArray()).values)
mods.addAll(ASWrapper.getMetaData(toGet.toArray(emptyArray())).values)
return mods.sortedBy {m -> m.name?.toLowerCase() }
}