### APIDOC: MethodVisitorEx Constructor Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/util/asm/MethodVisitorEx Documents the constructor for `MethodVisitorEx`. This constructor initializes the visitor by wrapping an existing `MethodVisitor` instance. Parameters: - `mv`: `org.objectweb.asm.MethodVisitor` - The underlying `MethodVisitor` instance to wrap. ```Java public MethodVisitorEx(org.objectweb.asm.MethodVisitor mv) ``` -------------------------------- ### Java IMapping: Get Super-Implementation Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/obfuscation/mapping/IMapping Retrieves the next most immediate super-implementation of this mapping. For example, if the mapping is a method that overrides another, it returns the overridden method. It can return null if no superclass is available or if no superclass definition exists. ```Java TMapping getSuper() ``` ```APIDOC Method: getSuper Description: Get the next most immediate super-implementation of this mapping. For example if the mapping is a method and the method overrides a method in the immediate superclass, return that method. Can return null if no superclass is available or if no superclass definition exists. Returns: Type: TMapping Description: The method immediately overridden by this method, or null if not present or not resolvable. ``` -------------------------------- ### Get Line Number Range for Java Constructor Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/injection/struct/Constructor This method identifies the start and end line numbers within a supplied Java constructor's method body. It takes a MethodNode object as input and returns an InsnRange object, which indicates the line numbers and the position of the superclass constructor invocation. ```Java public static InsnRange getRange(org.objectweb.asm.tree.MethodNode ctor) ``` ```APIDOC { "methodName": "getRange", "signature": "public static InsnRange getRange(org.objectweb.asm.tree.MethodNode ctor)", "description": "Identifies line numbers in the supplied ctor which correspond to the start and end of the method body.", "parameters": [ { "name": "ctor", "type": "org.objectweb.asm.tree.MethodNode", "description": "constructor to scan" } ], "returns": { "type": "InsnRange", "description": "range indicating the line numbers of the specified constructor and the position of the superclass ctor invocation" } } ``` -------------------------------- ### Initialize Java MixinService Boot Process Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/service/MixinService This static boot() method initiates the MixinService's internal setup process. It takes no parameters and returns void, indicating it performs an essential initialization task without returning any value. This method must be called to prepare the service layer for operation. ```Java public static void boot() ``` -------------------------------- ### API Reference for Java IMixinServiceBootstrap Interface Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/service/IMixinServiceBootstrap This section provides a structured API reference for the `IMixinServiceBootstrap` interface. It describes the interface's purpose in bootstrapping Mixin services and lists its methods, their signatures, return types, and descriptions, essential for developers integrating or extending Mixin functionality. ```APIDOC { "interface": "IMixinServiceBootstrap", "package": "org.spongepowered.asm.service", "definition": "public interface IMixinServiceBootstrap", "description": "Bootstrap interface for Mixin services. Because of the nature of service environments, it may be necessary to provide bootstrap logic to prepare the classloader environment before the services themselves are enumerated.", "methods": [ { "name": "getName", "signature": "java.lang.String getName()", "return_type": "java.lang.String", "description": "Get the friendly name for the underlying service" }, { "name": "getServiceClassName", "signature": "java.lang.String getServiceClassName()", "return_type": "java.lang.String", "description": "Get the fully qualified class name of the underlying service" }, { "name": "bootstrap", "signature": "void bootstrap()", "return_type": "void", "description": "Run bootstrap-time preparation for the underlying service" } ] } ``` -------------------------------- ### Get First Non-Argument Local Index in Java ASM Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/util/Bytecode Calculates the first available local variable index that is not occupied by method arguments or the 'this' reference. This method helps determine the starting point for allocating new local variables in bytecode manipulation, considering the size of existing arguments and the optional 'this' reference. ```APIDOC Method: getFirstNonArgLocalIndex Signature: public static int getFirstNonArgLocalIndex(org.objectweb.asm.Type[] args, boolean includeThis) Description: Get the first non-arg variable index based on the supplied arg array and whether to include the "this" reference, this corresponds to the size of the arguments passed in to the method plus an extra spot for "this" is specified Parameters: - name: args type: org.objectweb.asm.Type[] description: Method arguments - name: includeThis type: boolean description: Whether to include a slot for "this" (generally true for all non-static methods) Returns: type: int description: first available local index which is NOT used by a method argument or "this" ``` -------------------------------- ### Get Java Injector Prefix by Annotation Type Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/injection/struct/InjectionInfo Get the conform prefix for an injector handler by type. ```APIDOC Method: getInjectorPrefix Signature: public static java.lang.String getInjectorPrefix(org.objectweb.asm.tree.AnnotationNode annotation) Parameters: - annotation (org.objectweb.asm.tree.AnnotationNode): Annotation to inspect Returns: java.lang.String (conform prefix) ``` -------------------------------- ### API Documentation for org.spongepowered.asm.launch Package Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/launch/package-summary This section details the classes and errors within the org.spongepowered.asm.launch package. It provides a structured overview of the core components that facilitate environment-agnostic launch logic for the Mixin subsystem and its adapters. ```APIDOC { "package": "org.spongepowered.asm.launch", "description": "Classes which support environment-agnostic launch logic for the Mixin subsystem and base classes and interfaces for environment-specific adapters.", "class_summary": [ { "name": "GlobalProperties", "description": "Access to underlying global property service provided by the current environment" }, { "name": "GlobalProperties.Keys", "description": "Global property keys" }, { "name": "MixinBootstrap", "description": "Bootstraps the mixin subsystem." } ], "error_summary": [ { "name": "MixinInitialisationError", "description": "Error raised when mixin subsystem initialisation fails" } ] } ``` -------------------------------- ### Java Mixin @At Annotation Examples Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/injection/points/BeforeFinalReturn Examples demonstrating the usage of the @At annotation with 'TAIL' value, showing both explicit and implicit value parameter usage. ```Java @At(value = "TAIL") ``` ```Java @At("TAIL") ``` -------------------------------- ### Explore org.spongepowered.asm.launch.platform Java API Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/launch/platform/package-summary This snippet provides a structured overview of the org.spongepowered.asm.launch.platform package, including its key interfaces, classes, and enums. It details their purpose and provides links to their full documentation, serving as a quick reference for developers working with Mixin's platform-specific behaviors. ```APIDOC Package: org.spongepowered.asm.launch.platform Description: Base classes for environment-specific adapters and default platform-agnostic handlers for environment and mixin containers. Interface Summary: - Interface: IMixinPlatformAgent Description: Base interface for platform agents. Link: ../../../../../org/spongepowered/asm/launch/platform/IMixinPlatformAgent.html - Interface: IMixinPlatformServiceAgent Description: Service agents provide additional platform-specific extensions leveraged by mixin services. Link: ../../../../../org/spongepowered/asm/launch/platform/IMixinPlatformServiceAgent.html Class Summary: - Class: CommandLineOptions Description: Options passed in to Mixin via the command line Link: ../../../../../org/spongepowered/asm/launch/platform/CommandLineOptions.html - Class: MainAttributes Description: "Main" attribute cache for a URI container, mainly to avoid constantly opening jar files just to read odd values out of the manifest. Link: ../../../../../org/spongepowered/asm/launch/platform/MainAttributes.html - Class: MixinConnectorManager Description: Manager for Mixin containers bootstrapping via IMixinConnector Link: ../../../../../org/spongepowered/asm/mixin/connect/IMixinConnector.html - Class: MixinContainer Description: A collection of IMixinPlatformAgent platform agents) for a particular container Link: ../../../../../org/spongepowered/asm/launch/platform/MixinContainer.html - Class: MixinPlatformAgentAbstract Description: Platform agent base class Link: ../../../../../org/spongepowered/asm/launch/platform/MixinPlatformAgentAbstract.html - Class: MixinPlatformAgentDefault Description: Default platform agent, handles the mixin manifest keys such as MixinConfigs and MixinTokenProviders. Link: ../../../../../org/spongepowered/asm/launch/platform/MixinPlatformAgentDefault.html - Class: MixinPlatformManager Description: Handler for platform-specific behaviour required in different mixin environments. Link: ../../../../../org/spongepowered/asm/launch/platform/MixinPlatformManager.html Enum Summary: - Enum: IMixinPlatformAgent.AcceptResult Description: Result type returned from IMixinPlatformAgent.accept(org.spongepowered.asm.launch.platform.MixinPlatformManager, org.spongepowered.asm.launch.platform.container.IContainerHandle) Link: ../../../../../org/spongepowered/asm/launch/platform/IMixinPlatformAgent.AcceptResult.html ``` -------------------------------- ### Java IMapping Interface API Reference Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/obfuscation/mapping/IMapping Comprehensive API documentation for the `IMapping` interface, outlining its type parameters, implementing classes, nested types, and all available methods for managing member mappings. This reference details method signatures, parameters, and return types. ```APIDOC Interface: IMapping Definition: public interface IMapping Description: Base class for member mapping entries Type Parameters: TMapping: type of this member, for transformation method return types All Known Implementing Classes: - org.spongepowered.asm.obfuscation.mapping.common.MappingField - org.spongepowered.asm.obfuscation.mapping.mcp.MappingFieldSrg - org.spongepowered.asm.obfuscation.mapping.common.MappingMethod Nested Class Summary: - static class IMapping.Type (enum) Description: Type of mapping Method Summary: - copy(): TMapping Description: Create a clone of this mapping - getDesc(): java.lang.String Description: Get the descriptor of this member, for example the method descriptor or field type. - getName(): java.lang.String Description: Get the mapping name, for method mappings this includes the owner - getOwner(): java.lang.String Description: Get the owner of this member, for fields and methods this is the class name, for classes it is the package name, for packages it is undefined. - getSimpleName(): java.lang.String Description: Get the base name of this member, for example the bare field, method or class name - getSuper(): TMapping Description: Get the next most immediate super-implementation of this mapping. - getType(): IMapping.Type Description: Get the mapping type (field, method, class, package) - move(newOwner: java.lang.String): TMapping Description: Create a clone of this mapping with a new owner Parameters: newOwner: new owner Returns: cloned mapping - remap(newName: java.lang.String): TMapping Description: Create a clone of this mapping with a new name Parameters: newName: new name Returns: cloned mapping - serialise(): java.lang.String Description: Get a representation of this mapping for serialisation. - transform(newDesc: java.lang.String): TMapping Description: Create a clone of this mapping with a new descriptor Parameters: newDesc: new descriptor Returns: cloned mapping Method Detail: - getType() Signature: IMapping.Type getType() Description: Get the mapping type (field, method, class, package) - move(newOwner: java.lang.String) Signature: TMapping move(java.lang.String newOwner) Description: Create a clone of this mapping with a new owner Parameters: newOwner: new owner Returns: cloned mapping - remap(newName: java.lang.String) Signature: TMapping remap(java.lang.String newName) Description: Create a clone of this mapping with a new name Parameters: newName: new name Returns: cloned mapping - transform(newDesc: java.lang.String) Signature: TMapping transform(java.lang.String newDesc) Description: Create a clone of this mapping with a new descriptor Parameters: newDesc: new descriptor Returns: cloned mapping - copy() Signature: TMapping copy() Description: Create a clone of this mapping Returns: cloned mapping ``` -------------------------------- ### Example Usage of BeforeInvoke with @At Annotation Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/injection/points/BeforeInvoke Illustrates how to use the BeforeInvoke injection point within a Mixin @At annotation. This example targets a method with the signature func_1234_a(III)V. ```Java @At(value = "INVOKE", target="func_1234_a(III)V") ``` -------------------------------- ### IMixinConfigPlugin Java API Reference Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/extensibility/IMixinConfigPlugin This section provides a detailed reference for the IMixinConfigPlugin interface, including its definition and all available methods with their parameters, return types, and descriptions. It outlines how plugins can interact with the Mixin transformation lifecycle, from initial loading to pre- and post-application hooks. ```APIDOC { "interface": { "name": "IMixinConfigPlugin", "visibility": "public", "type": "interface", "description": "A companion plugin for a mixin configuration object. Objects implementing this interface get some limited power of veto over the mixin load process as well as an opportunity to apply their own transformations to the target class pre- and post-transform. Since all methods in this class are called indirectly from the transformer, the same precautions as for writing class transformers should be taken. Implementors should take care to not reference any game classes, and avoid referencing other classes in their own mod except those specificially designed to be available at early startup, such as coremod classes or other standalone bootstrap objects. Instances of plugins are created by specifying the \"plugin\" key in the mixin config JSON as the fully-qualified class name of a class implementing this interface.", "methods": [ { "name": "acceptTargets", "return_type": "void", "parameters": [ { "name": "myTargets", "type": "java.util.Set" }, { "name": "otherTargets", "type": "java.util.Set" } ], "description": "Called after all configurations are initialised, this allows this plugin to observe classes targetted by other mixin configs and optionally remove targets from its own set." }, { "name": "getMixins", "return_type": "java.util.List", "parameters": [], "description": "After mixins specified in the configuration have been processed, this method is called to allow the plugin to add any additional mixins to load." }, { "name": "getRefMapperConfig", "return_type": "java.lang.String", "parameters": [], "description": "Called only if the \"referenceMap\" key in the config is **not** set. This allows the refmap file name to be supplied by the plugin programatically if desired. Returning `null` will revert to the default behaviour of using the default refmap json file.", "returns": "Path to the refmap resource or null to revert to the default" }, { "name": "onLoad", "return_type": "void", "parameters": [ { "name": "mixinPackage", "type": "java.lang.String", "description": "The mixin root package from the config" } ], "description": "Called after the plugin is instantiated, do any setup here." }, { "name": "postApply", "return_type": "void", "parameters": [ { "name": "targetClassName", "type": "java.lang.String" }, { "name": "targetClass", "type": "org.objectweb.asm.tree.ClassNode" }, { "name": "mixinClassName", "type": "java.lang.String" }, { "name": "mixinInfo", "type": "IMixinInfo" } ], "description": "Called immediately **after** a mixin is applied to a target class, allows any post-application transformations to be applied." }, { "name": "preApply", "return_type": "void", "parameters": [ { "name": "targetClassName", "type": "java.lang.String" }, { "name": "targetClass", "type": "org.objectweb.asm.tree.ClassNode" }, { "name": "mixinClassName", "type": "java.lang.String" }, { "name": "mixinInfo", "type": "IMixinInfo" } ], "description": "Called immediately **before** a mixin is applied to a target class, allows any pre-application transformations to be applied." }, { "name": "shouldApplyMixin", "return_type": "boolean", "parameters": [ { "name": "targetClassName", "type": "java.lang.String" }, { "name": "mixinClassName", "type": "java.lang.String" } ], "description": "Called during mixin intialisation, allows this plugin to control whether a specific will be applied to the specified target. Returning false will" } ] } } ``` -------------------------------- ### Java: Example @At Annotation for JumpInsnPoint Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/injection/points/JumpInsnPoint Illustrates how to use the `@At` annotation with `JumpInsnPoint` to specify a JUMP instruction with a particular opcode and ordinal. This example targets the third `IFLE` jump instruction. ```Java @At(value = "JUMP", opcode = Opcodes.IFLE, ordinal = 2) ``` -------------------------------- ### Java API Reference for BeforeReturn Class Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/injection/points/BeforeReturn Comprehensive API documentation for the `org.spongepowered.asm.mixin.injection.points.BeforeReturn` class, detailing its inheritance, purpose, configurable parameters, constructors, and methods for finding injection points before method returns. ```APIDOC {"class": {"name": "BeforeReturn", "extends": "InjectionPoint", "description": "This injection point searches for RETURN opcodes in the target method and returns a list of insns immediately prior to matching instructions. Note that every RETURN opcode will be returned and thus every natural exit from the method except for exception throws will be implicitly specified. To specify a particular RETURN use the ordinal parameter. The injection point accepts the following parameters from At:", "parameters": [{"name": "ordinal", "description": "The ordinal position of the RETURN opcode to match, if not specified then the injection point returns all RETURN opcodes. For example if the RETURN opcode appears 3 times in the method and you want to match the 3rd then you can specify an ordinal of 2 (ordinals are zero-indexed). The default value is -1 which supresses ordinal matching"}], "examples": ["@At(value = \"RETURN\")", "@At(\"RETURN\")"], "nested_classes_inherited": ["InjectionPoint.AtCode", "InjectionPoint.Flags", "InjectionPoint.RestrictTargetLevel", "InjectionPoint.Specifier"], "fields_inherited": ["DEFAULT_ALLOWED_SHIFT_BY", "MAX_ALLOWED_SHIFT_BY"], "constructors": [{"name": "BeforeReturn", "parameters": [{"name": "data", "type": "InjectionPointData"}]}], "methods": [{"name": "checkPriority", "return_type": "boolean", "parameters": [{"name": "targetPriority", "type": "int"}, {"name": "ownerPriority", "type": "int"}], "description": "Runs a priority check in the context of this injection point."}, {"name": "find", "return_type": "boolean", "parameters": [{"name": "desc", "type": "java.lang.String"}, {"name": "insns", "type": "org.objectweb.asm.tree.InsnList"}, {"name": "nodes", "type": "java.util.Collection"}], "description": "Find injection points in the supplied insn list"}, {"name": "getTargetRestriction", "return_type": "InjectionPoint.RestrictTargetLevel", "parameters": [{"name": "context", "type": "IInjectionPointContext"}], "description": "Returns the target restriction level for this injection point."}], "methods_inherited": ["org.spongepowered.asm.mixin.injection.InjectionPoint"]}} ``` -------------------------------- ### Java: Get Simple Name from ASM Type Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/util/Bytecode This method extracts the simple name of a class from an `org.objectweb.asm.Type` object. It provides a convenient way to get a human-readable class name from an ASM type representation. ```java public static java.lang.String getSimpleName(org.objectweb.asm.Type type) ``` ```APIDOC Method: getSimpleName Signature: public static java.lang.String getSimpleName(org.objectweb.asm.Type type) Description: Returns the simple name of a type representing a class. Parameters: - type (org.objectweb.asm.Type): type Returns: - java.lang.String: annotation's simple name ``` -------------------------------- ### API Reference for InjectionPoint and BeforeFinalReturn Classes Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/injection/points/BeforeFinalReturn Comprehensive API documentation for the `InjectionPoint` interface and the `BeforeFinalReturn` class, outlining their public methods, constructors, and inherited members. This includes detailed signatures and descriptions for core functionalities related to bytecode injection and transformation within Mixin. ```APIDOC interface InjectionPoint { // Methods void addMessage(java.lang.String message, java.lang.Object... args) org.spongepowered.asm.mixin.injection.InjectionPoint after(org.spongepowered.asm.mixin.injection.InjectionPoint point) org.spongepowered.asm.mixin.injection.InjectionPoint and(org.spongepowered.asm.mixin.injection.InjectionPoint... points) org.spongepowered.asm.mixin.injection.InjectionPoint before(org.spongepowered.asm.mixin.injection.InjectionPoint point) int getAtCode() java.lang.String getId() org.spongepowered.asm.mixin.injection.Slice getSlice() org.spongepowered.asm.mixin.injection.InjectionPoint.Specifier getSpecifier(org.spongepowered.asm.mixin.injection.InjectionPoint.Specifier specifier) org.objectweb.asm.tree.AbstractInsnNode nextNode(org.objectweb.asm.tree.InsnList insns, org.objectweb.asm.tree.AbstractInsnNode insn) org.spongepowered.asm.mixin.injection.InjectionPoint or(org.spongepowered.asm.mixin.injection.InjectionPoint... points) org.spongepowered.asm.mixin.injection.InjectionPoint parse(org.spongepowered.asm.mixin.injection.IInjectionPointContext context, org.objectweb.asm.tree.AnnotationNode annotation) org.spongepowered.asm.mixin.injection.InjectionPoint parse(org.spongepowered.asm.mixin.injection.IInjectionPointContext context, org.spongepowered.asm.mixin.injection.At at) org.spongepowered.asm.mixin.injection.InjectionPoint parse(org.spongepowered.asm.mixin.injection.IInjectionPointContext context, java.util.List injectionPoints) org.spongepowered.asm.mixin.injection.InjectionPoint parse(org.spongepowered.asm.mixin.injection.IInjectionPointContext context, java.lang.String at, org.spongepowered.asm.mixin.injection.At.Shift shift, int by, java.util.List args, java.lang.String target, java.lang.String desc, int ordinal, int opcode, java.lang.String id, int slice) org.spongepowered.asm.mixin.injection.InjectionPoint parse(org.spongepowered.asm.mixin.refmap.IMixinContext mixin, org.objectweb.asm.tree.MethodNode method, org.objectweb.asm.tree.AnnotationNode parent, org.objectweb.asm.tree.AnnotationNode annotation) org.spongepowered.asm.mixin.injection.InjectionPoint parse(org.spongepowered.asm.mixin.refmap.IMixinContext mixin, org.objectweb.asm.tree.MethodNode method, org.objectweb.asm.tree.AnnotationNode parent, org.spongepowered.asm.mixin.injection.At at) org.spongepowered.asm.mixin.injection.InjectionPoint parse(org.spongepowered.asm.mixin.refmap.IMixinContext mixin, org.objectweb.asm.tree.MethodNode method, org.objectweb.asm.tree.AnnotationNode parent, java.util.List injectionPoints) org.spongepowered.asm.mixin.injection.InjectionPoint parse(org.spongepowered.asm.mixin.refmap.IMixinContext mixin, org.objectweb.asm.tree.MethodNode method, org.objectweb.asm.tree.AnnotationNode parent, java.lang.String at, org.spongepowered.asm.mixin.injection.At.Shift shift, int by, java.util.List args, java.lang.String target, java.lang.String desc, int ordinal, int opcode, java.lang.String id, int slice) void register(java.lang.Class clazz) void register(java.lang.Class clazz, java.lang.String name) void setTargetRestriction(org.spongepowered.asm.mixin.injection.InjectionPoint.RestrictTargetLevel level) org.spongepowered.asm.mixin.injection.InjectionPoint shift(org.spongepowered.asm.mixin.injection.InjectionPoint point, int shift) java.lang.String toString() // Inherited Methods from class java.lang.Object java.lang.Object clone() boolean equals(java.lang.Object obj) void finalize() java.lang.Class getClass() int hashCode() void notify() void notifyAll() void wait() void wait(long timeout) void wait(long timeout, int nanos) } class BeforeFinalReturn extends InjectionPoint { // Constructors public BeforeFinalReturn(InjectionPointData data) // Methods public boolean checkPriority(int targetPriority, int ownerPriority) Description: Runs a priority check in the context of this injection point. A priority check should return true if the injection point is allowed to inject given the relative priorities of the target (a method merged by another mixin with targetPriority) and the incoming mixin with priority mixinPriority. Overrides: InjectionPoint.checkPriority(int, int) } ``` -------------------------------- ### Example Array Field for @Redirect Element Access Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/injection/Redirect This Java snippet provides an example of an array field and its usage, demonstrating how individual array elements can be accessed. This type of array access can be targeted for redirection by the @Redirect annotation. ```Java private String[] strings = { "foo", "bar", "baz" }; public void print(int index) { System.err.println(this.strings[index]); } ``` -------------------------------- ### Java: Begin a new activity with format Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/transformer/ActivityStack This method begins a new activity and pushes it onto the activity stack, allowing for formatted descriptions. It requires a description format string and optional arguments. ```Java public IActivityContext.IActivity begin(java.lang.String descriptionFormat, java.lang.Object... args) ``` -------------------------------- ### Java Bytecode: Get Simple Name from ASM Type Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/util/Bytecode This method retrieves the simple name of a class from an `org.objectweb.asm.Type` object. It provides a convenient way to get the class's common name without package information. ```APIDOC Method: getSimpleName Return Type: static java.lang.String Parameters: - type: org.objectweb.asm.Type Description: Returns the simple name of a type representing a class ``` -------------------------------- ### Java Mixin API: Class Summary for org.spongepowered.asm.mixin Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/package-summary Lists key classes within the `org.spongepowered.asm.mixin` package, providing a brief description for each. These classes manage global state and resource registration for the mixin subsystem. ```APIDOC Class: MixinEnvironment Description: The mixin environment manages global state information for the mixin subsystem. Class: MixinEnvironment.Phase Description: Environment phase, deliberately not implemented as an enum Class: Mixins Description: Entry point for registering global mixin resources. ``` -------------------------------- ### Java Examples for BeforeNew Injection Point Usage Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/injection/points/BeforeNew These Java code snippets demonstrate how to use the BeforeNew injection point with the @At annotation to target specific NEW opcodes. Examples include finding all NEW opcodes for a class and targeting a specific constructor signature. ```Java // Find all NEW opcodes for String @At(value = "NEW", args = "class=java/lang/String") ``` ```Java // Find all NEW opcodes for String @At(value = "NEW", target = "java/lang/String" ``` ```Java // Find all NEW opcodes for String which are constructed // using the ctor which takes an array of char @At(value = "NEW", target = "([C)Ljava/lang/String;" ``` -------------------------------- ### API Reference for org.spongepowered.asm.mixin.transformer.ext Package Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/transformer/ext/package-tree This section provides a structured overview of the classes and interfaces within the `org.spongepowered.asm.mixin.transformer.ext` package, including their inheritance and implementation relationships. It serves as a quick reference for understanding the package's architectural components. ```APIDOC Package: org.spongepowered.asm.mixin.transformer.ext Class Hierarchy: java.lang.Object org.spongepowered.asm.mixin.transformer.ext.Extensions (implements org.spongepowered.asm.mixin.transformer.ext.IExtensionRegistry) Interface Hierarchy: org.spongepowered.asm.mixin.transformer.ext.IClassGenerator org.spongepowered.asm.mixin.transformer.ext.IDecompiler org.spongepowered.asm.mixin.transformer.ext.IExtension org.spongepowered.asm.mixin.transformer.ext.IExtensionRegistry org.spongepowered.asm.mixin.transformer.ext.IHotSwap org.spongepowered.asm.mixin.transformer.ext.ITargetClassContext ``` -------------------------------- ### Java ClassInfo: Get ClassInfo by Name (Cached) Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/transformer/ClassInfo This static method retrieves a ClassInfo object for a given class name, prioritizing a cache lookup. It's an efficient way to get class metadata, avoiding redundant class loading if the information is already available. Returns null if the class cannot be resolved. ```APIDOC { "class": "ClassInfo", "method": { "name": "forName", "signature": "public static ClassInfo forName(java.lang.String className)", "description": "Return a ClassInfo for the specified class name, fetches the ClassInfo from the cache where possible.", "parameters": [ { "name": "className", "type": "java.lang.String", "description": "Binary name of the class to look up" } ], "returns": { "type": "ClassInfo", "description": "ClassInfo for the specified class name or null if the specified name cannot be resolved for some reason" } } } ``` -------------------------------- ### Java Mixin: Example Class with Static Method for Constructor Redirection Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/injection/Redirect Presents a Java class `Foo` that extends `Bar` and calls a static method `isEven` within its constructor, specifically before the `super()` call. This example highlights a special case for `@Redirect` where the handler method must also be static if the target instruction occurs before `super()`. ```Java class Foo : Bar { Foo(int arg) { super(Foo.isEven(arg)); } static int isEven(int arg) { return arg % 2 == 0; } } ``` -------------------------------- ### Java API Hierarchy for org.spongepowered.asm.launch.platform.container Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/launch/platform/container/package-tree This snippet outlines the hierarchical structure of classes and interfaces within the org.spongepowered.asm.launch.platform.container package. It shows which classes extend java.lang.Object and which interfaces extend IMixinConfigSource, along with their implementation relationships. This helps developers understand the foundational components for managing platform containers. ```APIDOC Hierarchy For Package org.spongepowered.asm.launch.platform.container Package Hierarchies: - All Packages Class Hierarchy: - java.lang.Object + org.spongepowered.asm.launch.platform.container.ContainerHandleURI (implements org.spongepowered.asm.launch.platform.container.IContainerHandle) + org.spongepowered.asm.launch.platform.container.ContainerHandleVirtual (implements org.spongepowered.asm.launch.platform.container.IContainerHandle) Interface Hierarchy: - org.spongepowered.asm.mixin.extensibility.IMixinConfigSource + org.spongepowered.asm.launch.platform.container.IContainerHandle ``` -------------------------------- ### Specify Start Point for Java Mixin Slice Region Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/injection/Slice The 'from' property defines the starting injection point of a slice region, typically using an At annotation with a specifier (e.g., INVOKE:LAST). It must be supplied if 'to' is omitted, and both 'from' and 'to' can be used together to define a bounded region. The selected instruction by 'from' must precede the one by 'to'. ```Java public abstract At from ``` ```APIDOC Property: from Type: At Description: Injection point specifying the start of the slice region. Should use an InjectionPoint.Specifier. Must be supplied if 'to' is not. Can be combined with 'to' if the region has positive size. Returns: The start point of the slice Default: @org.spongepowered.asm.mixin.injection.At("HEAD") ``` -------------------------------- ### API Reference for org.spongepowered.asm.mixin.refmap Package Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/refmap/package-summary Detailed API documentation for the `org.spongepowered.asm.mixin.refmap` package, including interfaces and classes responsible for runtime reference mapping in Mixin. ```APIDOC Interface: IMixinContext Description: Context for performing reference mapping ``` ```APIDOC Interface: IReferenceMapper Description: Interface for reference mapper objects ``` ```APIDOC Class: ReferenceMapper Description: Stores runtime information allowing field, method and type references which cannot be hard remapped by the reobfuscation process to be remapped in a "soft" manner at runtime. ``` ```APIDOC Class: RemappingReferenceMapper Description: This adapter is designed to address a problem with mixins when "deobfCompile" dependencies are used in a project which is using newer MCP mappings than the ones the imported dependency was compiled with. ``` -------------------------------- ### Java: Get Superclass Info Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/transformer/ClassInfo Retrieves the `ClassInfo` for the superclass. This method can return null if the superclass cannot be resolved. ```Java public ClassInfo getSuperClass() ``` -------------------------------- ### Java Method: prepare() Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/launch/platform/MixinPlatformAgentDefault The `prepare()` method is called during the pre-initialisation phase, after all tweakers and tweak containers have been added to the environment. This method is specified by the `IMixinPlatformAgent` interface. ```Java public void prepare() ``` -------------------------------- ### Get Java Registered Injection Annotations Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/injection/struct/InjectionInfo Retrieves a set of all registered injection annotation types. ```APIDOC Method: getRegisteredAnnotations Signature: public static java.util.Set> getRegisteredAnnotations() Parameters: None Returns: java.util.Set> ``` -------------------------------- ### Java IMixinConnector Interface API Reference Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/connect/IMixinConnector Provides the structured API documentation for the `IMixinConnector` interface, outlining its definition, package, and the `connect()` method for Mixin resource registration. This interface serves as a bootstrap agent for Mixin consumers. ```APIDOC { "interface": "IMixinConnector", "package": "org.spongepowered.asm.mixin.connect", "description": "A connector class is a bootstrap agent for a mixin consumer. It should call back against Mixins to register its resources much like previous \"CoreMod\" bootstraps.", "definition": "public interface IMixinConnector", "methods": [ { "name": "connect", "signature": "void connect()", "return_type": "void", "parameters": [], "description": "Connect to Mixin" } ] } ``` -------------------------------- ### Java: Get Class ASM Type Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/transformer/ClassInfo Retrieves the object type as an ASM type. This method returns an `org.objectweb.asm.Type` instance. ```Java public org.objectweb.asm.Type getType() ``` -------------------------------- ### APIDOC: Class org.spongepowered.asm.launch.MixinBootstrap Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/allclasses-noframe API documentation for the class `org.spongepowered.asm.launch.MixinBootstrap`. This class is responsible for initializing the Mixin environment during application launch. ```APIDOC class org.spongepowered.asm.launch.MixinBootstrap { /* Methods and properties would be listed here if available */ } ``` -------------------------------- ### Java PrettyPrinter Constructor: PrettyPrinter() Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/util/PrettyPrinter This constructor initializes a new instance of the PrettyPrinter class with default settings. It takes no arguments. ```Java public PrettyPrinter() ``` ```APIDOC { "type": "constructor", "name": "PrettyPrinter", "parameters": [], "access_modifier": "public" } ``` -------------------------------- ### Java: Get Class/Interface Methods Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/transformer/ClassInfo Retrieves a read-only view of the class or interface methods. This method returns a set of `ClassInfo.Method` instances. ```Java public java.util.Set getMethods() ``` -------------------------------- ### Java: Get Class Signature Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/transformer/ClassInfo Returns the class signature as a `ClassSignature` instance. This method provides detailed signature information for the class. ```Java public ClassSignature getSignature() ``` -------------------------------- ### Overview of org.spongepowered.asm.mixin.injection.callback Package API Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/injection/callback/package-summary This snippet provides a structured overview of the `org.spongepowered.asm.mixin.injection.callback` package, including its purpose and a list of its key interfaces, classes, enums, and exceptions with their respective descriptions. It serves as a quick reference for understanding the package's components and their roles in Mixin's injection system. ```APIDOC { "package": "org.spongepowered.asm.mixin.injection.callback", "description": "Implementation of callback injector functionality provided by @Inject.", "interfaces": [ { "name": "Cancellable", "description": "Interface for things which can be cancelled" } ], "classes": [ { "name": "CallbackInfo", "description": "CallbackInfo instances are passed to callbacks in order to provide information and handling opportunities to the callback to interact with the callback itself." }, { "name": "CallbackInfoReturnable", "description": "For callbacks with a non-void return type, a CallbackInfoReturnable is passed to the callback instead to allow the callback to interact with the method return value." }, { "name": "CallbackInjector", "description": "This class is responsible for generating the bytecode for injected callbacks, for details of usage see @Inject." } ], "enums": [ { "name": "LocalCapture", "description": "Specifies the behaviour for capturing local variables at an injection point." } ], "exceptions": [ { "name": "CancellationException", "description": "Exception thrown when a consumer attemtps to call cancel() on a callback not marked as cancellable." } ] } ``` -------------------------------- ### Java: Get Superclass Binary Name Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/transformer/ClassInfo Retrieves the binary name of the superclass. This method returns a string representing the superclass name. ```Java public java.lang.String getSuperName() ``` -------------------------------- ### Java API: RedirectInjectionInfo Constructor Summary Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/injection/struct/RedirectInjectionInfo Provides a summary of available constructors for the `RedirectInjectionInfo` class. This section typically details how instances of the class can be created and initialized, although specific constructor signatures are not provided in the source. ```APIDOC Constructors: | Constructor and Description | ``` -------------------------------- ### Java: Get String Representation of Class Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/transformer/ClassInfo Overrides the default `toString` method from `java.lang.Object`. This method provides a string representation of the class. ```Java public java.lang.String toString() ``` -------------------------------- ### All Classes Page in API Documentation Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/help-doc Explains the 'All Classes' link, which provides a comprehensive list of all classes and interfaces, excluding non-static nested types, for quick access. ```APIDOC The [All Classes](allclasses-noframe.html) link shows all classes and interfaces except non-static nested types. ``` -------------------------------- ### Java API: Get Target Method Signature Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/injection/code/InsnListEx Retrieves the signature of the target method. This method is specified by the `IInsnListEx` interface. ```Java public java.lang.String getTargetSignature() ``` ```APIDOC Method: Name: getTargetSignature Return Type: java.lang.String Description: Get the signature of the target method ``` -------------------------------- ### Java: ConstructorHead Method Summary Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/injection/points/ConstructorHead Outlines the methods available in the `ConstructorHead` class, specifically the `find` method. ```APIDOC Methods: Modifier and Type | Method and Description boolean | find(java.lang.String desc, org.objectweb.asm.tree.InsnList insns, java.util.Collection nodes) (Find injection points in the supplied insn list) ``` -------------------------------- ### Java API: Get Target Method Descriptor Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/injection/code/InsnListEx Retrieves the descriptor of the target method. This method is specified by the `IInsnListEx` interface. ```Java public java.lang.String getTargetDesc() ``` ```APIDOC Method: Name: getTargetDesc Return Type: java.lang.String Description: Get the descriptor of the target method ``` -------------------------------- ### Java IMixinService Interface Method Reference Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/service/IMixinService This section provides a detailed reference for all methods available in the `IMixinService` interface. Each method includes its return type, parameters with their types and descriptions, and a brief explanation of its purpose and behavior. This documentation is essential for developers integrating custom services with the Mixin framework. ```APIDOC { "interface": "IMixinService", "description": "Interface for Mixin service operations, providing core functionalities for the Mixin subsystem.", "methods": [ { "name": "getName", "return_type": "java.lang.String", "parameters": [], "description": "Get the friendly name for this service." }, { "name": "isValid", "return_type": "boolean", "parameters": [], "description": "True if this service type is valid in the current environment." }, { "name": "prepare", "return_type": "void", "parameters": [], "description": "Called at subsystem boot." }, { "name": "getInitialPhase", "return_type": "MixinEnvironment.Phase", "parameters": [], "description": "Get the initial subsystem phase." }, { "name": "offer", "return_type": "void", "parameters": [ { "name": "internal", "type": "IMixinInternal", "description": "Internal component being offered" } ], "description": "Called when the subsystem is offering internal components to the service, the service can determine whether to retain or ignore the component based on its own requirements." }, { "name": "init", "return_type": "void", "parameters": [], "description": "Called at the end of subsystem boot." }, { "name": "beginPhase", "return_type": "void", "parameters": [], "description": "Called whenever a new phase is started." }, { "name": "checkEnv", "return_type": "void", "parameters": [ { "name": "bootSource", "type": "java.lang.Object", "description": "boot source" } ], "description": "Check whether the supplied object is a valid boot source for mixin environment." }, { "name": "getReEntranceLock", "return_type": "ReEntranceLock", "parameters": [], "description": "Get the transformer re-entrance lock for this service, the transformer uses this lock to track transformer re-entrance when co-operative load and transform is performed by the service." }, { "name": "getClassProvider", "return_type": "IClassProvider", "parameters": [], "description": "Return the class provider for this service. This component is required and services must not return null." }, { "name": "getBytecodeProvider", "return_type": "IClassBytecodeProvider", "parameters": [], "description": "Return the class bytecode provider for this service. This component is required and services must not return null." }, { "name": "getTransformerProvider", "return_type": "ITransformerProvider", "parameters": [], "description": "Return the transformer provider for this service. This component is optional and is allowed to be null for services which do not support transformers, or don't support interacting with them." }, { "name": "getClassTracker", "return_type": "IClassTracker", "parameters": [], "description": "Return the class tracker for this service. This component is optional and is allowed to be null for services which do not support this functionality." }, { "name": "getAuditTrail", "return_type": "IMixinAuditTrail", "parameters": [], "description": "Return the audit trail for this service. This component is optional and is allowed to be null for services which do not support this functionality." }, { "name": "getResourceAsStream", "return_type": "java.io.InputStream", "parameters": [ { "name": "name", "type": "java.lang.String", "description": "The name of the resource to retrieve." } ], "description": "Get a resource as a stream from the appropriate classloader, this is delegated via the service so that the service can choose the correct classloader from which to obtain the resource." }, { "name": "getSideName", "return_type": "java.lang.String", "parameters": [], "description": "Get the detected side name for this environment." } ] } ``` -------------------------------- ### Java API: Get Target Method Name Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/injection/code/InsnListEx Retrieves the name of the target method. This method is specified by the `IInsnListEx` interface. ```Java public java.lang.String getTargetName() ``` ```APIDOC Method: Name: getTargetName Return Type: java.lang.String Description: Get the name of the target method ``` -------------------------------- ### SpongePowered Mixin Injection Structure API Reference Source: https://jenkins.liteloader.com/view/Other/job/Mixin/javadoc/index.html/org/spongepowered/asm/mixin/injection/struct/Constructor Comprehensive API documentation for the org.spongepowered.asm.mixin.injection.struct.Constructor and Target classes. This includes constructor details, method signatures, parameters, return types, and descriptions for each member, along with inherited methods, providing a complete reference for their use in Mixin development. ```APIDOC Class: org.spongepowered.asm.mixin.injection.struct.Target Methods: - addNode(...) - insertBefore(...) - iterator() - of(...) - removeNode(...) - replaceNode(...) - toString() - wrapNode(...) Inherited Methods from java.lang.Object: - clone() - equals() - finalize() - getClass() - hashCode() - notify() - notifyAll() - wait() Inherited Methods from java.lang.Iterable: - forEach() - spliterator() Class: org.spongepowered.asm.mixin.injection.struct.Constructor Constructors: - Constructor(ClassInfo classInfo, org.objectweb.asm.tree.ClassNode classNode, org.objectweb.asm.tree.MethodNode method) Methods: - findDelegateInitNode(): Return: Bytecode.DelegateInitialiser Description: Find the call to super() or this() in a constructor. This attempts to locate the first call to which isn't an inline call to another object ctor being passed into the super invocation. Returns: Call to super(), this() or DelegateInitialiser.NONE if not found - isInjectable(): Return: boolean Description: Get whether this constructor should have mixin initialisers injected into it based on whether a delegate initialiser call is absent or is a call to super() - inspect(Initialiser initialiser): Return: void Parameters: - initialiser: Initialiser Description: Inspect an incoming initialiser to determine which fields are touched by the mixin. This is then used in findInitialiserInjectionPoint(org.spongepowered.asm.mixin.transformer.struct.Initialiser.InjectionMode) to determine the instruction after which the mixin initialisers will be placed - findInitialiserInjectionPoint(Initialiser.InjectionMode mode): Return: org.objectweb.asm.tree.AbstractInsnNode Parameters: - mode: Initialiser.InjectionMode Description: Find the injection point for injected initialiser insns in the target ctor. This starts by assuming that initialiser instructions should be placed immediately after the delegate initialiser call, but then searches for field assignments and selects the last *unique* field assignment in the ctor body which represents a reasonable heuristic for the end of the existing initialisers. Returns: target node - findFirstBodyInsn(): Return: org.objectweb.asm.tree.AbstractInsnNode Description: Find the injection point - getRange(): (Incomplete) ```