Skip to content

Bawnorton/MixinSquared

Repository files navigation

MixinSquared Logo

A Mixin library for mixin'ing into other mod's mixins.

See the wiki for usage

Works with MixinExtras

Gradle

repositories {
    maven { url = "https://maven.bawnorton.com/releases" }
}

For each platform:

Fabric / Quilt
dependencies {
    include(implementation(annotationProcessor("com.github.bawnorton.mixinsquared:mixinsquared-fabric:0.2.0")))
}
Forge 1.18.2+ with ForgeGradle

This will not work for Forge 1.18.1 and below, see Any Other Platform

dependencies {
    // MixinSquared's annotationProcessor MUST be registered BEFORE Mixin's one.
    compileOnly(annotationProcessor("com.github.bawnorton.mixinsquared:mixinsquared-common:0.2.0"))
    implementation(jarJar("com.github.bawnorton.mixinsquared:mixinsquared-forge:0.2.0")) {
        jarJar.ranged(it, "[0.2.0,)")
    }
}
NeoForge with NeoGradle
dependencies {
    // MixinSquared's annotationProcessor MUST be registered BEFORE Mixin's one.
    compileOnly(annotationProcessor("com.github.bawnorton.mixinsquared:mixinsquared-common:0.2.0"))
    implementation(jarJar("com.github.bawnorton.mixinsquared:mixinsquared-neoforge:0.2.0")) {
        jarJar.ranged(it, "[0.2.0,)")
    }
}
Forge 1.18.2+ with Architectury Loom

This will not work for Forge 1.18.1 and below, see Any Other Platform

dependencies {
    compileOnly(annotationProcessor("com.github.bawnorton.mixinsquared:mixinsquared-common:0.2.0"))
    implementation(include("com.github.bawnorton.mixinsquared:mixinsquared-forge:0.2.0"))
}
Any Other Platform

This is only a rough guide. You will need to look into the specifics of setting up ShadowJar for your platform.

plugins {
    id "com.github.johnrengelman.shadow" version "8.1.0"
}

configurations {
    implementation.extendsFrom shadow
}

repositories {
    maven { url = "https://maven.bawnorton.com" }
}

dependencies {
    shadow(annotationProcessor("com.github.bawnorton.mixinsquared:mixinsquared-common:0.2.0"))
}

shadowJar {
    configurations = [project.configurations.shadow]
    relocate("com.github.bawnorton.mixinsquared", "your.package.goes.here.mixinsquared")
    mergeServiceFiles()
}

To initialize MixinSquared, simply call

MixinSquaredBootstrap.init();

In the onLoad method inside a IMixinConfigPlugin

⚠️ Warning ⚠️

If you are also using MixinExtras, ensure that MixinSquared's init is called after MixinExtras' init.

Credits

Massive thanks to LlamaLad7 for providing insight and feedback on this library.