LlamaLad7 / MixinExtras

Companion library to SpongePowered Mixin with many custom injectors for a more expressive experience.
MIT License
304 stars 17 forks source link

Missing classes at runtime with forgegradle #14

Closed baileyholl closed 2 years ago

baileyholl commented 2 years ago

Hello, I am sure I am doing something dumb, but I am having trouble getting Mixinextras setup in forge gradle. Ive used normal implementation, implementation with fg.deobf, and shade extending implementation. Unfortunately with all of these, the jar files are missing at runtime, particularly the MixinExtrasBootstrap.init() during the mixinPlugin load, as well as mod constructor.

My branch for adding this project is here: https://github.com/baileyholl/Ars-Nouveau/pull/664/files Does anything look particularly out of place here?

Thank you!

baileyholl commented 2 years ago

Apparently forge will not include libraries by default during runtime if they are not marked as a game library.

Ive resolved this by adding the following to the build.gradle

configurations {
    library
}

// Used to manually add non-mc libraries to the runtime classpaths found in build/classpath
// If you have any module issues, check these files to make sure there are no duplicate dependencies
minecraft.runs.all {
    lazyToken('minecraft_classpath') {
        configurations.library.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator)
    }
}

dependencies {
    minecraft 'net.minecraftforge:forge:1.18.2-40.1.68'
    implementation 'org.jetbrains:annotations:23.0.0'
    shade fg.deobf("com.github.LlamaLad7:MixinExtras:0.0.12")
    library fg.deobf("com.github.LlamaLad7:MixinExtras:0.0.12")
    annotationProcessor("com.github.LlamaLad7:MixinExtras:0.0.12")
...
}