ago1024 / WurmClientModLauncher

ModLauncher and mods for WurmUnlimited client
26 stars 10 forks source link

postInit #2

Open ago1024 opened 8 years ago

ago1024 commented 8 years ago

Small issue/suggestion:

Currently if i try to use normal java reflection into wurm code in init or preInit - it causes the class to be properly loaded and frozen, which means javaassist can't modify it later if some other mod wants to do that.

What i'd suggest is adding another "step" - postInit and defining in documentation (i'm not sure if enforcing that in code would be possible) what mods should do in every initialization "step". Eg:

Pre - setup their own internal stuff
Init - add hooks and patch classes, no interaction with wurm classes in "normal" code
Post - wurm classes can be accessed from normal code, javaassist stuff is not allowed anymore
marad commented 7 years ago

This sounds cool. Would Post run after server connection is created? So that all the classes are initiated?

I understand that to do that know I need to use javaassist to hook my code in the right place?