MixinExtras
这是 Mixin 的一个小型配套库,旨在帮助您以更具表现力和兼容性的方式编写 Mixin。
有关提供的每个功能的更多信息可以在 Wiki 中找到。
此模组通常已被模组加载器自身或被其它模组 Jar-in-Jar 包含,一般无需单独安装。
如果需要下载,请前往相关链接的Maven链接下载。
设置
MixinExtras 可在 Maven Central 上使用。
设置步骤因平台而异:
Fabric 或 Quilt
Fabric Loader 自 0.15.0 版本起,Quilt Loader 自 0.23.0 版本起已经包含了 MixinExtras。
dependencies {
include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:0.2.2")))
}使用 NeoGradle 的 NeoForge
NeoForge自 20.2.84-beta 版本已经包含了 MixinExtras。
如果要保持与旧版本的兼容性,或者想要使用与提供的版本不同的版本,请参见下文:
jarJar.enable()
dependencies {
implementation(jarJar("io.github.llamalad7:mixinextras-neoforge:0.3.2")) {
jarJar.ranged(it, "[0.3.2,)")
}
}
tasks.named('build').configure { dependsOn('jarJar') }
使用 ForgeGradle 的 Forge 1.18.2+
dependencies {
implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:0.2.0"))
implementation(jarJar("io.github.llamalad7:mixinextras-forge:0.2.0")) {
jarJar.ranged(it, "[0.2.0,)")
}
}使用 Architectury Loom 的 Forge 1.18.2+
dependencies {
implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:0.2.0"))
implementation(include("io.github.llamalad7:mixinextras-forge:0.2.0"))
}其他平台
这只是一个粗略的指南。您需要了解为您的平台设置 ShadowJar 的细节。
plugins {
id "com.github.johnrengelman.shadow" version "8.1.0"
}
configurations {
implementation.extendsFrom shadow
}
dependencies {
shadow(annotationProcessor("io.github.llamalad7:mixinextras-common:0.2.0"))
}
shadowJar {
configurations = [project.configurations.shadow]
relocate("com.llamalad7.mixinextras", "your.package.goes.here.mixinextras")
mergeServiceFiles() // Very important!
}除此之外,部分 Mixin 前置模组,如 1.12.2 的 MixinBooter,以及 1.7.10 的 UniMixins 也已经包括 MixinExtras。
初始化
如果您使用的是 Fabric、Quilt 或 Forge 1.18.2+,则可以跳过此部分。请务必按照上面的步骤操作。
要初始化 MixinExtras,只需调用
MixinExtrasBootstrap.init();
适当的早一点。在几乎所有情况下,都建议制作一个 IMixinConfigPlugin,并在其 onLoad 方法中初始化 MixinExtras。