tutorial:mixin_export
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| tutorial:mixin_export [2023/03/15 17:52] – Add instructions for use @Debug to only export certain mixins mattidragon | tutorial:mixin_export [2025/12/21 23:19] (current) – Expanded to describe dumping targets on failure and navigating an exported Mixin class gauntrecluse | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Exporting Mixin Classes | + | ====== Exporting |
| + | |||
| + | ===== Exporting a Transformed Class ===== | ||
| When debugging mixins, it's useful to be able to see the finalized classes with your changes and injects inserted. Mixin provides a flag that allows for this: | When debugging mixins, it's useful to be able to see the finalized classes with your changes and injects inserted. Mixin provides a flag that allows for this: | ||
| Line 17: | Line 19: | ||
| } | } | ||
| - | === Notes ==== | ||
| - | Some classes | + | ===== Dumping on Failure ===== |
| + | In some cases, you may want to be able to inspect a target class upon Mixin failing and likely throwing a crash. Mixin provides an additional flag for this: | ||
| + | |||
| + | '' | ||
| + | |||
| + | Adding this to your VM options similarly to the export flag will dump the class as it was just as Mixin failed the injection. This can be particularly useful if the cause of the error cannot be understood from the errors, target code and Mixin as they are in the development environment. | ||
| + | |||
| + | Dumping will place the dumped classes to the same filepath as it would for a regular export. | ||
| + | |||
| + | |||
| + | ===== Navigating an Exported Class ===== | ||
| + | |||
| + | Once you have an exported Mixin class, you should look for '' | ||
| + | |||
| + | ==== Reading Mangled Names ==== | ||
| + | |||
| + | The mangled names, on Fabric Mixin, follow | ||
| + | The following table can be used to match the injector type prefix to the corresponding annotation: | ||
| + | |||
| + | ^ Injector Annotation | ||
| + | | Base Mixin || | ||
| + | | @Inject | ||
| + | | @ModifyArg | ||
| + | | @ModifyArgs | ||
| + | | @ModifyConstant | ||
| + | | @ModifyVariable | ||
| + | | @Redirect | ||
| + | | MixinExtras | ||
| + | | @ModifyExpressionValue | modifyExpressionValue | | ||
| + | | @ModifyReceiver | ||
| + | | @ModifyReturnValue | ||
| + | | @WrapWithCondition | ||
| + | | @WrapOperation | ||
| + | |||
| + | |||
| + | ==== Annotations on Merged Members ==== | ||
| + | On top of being mangled, the handler | ||
| + | |||
| + | Outside of expression annotations, | ||
| + | |||
| + | <code java> | ||
| + | @MixinMerged( | ||
| + | mixin = "< | ||
| + | priority = <Mixin class priority>, | ||
| + | sessionId = "< | ||
| + | ) | ||
| + | </ | ||
| + | (Formatting not necessarily consistent between decompilers) | ||
| + | |||
| + | This also applies to most merged members, though other annotations may be present depending on the member, such as '' | ||
| + | |||
| + | An example '' | ||
| + | <code java> | ||
| + | @MixinMerged( | ||
| + | mixin = " | ||
| + | priority = 1000, | ||
| + | sessionId = " | ||
| + | ) | ||
| + | </ | ||
| + | |||
| + | Using the mangled name and the '' | ||
| + | |||
| + | |||
| + | ===== Notes ===== | ||
| + | |||
| + | ==== At what point are classes exported ==== | ||
| + | Mixins are applied relative to when the target class is loaded. As such, classes may be transformed and exported at any point between the game starting and an in-game | ||
| + | |||
| + | ==== '' | ||
| + | When using the '' | ||
tutorial/mixin_export.txt · Last modified: 2025/12/21 23:19 by gauntrecluse