I’m trying to use the FTB Unstable modpack (with the client mods removed, obviously) on Forge Server 1732 and the server is crashing with SpongeForge in the mods folder.
Just guessing here. But I think a mod also manipulated the code, and sponge (aka mixins) got confused. The only way to fix this would possible altering the injection code, so it doesn’t get confused .
Well only coremods can modify the bytecode at runtime.
As far I can see only these mods are coremods, but that doesn’t exactly mean that they alter the code.
DynamicSurroundings-1.8.9-2.0.3.2.jar
FastLeafDecay-1.8-1.6.jar
hopperducts-mc1.8.8-1.4.6.jar
RandomThings-MC1.8.9-3.6.2.jar
Thaumcraft-1.8.9-5.1.6.jar
ThaumicInfusion-1.8.9-4.8.jar
Altrough this line:
[08:38:33] [main/INFO] [TI Transformer/]: Thaumic Infusion has detected an Obfuscated environment!
Gives away a clue that Thaumic infusion is altering the code.
Yes. Dynamic Surroundings injects code into World for hooking weather effects. The transform hook can be found here. To sum up it guts the World method and redirects to a static method within the Dynamic Surroundings mod. Short of gutting a feature out of the mod I am unsure how to fix. Any suggestions from the Sponge side of things?
The mod developer simply injects a return after his method and doesn’t clear out the rest of the method itself (Mixins does have this capability and Sponge uses it in a few places to avoid incompatibilities with other mods)
Sponge can perform force checks when setThundering(Z) or setRaining(Z) is called instead of trying to hook into the current method (it’d be a workaround from us, but it’s not opportune imo)
The mod developer can rewrite his transformer to use Mixins and write an injection at HEAD that is cancellable = true and call the sponge related method if Sponge is installed to ensure our API doesn’t break.
A few other ideas are possible, but the way his transformer is just dumping a method entirely is definitely the problem here.
If Forge didn’t support mixins in 1.8.9, then SpongeForge wouldn’t be on 1.8.9 ;). Adding mixins is actually quite easy as exemplified here. What I was mentioning for injecting and cancelling a return would be similar to this. Hell, to call the sponge related methods, you could very well even write a MixinPlugin that will optionally add a mixin to whatever class you need (I’m guessing WorldHandler in this case) to call the org.spongepowered.api.world.World methods) which guarantees SpongeAPI plugins don’t end up breaking (and we can throw the proper events regardless).
I wonder wouldn’t coremods benefit from using mixins instead? Than we are sure they are 100% sponge compatible. Of Course that wouldn’t work if the mixintweaker can only support 1 mixin / class. I vote for mixins in forge .
Sadly enough it only works on coremods tho . I did something similar with mixins here. And had to convert normal mods to coremods.
Sure, while mixins only work on core mods, that’s what multiphase is targeting for. When it’s completed, Mixins will be able to target non-core mods as well.
Most core mods would benefit from using Mixins, but it’s ultimately up to the mod developer to invest the time to rewrite their transformer code to use Mixins.
FYI - doing the quick fix for the next release of Dynamic Surroundings 1.8.9-2.0.4.10 (i.e. inserting the code at the top without removing the rest of the method body). For the next major release cycle I plan on trying out the Mixin library.
It’s nice to meet a mod author as productive as yourself. Most of the time when I report an issue like this, the author just blames other people and never fixes the issue, or takes a year to do so