Skip to content

254nm/RtMixin

Repository files navigation

RtMixin is a JavaAgent that uses instrumentation to modify methods at runtime with a simple annotation system

How to depend on (Gradle KTS)

Plugins block

plugins {
    `java-library`
    id("com.github.johnrengelman.shadow") version "7.1.2"
}

Repositories block

repositories {
    mavenLocal()
    mavenCentral()
    maven { url = uri("https://repo.txmc.me/releases") }
}

Dependencies block

dependencies {
    implementation("me.txmc:rtmixin:1.5.2-BETA")
    if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
        compileOnly(files(org.gradle.internal.jvm.Jvm.current().toolsJar))
    }
}

jar / shadowJar block

It is recommended to use shadowJar in order to include RtMixin in the final jar

tasks.shadowJar {
    manifest {
        attributes(
            "Manifest-Version" to "1.0",
            "Main-Class" to "your.main.class",
            "Premain-Class" to "me.txmc.rtmixin.jagent.AgentMain",
            "Agent-Class" to "me.txmc.rtmixin.jagent.AgentMain",
            "Can-Redefine-Classes" to "true",
            "Can-Retransform-Classes" to "true",
            "Can-Set-Native-Method-Prefix" to "true"
        )
    }
    includeEmptyDirs = false
    minimize()
}