PSA: Plugin Provided Mixins

With Forge having native support for “core-mods”, we found it fitting to allow plugins to provide mixins when using SpongeVanilla. Now, it is possible! Plugins that provide mixins through normal means can have their mixins loaded by SpongeVanilla.

What does this mean really? It means that if a server administrator focuses solely on SpongeVanilla for vanilla features (no intentions of using forge or content adding mods), it’s possible now to provide as many modifications to the game as deemed fit. I’m sure the docs will be written up soon on how to take advantage of this system, or perhaps @minecrell might document it.


Very cool! I have to see how this can be useful.

Would it be technically possible to support the exact same way to use mixins as in SpongeVanilla in SpongeForge? Now, a plugin would depend on SpongeVanilla and wouldn’t be compatible with SpongeForge. So is this feature rather for custom internal use on large servers?

Much the same applies for Mixins targetting SV and SF as does for SpongeCommon and SpongeVanilla and SpongeForge project mixins.

Basically, as long as your mixin targets code which is the same in both codebases, there’s no changes required. However if code is different between forge and vanilla then you just need to either:

  • Provide two mixins (one for each environment), supply a companion plugin with your mixin set to select the right one based on the environment, or.
  • Make your mixin adaptable, for example using injections with a defined injector group or surrogates for failover.
1 Like

Okay. I mean, could Sponge Forge load this “new type” of plugin like Sponge Vanilla now can? As I understand it, it would be only possible using a core mod to achieve the same behavior as in Sponge Vanilla.

Just add a couple keys to the JAR manifest:

Tweak-Class: org.spongepowered.asm.launch.MixinTweaker
MixinConfigs: mixins.myplugin.json

They will be detected automatically by Forge, and as long as the tweaker class matches, they will also be respected by SpongeVanilla.

1 Like

You missed the most important point. With FML you must include the FMLCorePluginContainsFMLMod directive as well, otherwise your mod jar will never be submitted for mod candidacy after the tweaker is consumed.

1 Like

um… where can i find sources for deobfuscated nms mapping?

As long as you have your Gradle script set up to use NMS, just run gradle setupDecompWorkspace, then update your IDE project and the sources should be attached.

I have been trying to get this working on 1.10.2 but nope :frowning::

Error:Could not GET ''. Received status code 403 from server: Forbidden


I don’t understand how the 1.9.4 works but 1.10.2 doesn’t :confused:.

You need to run gradle setupDecompWorkspace before doing anything with the Gradle project.

Figured it out, somehow spongestart is messing it up.

Note that in many cases (e.g. when you use @Shadow or call net.minecraft classes), simply using the jar task won’t work. You should instead use the build task (which uses reobfJar). Otherwise, your mixins will break when you try to use them on the obfuscated server.