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

Plugin

An MCDev Addon IntellJ Plugin can be installed from here which provides syntax highlighting and suggestions when using MixinSquared

Gradle

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

    // Mirror
    maven { url = "https://maven.enjarai.dev/mirrors" }
}

For each platform:

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

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.3.7-beta.1"))
    implementation(jarJar("com.github.bawnorton.mixinsquared:mixinsquared-forge:0.3.7-beta.1")) {
        jarJar.ranged(it, "[0.3.7-beta.1,)")
    }
}
NeoForge with NeoGradle
dependencies {
    compileOnly(annotationProcessor("com.github.bawnorton.mixinsquared:mixinsquared-common:0.3.7-beta.1"))
    implementation(jarJar("com.github.bawnorton.mixinsquared:mixinsquared-neoforge:0.3.7-beta.1")) {
        jarJar.ranged(it, "[0.3.7-beta.1,)")
    }
}
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.3.7-beta.1"))
    implementation(include("com.github.bawnorton.mixinsquared:mixinsquared-forge:0.3.7-beta.1"))
}
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.3.7-beta.1"))
}

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

To initialize MixinSquared yourself, implement a IMixinConfigPlugin and call

MixinSquaredBootstrap.init();
MixinSquaredApiImplLoader.load();

In the onLoad method and

MixinSquaredBootstrap.reOrderExtenstions();

In the getMixins method

It is necessary for MixinSquared's extensions to be applied before MixinExtra's extensions to avoid passing half-processed sugar annotations to the MixinAnnotationAdjuster

Credits

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