Remove architectury-loom 0.7.4 compatibility since it is useless with Minecraft 1.18.x

Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
Username404 2022-03-26 00:47:38 +01:00
parent 7252c637b9
commit 058a400fab
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 6 additions and 23 deletions

View File

@ -20,9 +20,7 @@ plugins {
id("architectury-plugin") version "[3.4.124, 3.5["
id("dev.architectury.loom") version (
JavaVersion.current().let { version ->
if (version >= JavaVersion.VERSION_16)
"[0.10.0, ${if (version.isCompatibleWith(JavaVersion.VERSION_17)) "0.12.1" else "0.10.1"}["
else "[0.7.4, 0.7.4.200["
}
) apply false
id("com.github.ben-manes.versions") version "0.42.0"
@ -62,26 +60,11 @@ subprojects {
}
silentMojangMappingsLicense()
val refmap = "snowygui-${project.name}-refmap.json"
// The following is used to make this buildscript compatible with architectury-loom 0.7.3, 0.9.X, 0.10.X and higher versions
with(javaClass) {
val loomMajorRelease = LoomGradlePlugin.LOOM_VERSION.run {
val numberPos = indexOf('.') + 1
substring(numberPos, indexOf('.', numberPos))
}.toShort()
if (loomMajorRelease < 10) {
if (loomMajorRelease < 9) getField("refmapName").set(this@configure, refmap)
else getMethod("setRefmapName", String::class.java).invoke(this@configure, refmap)
getMethod("mixinConfig", Array<String>::class.java).invoke(this@configure, arrayOf("snowygui-${project.name}.mixins.json"))
} else {
getDeclaredMethod("getMixin").invoke(this@configure).run {
javaClass.getDeclaredMethod("getDefaultRefmapName").invoke(this).let { refmapProperty ->
refmapProperty.javaClass.getDeclaredMethod("set", Any::class.java).invoke(refmapProperty, refmap)
}
mixin {
defaultRefmapName.set(refmap)
if (isForge) {
this@with.getDeclaredMethod("getForge").invoke(this@configure).let { forgeObject ->
forgeObject.javaClass.getMethod("mixinConfigs", Array<String>::class.java).invoke(forgeObject, arrayOf("snowygui-common.mixins.json", "snowygui-forge.mixins.json"))
}
}
forge {
mixinConfigs("snowygui-common.mixins.json", "snowygui-forge.mixins.json")
}
}
}