main
TestSelfRemapper
example mod that (ab)uses mixin to remap/patch itself at runtime
heavily based on https://github.com/wagyourtail/TestMultiModloader, but also rewritten to not use bytebuddy
how it works
- the entire thing is one class (in the
bootsource set, namedTransformer) - all the classes go through the mixin
IExtension- only classes with mixins targeting them will go through it though, so
inside the mixin (
IMixinConfigPlugin), we reflect back to get the map of class → mixin classes, and add the classes we want to patch to it (seegetTransformedClasses()) - this unfortunately doesn't work for mixins though (and we still want to patch those)
- so what we (sadly) have to do is replace the global mixin service with a custom one
that wraps the original one, but replaces the
IClassBytecodeProviderwith ours, so we can add the patched mixins to (seegetTransformedMixins())
- so what we (sadly) have to do is replace the global mixin service with a custom one
that wraps the original one, but replaces the
- only classes with mixins targeting them will go through it though, so
inside the mixin (
- it also loads the patches and manages applying them when given a
ClassNode - the patches are built inside
buildSrcin theMergedJartask
how to use
good luck lol
but you'll need https://github.com/prcraft-minecraft/class-diff in your mavenLocal because it never got released anywhere
Languages
Java
66.6%
Kotlin
33.4%