idk
This commit is contained in:
commit
a517969a28
1072 files changed
+160209
No files matched your search
@@ -0,0 +1,117 @@
|
||||
plugins {
|
||||
java
|
||||
id("io.papermc.paperweight.userdev") version "2.0.0-beta.24" apply false
|
||||
}
|
||||
|
||||
group = "com.ticxo.modelengine"
|
||||
version = "R4.2.0"
|
||||
|
||||
// Minecraft version and Java level for each NMS adapter module.
|
||||
val nms = mapOf(
|
||||
"v1_19_R3" to ("1.19.4-R0.1-SNAPSHOT" to 17),
|
||||
"v1_20_R1" to ("1.20.1-R0.1-SNAPSHOT" to 17),
|
||||
"v1_20_R2" to ("1.20.2-R0.1-SNAPSHOT" to 17),
|
||||
"v1_20_R3" to ("1.20.4-R0.1-SNAPSHOT" to 17),
|
||||
"v1_20_R4" to ("1.20.6-R0.1-SNAPSHOT" to 21),
|
||||
"v1_21_R1" to ("1.21.1-R0.1-SNAPSHOT" to 21),
|
||||
"v1_21_R2" to ("1.21.3-R0.1-SNAPSHOT" to 21),
|
||||
"v1_21_R3" to ("1.21.4-R0.1-SNAPSHOT" to 21),
|
||||
"v1_21_R4" to ("1.21.5-R0.1-SNAPSHOT" to 21),
|
||||
"v1_21_R5" to ("1.21.8-R0.1-SNAPSHOT" to 21),
|
||||
"v1_21_R6" to ("1.21.10-R0.1-SNAPSHOT" to 21),
|
||||
"v1_21_R7" to ("1.21.11-R0.1-SNAPSHOT" to 21),
|
||||
"v26_1" to ("26.1.2.build.74-stable" to 25),
|
||||
"v26_2" to ("26.2.build.135-stable" to 25),
|
||||
"v26_3" to ("26.3.build.258-stable" to 25),
|
||||
)
|
||||
|
||||
// Paper ran Spigot-mapped before 1.20.5 and does not remap plugins there, so these
|
||||
// adapters ship reobfuscated to Spigot names; newer ones ship Mojang-mapped.
|
||||
val spigotMapped = setOf("v1_19_R3", "v1_20_R1", "v1_20_R2", "v1_20_R3")
|
||||
|
||||
val javaLevel = mapOf("api" to 17, "core" to 17, "core21" to 21, "core25" to 25) +
|
||||
nms.mapValues { it.value.second }
|
||||
|
||||
configure(subprojects.filter { it.name in javaLevel }) {
|
||||
apply(plugin = "java-library")
|
||||
group = rootProject.group
|
||||
version = rootProject.version
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
maven("https://mvn.lumine.io/repository/maven-public/")
|
||||
maven("https://maven.citizensnpcs.co/repo")
|
||||
maven("https://mvn.lib.co.nz/public")
|
||||
maven("https://repo.viaversion.com")
|
||||
maven("https://libraries.minecraft.net")
|
||||
}
|
||||
|
||||
// Java 17 modules are compiled with a JDK 21 toolchain targeting 17 bytecode,
|
||||
// so they can read dependencies published as Java 21 class files.
|
||||
val level = javaLevel.getValue(name)
|
||||
extensions.configure<JavaPluginExtension> {
|
||||
// NMS modules use their exact Java level: old dev bundles only patch cleanly
|
||||
// when Minecraft is decompiled on the JDK they were made with.
|
||||
toolchain.languageVersion.set(JavaLanguageVersion.of(if (name in nms) level else maxOf(level, 21)))
|
||||
}
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
options.encoding = "UTF-8"
|
||||
if (level >= 21) options.release.set(level)
|
||||
else { sourceCompatibility = "$level"; targetCompatibility = "$level" }
|
||||
options.compilerArgs.addAll(listOf("-Xlint:none", "-nowarn", "-Xmaxerrs", "2000"))
|
||||
}
|
||||
|
||||
nms[name]?.let { (bundle, _) ->
|
||||
apply(plugin = "io.papermc.paperweight.userdev")
|
||||
(dependencies as ExtensionAware).extensions
|
||||
.getByType<io.papermc.paperweight.userdev.PaperweightUserDependenciesExtension>()
|
||||
.paperDevBundle(bundle)
|
||||
dependencies {
|
||||
"compileOnly"(project(":api"))
|
||||
}
|
||||
extensions.configure<io.papermc.paperweight.userdev.PaperweightUserExtension> {
|
||||
reobfArtifactConfiguration.set(
|
||||
if (name in spigotMapped) io.papermc.paperweight.userdev.ReobfArtifactConfiguration.REOBF_PRODUCTION
|
||||
else io.papermc.paperweight.userdev.ReobfArtifactConfiguration.MOJANG_PRODUCTION
|
||||
)
|
||||
javaLauncher.set(the<JavaToolchainService>().launcherFor {
|
||||
languageVersion.set(JavaLanguageVersion.of(maxOf(nms.getValue(name).second, 21)))
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Final plugin jar: every module's classes, core resources, and the shaded jsoup/MineSkin libraries.
|
||||
repositories { mavenCentral() }
|
||||
val shaded by configurations.creating
|
||||
dependencies {
|
||||
shaded("org.jsoup:jsoup:1.17.2") { isTransitive = false }
|
||||
shaded(files("libs/mineskin-java-client-3.2.1-SNAPSHOT.jar"))
|
||||
}
|
||||
|
||||
tasks.register<Jar>("pluginJar") {
|
||||
group = "build"
|
||||
description = "Assembles the complete ModelEngine plugin jar."
|
||||
archiveBaseName.set("ModelEngine")
|
||||
archiveVersion.set(version.toString())
|
||||
destinationDirectory.set(layout.buildDirectory.dir("libs"))
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
manifest {
|
||||
attributes("paperweight-mappings-namespace" to "mojang", "Multi-Release" to "true")
|
||||
}
|
||||
subprojects.filter { it.name in javaLevel }.forEach { p ->
|
||||
if (p.name in spigotMapped) {
|
||||
from(p.tasks.named<io.papermc.paperweight.tasks.RemapJar>("reobfJar").flatMap { it.outputJar }.map { zipTree(it) }) {
|
||||
exclude("META-INF/MANIFEST.MF")
|
||||
}
|
||||
} else {
|
||||
from(p.extensions.getByType<SourceSetContainer>()["main"].output)
|
||||
}
|
||||
}
|
||||
from(shaded.map { zipTree(it) }) {
|
||||
exclude("META-INF/MANIFEST.MF", "META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA", "**/module-info.class")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("build") { dependsOn("pluginJar") }
|
||||
Reference in new issue
Block a user