MixinExtras Documentation

repository·master·Indexed 19 days ago

https://github.com/llamalad7/mixinextras

A companion library for Mixin providing more expressive and compatible ways to write Mixins. Includes installation guides for Fabric, Quilt, NeoForge, and Forge (1.18.2+), as well as instructions for ShadowJar bundling and initialization via MixinExtrasBootstrap.init().

Tokens
954
Snippets
5
Records
5
Agent score
16%

What's inside MixinExtras

  1. Install MixinExtras on Fabric or Quilt

    master

    FabricLoader 0.15.0+ includes MixinExtras by default. If you need to support older versions or require a specific version, use the following Gradle configuration. Note that you should use annotationProcessor for the fabric-specific artifact.

    dependencies {
        include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:0.5.4")))
    }
  2. Install MixinExtras on other platforms using ShadowJar

    master

    For platforms not listed above, you can use ShadowJar to bundle the mixinextras-common artifact. It is critical to relocate the package to avoid conflicts and call mergeServiceFiles() in your shadowJar configuration.

    plugins {
        id "com.github.johnrengelman.shadow" version "8.1.0"
    }
    
    configurations {
        implementation.extendsFrom shadow
    }
    
    dependencies {
        shadow(annotationProcessor("io.github.llamalad7:mixinextras-common:0.5.4"))
    }
    
    shadowJar {
        configurations = [project.configurations.shadow]
        relocate("com.llamalad7.mixinextras", "your.package.goes.here.mixinextras")
        mergeServiceFiles() // Very important!
    }
  3. Install MixinExtras on Forge (1.18.2+)

    master

    For Forge 1.18.2+, you must provide both the mixinextras-common artifact via annotationProcessor for compilation and the mixinextras-forge artifact via jarJar or include for runtime. Use the -all jar when bundling MixinExtras yourself.

    // Using ForgeGradle
    dependencies {
        compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:0.5.4"))
        implementation(jarJar("io.github.llamalad7:mixinextras-forge:0.5.4")) {
            jarJar.ranged(it, "[0.5.4,")
        }
    }
    
    // Using Architectury Loom
    dependencies {
        compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:0.5.4"))
        implementation(include("io.github.llamalad7:mixinextras-forge:0.5.4"))
    }
  4. Install MixinExtras on NeoForge

    master

    NeoForge 20.2.84+ includes MixinExtras by default. To use a specific version or maintain compatibility with older versions, use jarJar with the mixinextras-neoforge artifact.

    // Using ModDevGradle
    dependencies {
        implementation(jarJar("io.github.llamalad7:mixinextras-neoforge:0.5.4"))
    }
    
    // Using NeoGradle
    dependencies {
        implementation(jarJar("io.github.llamalad7:mixinextras-neoforge:0.5.4")) {
            jarJar.ranged(it, "[0.5.4,")
        }
    }
  5. Initialize MixinExtras

    master

    To enable MixinExtras features, you must call MixinExtrasBootstrap.init() early in the application lifecycle. The recommended way to do this is within the onLoad method of an IMixinConfigPlugin implementation.

    MixinExtrasBootstrap.init();