Sheenus / Thaumcraft6EnhancedPatcher

Coremod patcher required for using Thaumcraft 6 Enhanced. Will not work server-side, for that patcher see Sheenus/Thaumcraft6EnhancedPatcherServer.
0 stars 0 forks source link

Crash with Thaumic Augmentation #1

Open Vapaman opened 3 years ago

Vapaman commented 3 years ago

Crash-log: crash-2021-03-23_20.29.52-client.txt

I think that compatibility with augmentation would be neat, since it is a must have with Thaumcraft 6 with thaumcrafts incomplete state.

Sheenus commented 3 years ago

This appears to be an incompatibility with the way our patchers work, but without tearing apart and testing both extensively together I can't even be 50% sure. What I am sure of though, is without tinkering with them, I don't think my mods will be compatible with Thaumic Augmentation. Which sucks, because there's a lot in Augmentation that makes TC6 feel complete, but I'll get around to it when I can.

Have you got the runtime log as well? That might help for me to look at too.

Vapaman commented 3 years ago

Sorry for late reply debug-5.log.gz Heres a runtime log. Hope it helps!

TheCodex6824 commented 1 year ago

The reason for the crash is that I have a patch to make the ISpecialArmor#getArmorDisplay implementation return 0, since that was the cause of the "double armor" armor bar display issue that confused many people. Since you completely delete that method in the class, my patch understandably fails. At some point in 2021 I marked that patch as being allowed to fail, so while it will still print a stack trace in the logs, the game won't crash anymore. If that isn't working for some reason, let me know and I'll try to see what's going on.

I suggest using targeted ASM patches instead of replacing entire classes in most situations to help prevent things like this from happening. Since ASM is a bit tricky to use, you could also opt to use Mixins instead for a more user-friendly version of what ASM provides.

Sheenus commented 1 year ago

The reason for the crash is that I have a patch to make the ISpecialArmor#getArmorDisplay implementation return 0, since that was the cause of the "double armor" armor bar display issue that confused many people. Since you completely delete that method in the class, my patch understandably fails. At some point in 2021 I marked that patch as being allowed to fail, so while it will still print a stack trace in the logs, the game won't crash anymore. If that isn't working for some reason, let me know and I'll try to see what's going on.

I suggest using targeted ASM patches instead of replacing entire classes in most situations to help prevent things like this from happening. Since ASM is a bit tricky to use, you could also opt to use Mixins instead for a more user-friendly version of what ASM provides.

I took a break from modifying the patcher late last year, because I wanted to learn how to write my own ASM patches, and it was unfortunately doing my head in. I might come back to it later, but I did start playing around with mixins, and that might be the way forward for the patcher in the future.

If I decide to continue with custom ASM patchers for this mod in the future, do you mind if I base them off of yours Codex? I was browsing the patchers you were using before I took a break and they seemed solid, and what I needed from a targeted ASM patcher. How did you learn to write them?

TheCodex6824 commented 1 year ago

If I decide to continue with custom ASM patchers for this mod in the future, do you mind if I base them off of yours Codex? I was browsing the patchers you were using before I took a break and they seemed solid, and what I needed from a targeted ASM patcher. How did you learn to write them?

For how to even get started registering the coremod and such, I had to look at other mods - some Forge devs really did not like people making coremods, so documentation on them is sparse, especially for older MC versions. For writing the bytecode, I use the bytecode outline eclipse plugin to look at the target code. I'm pretty sure intellij has something similar built-in.

Feel free to look at TA code for how to do this, but I would suggest looking at the newer transformers I have written like this one. The newer ones add instructions to an InsnList and then add the list all at once to the method instructions, rather than one at a time. To add instructions one at a time without changing the insertion index, they have to be added in reverse order, which the old transformers do - it's very confusing and why I stopped doing that when I figured out InsnList existed.

It's also worth noting that ASM has a visitor API that you can use instead of doing it the way I do. You would use class and method visitors to have ASM find your target method and instructions instead of looking for it manually like I do (and what a lot of TransformUtil is for). The main problem with the way I do it is that you have to be careful about indexing into the instructions list, and remember that adding things to that list might make any indices you have need to be shifted.