Annotation Type Pseudo
-
@Target(TYPE) @Retention(CLASS) public @interface PseudoA Mixin marked as @Pseudo is allowed to target classes which are not available at compile time and may not be available at runtime. This can be used in situations where - for one reason or another - a target class is not available to a project being compiled and would therefore fail AP verification. The target class is simulated by the AP using knowledge of only the superclass of the target (or at least, any available known superclass of the target. This means that certain restrictions apply:The superclass requirement for pseudo mixins is extremely important if the target has an obfuscated class in its hierarchy. For example let's assume that we're mixing into a class CustomGuiScreen from another party which extends GuiScreen, where GuiScreen is an obfuscated class. GuiScreen contains an obfuscated method initGui which the (@Pseudo) target class overrides. Attempting to inject into initGui would succeed at dev time but would fail at production time, because the reference is obfuscated. Normally when a target overrides an obfuscated method in this way, the AP can resolve the obfuscation by walking the superclass hierarchy of the target in order to discover a mapping. However when the target is not available at compile time the AP cannot do this and must rely on only information from the mixin itself. We can overcome this problem by ensuring the mixin inherits from the same superclass (or at least a superclass which contains the obfuscated methods or fields used in the mixin), thus allowing our example initGui method to be resolved in the superclass hierarchy. This behaviour is not available to normal mixins as the AP always resolves the hierarchy via the target class metadata when it is available.
If the target class contains obfuscated methods which the mixin needs to
OverwriteorShadowwhich are not inherited from a superclass (eg. the target is obfuscated), theOverwriteorShadowmust be decorated manually with aliases since there is no mechanism for the AP to resolve the mappings automatically.