Open mineLdiver opened 10 months ago
A better approach would probably be analysing the entrypoint classes with SpASM and replacing calls to Null.get()
with initialization of the objects required by the class.
However, this won't work with @Entrypoint.Instance
static final fields, as the instance is created by Fabric way after the class has initialized. @Entrypoint.Namespace
fields won't work either, as we have no way of getting the mod container from a class during its transformation by SpASM.
Since all reflection is refactored to use method handles, StAPI's reflection trick to replace final fields no longer works. This can probably be fixed by using Unsafe instead.
Using Unsafe as a replacement is nonsense too thanks to JEP 8323072.
Well, can still resort to SpASM - by either removing the final modifier from the field's bytecode itself, or generating an initializer.
There's also a cursed approach that involves generating a constructor with SpASM and invoking that through hacky means on an already instantiated object to overwrite values in instance final fields, but that might have already been patched in later Java versions.
https://openjdk.org/jeps/416
Since all reflection is refactored to use method handles, StAPI's reflection trick to replace final fields no longer works. This can probably be fixed by using Unsafe instead.