Skip to content

Mixin AP resolves incorrect target class for method reference #93

@stephan-gh

Description

@stephan-gh

Note: This is closely related to #33 which seems to have broken in the latest Mixin builds.

Basically in SpongeVanilla there are quite a few injections where Minecraft code is calling the methods on the current class (e.g. DedicatedServer.loadAllWorlds instead of MinecraftServer.loadAllWorlds) even though the method is only defined in one of the super classes. We fixed this back then by just looking into the hierarchy for finding the appropriate obfuscation mapping for the injections.

As far as I can tell this is generally still working fine, there is no problem with finding the actual method mapping. However, when writing to the refmap, instead of keeping the original defined target of the method call (e.g. here DedicatedServer) Mixin replaces the target owner of the method call with the owner defined in the mapping (MinecraftServer), so the injection will never match in production.

Here is an example:

Lnet/minecraft/server/dedicated/DedicatedServer;loadAllWorlds(Ljava/lang/String;Ljava/lang/String;JLnet/minecraft/world/WorldType;Ljava/lang/String;)V

Gets obfuscated to the refmap as:

Lnet/minecraft/server/MinecraftServer;func_71247_a(Ljava/lang/String;Ljava/lang/String;JLnet/minecraft/world/WorldType;Ljava/lang/String;)V

... instead of keeping the target owner of the method call which will prevent the injection from ever being successful in production.

For now I have fixed it by doing the obfuscation manually and setting the correct injection target owner class, however it would be nice if we could get that somehow working again (it broke some other parts in SpongeVanilla too).

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions