SpongePowered / Mixin

Mixin is a trait/mixin and bytecode weaving framework for Java using ASM
MIT License
1.41k stars 194 forks source link

Cannot modify Mod while modifying Vanilia Game / Forge 1.12.2 #509

Closed ikexing-cn closed 3 years ago

ikexing-cn commented 3 years ago

After I tried modifying the vanilla game, I found that my modifications to the mod as per JEID did not work. runtime "curse.maven:mixin-booter-419286:3321174" But when I relied on one of the other mod containing Mixin, I was surprised to find that it worked again...

My code: https://github.com/ikexing-cn/RandomTweaker

So, can anyone tell me what happen?

Aizistral commented 3 years ago

By briefly looking through your code, my guess is that you load your mod-targeting configuration at improper time. Though without logs of error you got I can't say for sure.

My advise - use Grimoire for implementing mixins on 1.12.2: https://github.com/CrucibleMC/Grimoire

Among everything else, we have taken care of supporting mod-targeting configurations.

ikexing-cn commented 3 years ago

By briefly looking through your code, my guess is that you load your mod-targeting configuration at improper time. Though without logs of error you got I can't say for sure.

My advise - use Grimoire for implementing mixins on 1.12.2: https://github.com/CrucibleMC/Grimoire

Among everything else, we have taken care of supporting mod-targeting configurations.

Thanks for your advice

It's a better choice, but I'm still confused about it, why I introduced a new contain Mixin mod and it worked again?

This has been tormenting me for a long time and I want an answer.

Aizistral commented 3 years ago

Most likely because that other mod re-applies configurations from last Mixin loading phase, and/or adds all mod files to classpath before your inject loads your mod-targeting configuration. Again, I don't know what mod in particular you have this with, and what was the error log without it, if it was at all, so I can't tell for sure.

ikexing-cn commented 3 years ago

Most likely because that other mod re-applies configurations from last Mixin loading phase, and/or adds all mod files to classpath before your inject loads your mod-targeting configuration. Again, I don't know what mod in particular you have this with, and what was the error log without it, if it was at all, so I can't tell for sure.

Sorry, that was an oversight on my part.

I have uploaded two logs, the first one contains MixinBooter.

https://paste.ubuntu.com/p/4CVwVpFsMc/

https://paste.ubuntu.com/p/C5495KrXjP/

Thank you for you help.

ikexing-cn commented 3 years ago

The mod I used can be any contains mixin, I tried JEID, VanillaFix and MixinBooter and all loaded normally.

Aizistral commented 3 years ago

Indeed looks like MixinBooter is a more primitive and less skilfully executed version of what Grimoire is. It also re-applies configurations from default phase, which just so conveniently happens after you add one that targets another mod. On your own, however, your mod doesn't do that, so configuration you add at that time never ends up being applied.

ikexing-cn commented 3 years ago

Indeed looks like MixinBooter is a more primitive and less skilfully executed version of what Grimoire is. It also re-applies configurations from default phase, which just so conveniently happens after you add one that targets another mod. On your own, however, your mod doesn't do that, so configuration you add at that time never ends up being applied.

hmmm... So, is there anything I can do...?

Aizistral commented 3 years ago

Yes. Follow my advise and relay the burden of loading your configurations to Grimoire. Alternatively, you could of course try to make something similar to what all those other mods do, but having every mod shading its own copy of Mixin and forcing configurations to reapply one extra time is no good practice.

ikexing-cn commented 3 years ago

Yes. Follow my advise and relay the burden of loading your configurations to Grimoire. Alternatively, you could of course try to make something similar to what all those other mods do, but having every mod shading its own copy of Mixin and forcing configurations to reapply one extra time is no good practice.

okay, thanks.

Mumfrey commented 3 years ago

This issue tracker is for bugs and feature requests, please use discord for support questions.