rework dsl, add mod configurations (remapped), add support for other mappings #3
|
@ -240,7 +240,7 @@ abstract class MinecraftConfiguration @Inject constructor(
|
|||
}
|
||||
|
||||
abstract class LayerConfiguration {
|
||||
/*internal*/ val layers = mutableListOf<Provider<MappingBundle>>()
|
||||
internal val layers = mutableListOf<Provider<MappingBundle>>()
|
||||
fun add(mappings: Provider<MappingBundle>): LayerConfiguration {
|
||||
layers.add(mappings)
|
||||
return this
|
||||
|
|
|
@ -227,11 +227,11 @@ abstract class PhytotelmaGradleExtensionImpl @Inject constructor(
|
|||
val groupname = (group + "_" + name).replace(".", "_")
|
||||
val version = artifact.moduleVersion.id.version
|
||||
val classifier = artifact.classifier
|
||||
val remappedPath = targetPath.resolve(groupname).resolve(version).resolve(artifact.file.name)
|
||||
val remappedPath = targetPath.resolve(groupname).resolve(version).resolve(groupname+"-"+version+(classifier?.let { "-$it" }?:"")+".jar")
|
||||
remappedPath.createParentDirectories()
|
||||
remappedPaths.add(remappedPath)
|
||||
|
||||
val pom = remappedPath.resolveSibling(artifact.file.name.removeSuffix(".jar")+".pom")
|
||||
val pom = remappedPath.resolveSibling(remappedPath.fileName.toString().removeSuffix(".jar")+".pom")
|
||||
pom.writeText(
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
||||
"<project xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\" xmlns=\"http://maven.apache.org/POM/4.0.0\"\n" +
|
||||
|
@ -330,87 +330,4 @@ abstract class PhytotelmaGradleExtensionImpl @Inject constructor(
|
|||
}
|
||||
project.dependencies.add("modImplementation", "dev.frogmc:froglib:${conf.version!!}")
|
||||
}
|
||||
|
||||
|
||||
/*override fun minecraft(version: String, parchmentGameVersion: String?, parchmentVersion: String?) {
|
||||
|
||||
if (VersionChecker.validateVersion(version, offlineMode = getProject().gradle.startParameter.isOffline)) {
|
||||
println("Setting up Minecraft...")
|
||||
val parchmentGameVer = parchmentGameVersion?: version
|
||||
val parchment =
|
||||
parchmentVersion ?: kotlin.runCatching { ParchmentProvider.findForMinecraftVersion(parchmentGameVer) }
|
||||
.getOrDefault("")
|
||||
val projectData = ProjectStorage.get(getProject())
|
||||
projectData.minecraftVersion = version
|
||||
projectData.parchmentVersion = parchment
|
||||
println("Valid version! $version")
|
||||
val clientJar = VersionChecker.downloadClient(getProject(), version)
|
||||
val remappedJar =
|
||||
projectData.localCacheDir!!.resolve("net/minecraft/client/$version/client-$version-remapped.jar")
|
||||
remappedJar.createParentDirectories()
|
||||
projectData.remappedGameJarPath = remappedJar
|
||||
println("Time to setup Minecraft!")
|
||||
val applyAW = AccessWidener.needsUpdate(getProject())
|
||||
if (remappedJar.notExists() || applyAW) {
|
||||
println("Remapping the game...")
|
||||
val data = kotlin.runCatching {
|
||||
MojmapProvider.get(
|
||||
version,
|
||||
clientJar.resolveSibling("client-$version.txt")
|
||||
).orElseThrow().reverse()
|
||||
}.getOrNull()
|
||||
val paramMappings = if (parchment.isNotEmpty()) kotlin.runCatching {
|
||||
ParchmentProvider.getParchment(
|
||||
parchmentGameVer, parchment,
|
||||
PhytotelmaPlugin.globalCacheDir.resolve("org/parchmentmc/parchment/$parchmentGameVer/$parchment"),
|
||||
getProject().gradle.startParameter.isRefreshDependencies
|
||||
)
|
||||
}.getOrNull() else {
|
||||
println("Parameter mappings will not be present as no parchment version was found. It may be possible to declare it manually.")
|
||||
null
|
||||
}
|
||||
if (paramMappings == null && parchment.isNotEmpty()) {
|
||||
println("Parameter mappings will not be present as the version $parchmentVersion for minecraft version $parchmentGameVer could not be found")
|
||||
}
|
||||
if (data != null) {
|
||||
Thyroxine.remap(data.forNamespaces("official", "named"), clientJar, remappedJar, true, true)
|
||||
} else {
|
||||
error("Failed to remap the game as no mojmap version was found for game version $version. Other mapping formats may be implemented in the future.")
|
||||
}
|
||||
}
|
||||
println("Adding dependencies...")
|
||||
getProject().dependencies.add(
|
||||
Constants.MINECRAFT_CONFIGURATION,
|
||||
"net.minecrell:terminalconsoleappender:1.2.0"
|
||||
)
|
||||
VersionChecker.getDependencies(version) {
|
||||
getProject().dependencies.add(Constants.MINECRAFT_CONFIGURATION, it)
|
||||
}
|
||||
VersionChecker.savePomFile(version, remappedJar.parent)
|
||||
getProject().dependencies.add(Constants.MINECRAFT_CONFIGURATION, "net.minecraft:client:$version:remapped")
|
||||
|
||||
println("Generating run configurations...")
|
||||
RunConfigGenerator.generate(getProject())
|
||||
|
||||
if (applyAW) {
|
||||
getProject().afterEvaluate {
|
||||
println("Applying AccessWideners...")
|
||||
AccessWidener.apply(getProject(), remappedJar)
|
||||
}
|
||||
}
|
||||
|
||||
println("Done!")
|
||||
} else {
|
||||
println("Invalid version! $version")
|
||||
error("Invalid minecraft version provided: $version")
|
||||
}
|
||||
}
|
||||
|
||||
override fun loader(version: String) {
|
||||
getProject().dependencies.add("implementation", "dev.frogmc:frogloader:$version")
|
||||
}
|
||||
|
||||
override fun froglib(version: String) {
|
||||
getProject().dependencies.add("implementation", "dev.frogmc:froglib:$version")
|
||||
}*/
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue