mirror of
https://github.com/Anvilcraft/modpacktools
synced 2024-11-17 23:41:55 +01:00
Updated Addonscript (reimport of Manifest needed)
This commit is contained in:
parent
6e2941ef94
commit
afe042be38
3 changed files with 24 additions and 10 deletions
|
@ -22,7 +22,7 @@ dependencies {
|
||||||
compile 'org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.3.8'
|
compile 'org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.3.8'
|
||||||
|
|
||||||
//Other
|
//Other
|
||||||
compile 'com.github.Anvilcraft:addonscript-java:b560f84d5f'
|
compile 'com.github.Anvilcraft:addonscript-java:d83074cc1e'
|
||||||
|
|
||||||
compile 'com.squareup.okhttp3:okhttp:4.8.0'
|
compile 'com.squareup.okhttp3:okhttp:4.8.0'
|
||||||
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
|
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
|
||||||
|
|
|
@ -3,7 +3,6 @@ package ley.anvil.modpacktools.commands;
|
||||||
import com.therandomlabs.curseapi.CurseAPI;
|
import com.therandomlabs.curseapi.CurseAPI;
|
||||||
import com.therandomlabs.curseapi.CurseException;
|
import com.therandomlabs.curseapi.CurseException;
|
||||||
import com.therandomlabs.curseapi.project.CurseProject;
|
import com.therandomlabs.curseapi.project.CurseProject;
|
||||||
import ley.anvil.addonscript.curse.CurseTools;
|
|
||||||
import ley.anvil.addonscript.v1.AddonscriptJSON;
|
import ley.anvil.addonscript.v1.AddonscriptJSON;
|
||||||
import ley.anvil.modpacktools.Main;
|
import ley.anvil.modpacktools.Main;
|
||||||
import ley.anvil.modpacktools.command.CommandReturn;
|
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 regex = "(?m)^(http)(s)?://(www\\.)?(curseforge.com/minecraft/mc-mods/)[0-z,\\-]+/(files)/[0-9]+$";
|
||||||
String endPartRegex = "(/files/)[0-9]+$";
|
String endPartRegex = "(/files/)[0-9]+$";
|
||||||
if(args[1].matches(regex)) {
|
if(args[1].matches(regex)) {
|
||||||
CurseTools.addCurseRepo(json);
|
|
||||||
try {
|
try {
|
||||||
//remove fileID
|
//remove fileID
|
||||||
System.out.println("Getting ID");
|
System.out.println("Getting ID");
|
||||||
|
@ -75,9 +73,17 @@ public class AddMod implements ICommand {
|
||||||
System.out.println("Adding Mod " + project.name());
|
System.out.println("Adding Mod " + project.name());
|
||||||
//Construct Mod
|
//Construct Mod
|
||||||
AddonscriptJSON.Relation rel = new AddonscriptJSON.Relation();
|
AddonscriptJSON.Relation rel = new AddonscriptJSON.Relation();
|
||||||
rel.file = CurseTools.toArtifact(projectID, fileID);
|
rel.file = new AddonscriptJSON.File();
|
||||||
rel.type = "included";
|
rel.file.repository = "curse";
|
||||||
rel.file.installer = "internal.dir";
|
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
|
//Add Mod to array
|
||||||
if(version.relations == null) {
|
if(version.relations == null) {
|
||||||
version.relations = new ArrayList<>();
|
version.relations = new ArrayList<>();
|
||||||
|
@ -90,8 +96,14 @@ public class AddMod implements ICommand {
|
||||||
AddonscriptJSON.Relation rel = new AddonscriptJSON.Relation();
|
AddonscriptJSON.Relation rel = new AddonscriptJSON.Relation();
|
||||||
rel.file = new AddonscriptJSON.File();
|
rel.file = new AddonscriptJSON.File();
|
||||||
rel.file.link = args[1];
|
rel.file.link = args[1];
|
||||||
rel.type = "included";
|
rel.id = args[1];
|
||||||
rel.file.installer = "internal.dir";
|
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) {
|
if(version.relations == null) {
|
||||||
version.relations = new ArrayList<>();
|
version.relations = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package ley.anvil.modpacktools.commands
|
package ley.anvil.modpacktools.commands
|
||||||
|
|
||||||
import j2html.TagCreator.*
|
import j2html.TagCreator.*
|
||||||
|
import ley.anvil.addonscript.maven.ArtifactDestination
|
||||||
|
import ley.anvil.addonscript.wrapper.ASWrapper
|
||||||
import ley.anvil.addonscript.wrapper.MetaData
|
import ley.anvil.addonscript.wrapper.MetaData
|
||||||
import ley.anvil.modpacktools.MPJH
|
import ley.anvil.modpacktools.MPJH
|
||||||
import ley.anvil.modpacktools.command.CommandReturn
|
import ley.anvil.modpacktools.command.CommandReturn
|
||||||
|
@ -124,7 +126,7 @@ object CreateModlist : ICommand {
|
||||||
println("Getting mods... this may take a while (TODO)")
|
println("Getting mods... this may take a while (TODO)")
|
||||||
val asJson = MPJH.asWrapper
|
val asJson = MPJH.asWrapper
|
||||||
val mods = mutableListOf<MetaData>()
|
val mods = mutableListOf<MetaData>()
|
||||||
val toGet = mutableListOf<String>()
|
val toGet = ArrayList<ArtifactDestination>()
|
||||||
|
|
||||||
for(rel in asJson!!.defaultVersion.getRelations(arrayOf("client"), null)) {
|
for(rel in asJson!!.defaultVersion.getRelations(arrayOf("client"), null)) {
|
||||||
if (rel.hasLocalMeta())
|
if (rel.hasLocalMeta())
|
||||||
|
@ -132,7 +134,7 @@ object CreateModlist : ICommand {
|
||||||
else if (rel.hasFile() && rel.file.isArtifact)
|
else if (rel.hasFile() && rel.file.isArtifact)
|
||||||
toGet.add(rel.file.artifact)
|
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() }
|
return mods.sortedBy {m -> m.name?.toLowerCase() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue