Class LilleroMixinPlugin

  • All Implemented Interfaces:
    org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin

    public abstract class LilleroMixinPlugin
    extends java.lang.Object
    implements org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin
    Allows you to load your mod's Lillero patches as a Mixin plugin. Extend this class and specify the child as a plugin in your mod's Mixin config. Refer to your mod loader's instructions for details on how this is done. Methods are left non-final in case you want to alter their behaviour in any way, but I can't really see any merit in doing so.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static org.apache.logging.log4j.Logger LOGGER
      The Logger used by this library.
    • Constructor Summary

      Constructors 
      Constructor Description
      LilleroMixinPlugin​(boolean precedence)
      The constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void acceptTargets​(java.util.Set<java.lang.String> myTargets, java.util.Set<java.lang.String> otherTargets)
      Does nothing, as we don't need to alter the target class list.
      protected void applyLilleroPatches​(java.lang.String className, org.objectweb.asm.tree.ClassNode clazz)
      Applies the appropriate Lillero patches given a node and a class name.
      java.util.List<java.lang.String> getMixins()
      This does not apply any additional mixins.
      java.lang.String getRefMapperConfig()
      Returns null, so it's effectively ignored.
      void onLoad​(java.lang.String mixinPackage)
      Called after the plugin is instantiated, do any setup here.
      void postApply​(java.lang.String className, org.objectweb.asm.tree.ClassNode clazz, java.lang.String mixinClassName, org.spongepowered.asm.mixin.extensibility.IMixinInfo mixinInfo)
      Called immediately after a mixin is applied to a target class.
      void preApply​(java.lang.String className, org.objectweb.asm.tree.ClassNode clazz, java.lang.String mixinClassName, org.spongepowered.asm.mixin.extensibility.IMixinInfo mixinInfo)
      Called immediately before a mixin is applied to a target class.
      boolean shouldApplyMixin​(java.lang.String targetClassName, java.lang.String mixinClassName)
      Tells Mixin to always apply these patches.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOGGER

        protected static final org.apache.logging.log4j.Logger LOGGER
        The Logger used by this library.
    • Constructor Detail

      • LilleroMixinPlugin

        public LilleroMixinPlugin​(boolean precedence)
        The constructor.
        Parameters:
        precedence - whether Lillero should take precedence over regular mixins
    • Method Detail

      • onLoad

        public void onLoad​(java.lang.String mixinPackage)
        Called after the plugin is instantiated, do any setup here.
        Specified by:
        onLoad in interface org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin
        Parameters:
        mixinPackage - The mixin root package from the config
      • getRefMapperConfig

        public java.lang.String getRefMapperConfig()
        Returns null, so it's effectively ignored.
        Specified by:
        getRefMapperConfig in interface org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin
        Returns:
        always null
      • shouldApplyMixin

        public boolean shouldApplyMixin​(java.lang.String targetClassName,
                                        java.lang.String mixinClassName)
        Tells Mixin to always apply these patches. Lillero doesn't support conditional patches: any check should happen within the patch code itself, with the patch code's scope.
        Specified by:
        shouldApplyMixin in interface org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin
        Parameters:
        targetClassName - fully qualified class name of the target class
        mixinClassName - fully qualified class name of the mixin
        Returns:
        always true
      • acceptTargets

        public void acceptTargets​(java.util.Set<java.lang.String> myTargets,
                                  java.util.Set<java.lang.String> otherTargets)
        Does nothing, as we don't need to alter the target class list.
        Specified by:
        acceptTargets in interface org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin
        Parameters:
        myTargets - target class set from the companion config
        otherTargets - target class set incorporating targets from all other configs, read-only
      • getMixins

        public java.util.List<java.lang.String> getMixins()
        This does not apply any additional mixins.
        Specified by:
        getMixins in interface org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin
        Returns:
        always null
      • preApply

        public void preApply​(java.lang.String className,
                             org.objectweb.asm.tree.ClassNode clazz,
                             java.lang.String mixinClassName,
                             org.spongepowered.asm.mixin.extensibility.IMixinInfo mixinInfo)
        Called immediately before a mixin is applied to a target class. Will apply Lillero patches if precedence is true.
        Specified by:
        preApply in interface org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin
        Parameters:
        className - transformed name of the target class
        clazz - target class tree
        mixinClassName - name of the mixin class
        mixinInfo - information about this mixin
      • postApply

        public void postApply​(java.lang.String className,
                              org.objectweb.asm.tree.ClassNode clazz,
                              java.lang.String mixinClassName,
                              org.spongepowered.asm.mixin.extensibility.IMixinInfo mixinInfo)
        Called immediately after a mixin is applied to a target class. Will apply Lillero patches if precedence is false.
        Specified by:
        postApply in interface org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin
        Parameters:
        className - transformed name of the target class
        clazz - target class tree
        mixinClassName - name of the mixin class
        mixinInfo - information about this mixin
      • applyLilleroPatches

        protected void applyLilleroPatches​(java.lang.String className,
                                           org.objectweb.asm.tree.ClassNode clazz)
        Applies the appropriate Lillero patches given a node and a class name.
        Parameters:
        className - the class' fully qualified name
        clazz - the target class