mirror of
https://github.com/Anvilcraft/modpacktools
synced 2024-11-17 23:41:55 +01:00
Merge remote-tracking branch 'origin/master'
# Conflicts: # src/main/kotlin/ley/anvil/modpacktools/commands/CreateModlist.kt
This commit is contained in:
commit
b795dc1d79
4 changed files with 89 additions and 1 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:d83074cc1e'
|
compile 'com.github.Anvilcraft:addonscript-java:30c7ee114a'
|
||||||
|
|
||||||
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'
|
||||||
|
|
|
@ -4,6 +4,7 @@ import j2html.TagCreator.*
|
||||||
import j2html.utils.CSSMin.compressCss
|
import j2html.utils.CSSMin.compressCss
|
||||||
import ley.anvil.addonscript.maven.ArtifactDestination
|
import ley.anvil.addonscript.maven.ArtifactDestination
|
||||||
import ley.anvil.addonscript.wrapper.ASWrapper
|
import ley.anvil.addonscript.wrapper.ASWrapper
|
||||||
|
import ley.anvil.addonscript.wrapper.ArtifactDestination
|
||||||
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
|
||||||
|
|
76
src/main/kotlin/ley/anvil/modpacktools/util/ASConverter.kt
Normal file
76
src/main/kotlin/ley/anvil/modpacktools/util/ASConverter.kt
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
package ley.anvil.modpacktools.util
|
||||||
|
|
||||||
|
import ley.anvil.addonscript.curse.ManifestJSON
|
||||||
|
import ley.anvil.addonscript.wrapper.ASWrapper
|
||||||
|
|
||||||
|
fun convertAStoManifest(addonscript: ASWrapper): ManifestLinksPair {
|
||||||
|
var ml = ManifestLinksPair()
|
||||||
|
var ver = addonscript.defaultVersion
|
||||||
|
var manifest = ManifestJSON()
|
||||||
|
|
||||||
|
var mcv = ver.version?.mcversion!![0]
|
||||||
|
manifest.minecraft = ManifestJSON.Minecraft()
|
||||||
|
manifest.minecraft.version = mcv
|
||||||
|
manifest.minecraft.modLoaders = mutableListOf()
|
||||||
|
manifest.files = mutableListOf()
|
||||||
|
|
||||||
|
manifest.manifestType = "minecraftModpack"
|
||||||
|
manifest.manifestVersion = 1
|
||||||
|
manifest.name = addonscript.json.meta!!.name
|
||||||
|
if (manifest.name == null)
|
||||||
|
manifest.name = addonscript.json.id
|
||||||
|
manifest.version = ver.versionName
|
||||||
|
manifest.author = addonscript.json!!.meta!!.contributors[0].name
|
||||||
|
|
||||||
|
|
||||||
|
for (rel in ver.getRelations(arrayOf("client"), null)) {
|
||||||
|
if (rel.isModloader) {
|
||||||
|
if (rel.relation.id == "forge") {
|
||||||
|
var forge = ManifestJSON.Modloader()
|
||||||
|
forge.primary = true
|
||||||
|
forge.id = "forge-" + rel.versions.latestKnown
|
||||||
|
manifest.minecraft.modLoaders.add(forge)
|
||||||
|
} else {
|
||||||
|
println("Curse only allows Forge as a modloader. " + rel.relation.id + " is not allowed!")
|
||||||
|
}
|
||||||
|
} else if (rel.hasFile()) {
|
||||||
|
var file = rel.file
|
||||||
|
if (file.file.installer == "internal.jar") {
|
||||||
|
println("internal.jar is not supportet on Curse")
|
||||||
|
continue
|
||||||
|
} else if (file.isArtifact) {
|
||||||
|
var art = file.artifact
|
||||||
|
if (art.isCurseforge) {
|
||||||
|
var f = ManifestJSON.File()
|
||||||
|
f.fileID = art.fileID
|
||||||
|
f.projectID = art.projectID
|
||||||
|
f.required = rel.options.contains("required")
|
||||||
|
manifest.files.add(f);
|
||||||
|
}
|
||||||
|
} else if (rel.options.contains("required")) {
|
||||||
|
ml.links.put(file.get(), file.file.installer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (file in ver.getFiles(arrayOf("client", "required"), null)) {
|
||||||
|
if (file.file.installer == "internal.jar") {
|
||||||
|
println("internal.jar is not supportet on Curse")
|
||||||
|
continue
|
||||||
|
} else if (file.isArtifact) {
|
||||||
|
var art = file.artifact
|
||||||
|
if (art.isCurseforge) {
|
||||||
|
var f = ManifestJSON.File()
|
||||||
|
f.fileID = art.fileID
|
||||||
|
f.projectID = art.projectID
|
||||||
|
f.required = true
|
||||||
|
manifest.files.add(f);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ml.links.put(file.get(), file.file.installer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ml.manifest = manifest
|
||||||
|
|
||||||
|
return ml
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package ley.anvil.modpacktools.util
|
||||||
|
|
||||||
|
import ley.anvil.addonscript.curse.ManifestJSON
|
||||||
|
import ley.anvil.addonscript.wrapper.FileOrLink
|
||||||
|
|
||||||
|
class ManifestLinksPair {
|
||||||
|
|
||||||
|
var manifest: ManifestJSON? = null
|
||||||
|
var links: MutableMap<FileOrLink, String> = HashMap()
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue