User Tools

Site Tools


tutorial:mixin_introduction

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorial:mixin_introduction [2025/11/21 13:26] – ↷ Links adapted because of a move operation gauntreclusetutorial:mixin_introduction [2026/02/26 08:55] (current) – Fix mention of Mixin modifying source code. gauntrecluse
Line 9: Line 9:
 to transform the targeted classes' compiled Bytecode as the game runs("runtime"), but before the target class is loaded. to transform the targeted classes' compiled Bytecode as the game runs("runtime"), but before the target class is loaded.
  
-It is not recommended to try and learn how Mixin works or how to use it without prior knowledge of what Java bytecode is, as Mixin applies to bytecode rather than "source" code. It is also recommended to know how to read bytecode for your IDE of choice, as reading portions of the Bytecode may sometimes be necessary to use Mixin properly, such as when targeting anonymous classes, lambdas or code with a lot of "if-else" logic branching.\\+It is not recommended to try and learn how Mixin works or how to use it without prior knowledge of what Java bytecode is itself, as Mixin applies to bytecode rather than "source" code. It is also recommended to know how to access a class'bytecode for your IDE of choice, as reading portions of the Bytecode may sometimes be necessary to apply modifications properly, such as when targeting anonymous classes, lambdas or code with a lot of "if-else" logic branching. See [[https://docs.fabricmc.net/develop/mixins/bytecode|the Java Bytecode Docs page]] for a more extensive introduction on how to read and understand bytecode. 
 Similarly, Mixin and this documentation expects the user to already be familiar with [[tutorial:reading_mc_code|reading Minecraft and external source code]], and be able to set up an initial development environment, aswell as having an understanding of Java fundamentals. If, however, you specifically wish to skip to examples, be aware that it is expected for you to encounter difficulties and confusion in your learning process as you try to tackle more technical issues without learning some technical aspects, and you are likelier to need direct support or create Mixins that will be needlessly incompatible with other mods.\\ Similarly, Mixin and this documentation expects the user to already be familiar with [[tutorial:reading_mc_code|reading Minecraft and external source code]], and be able to set up an initial development environment, aswell as having an understanding of Java fundamentals. If, however, you specifically wish to skip to examples, be aware that it is expected for you to encounter difficulties and confusion in your learning process as you try to tackle more technical issues without learning some technical aspects, and you are likelier to need direct support or create Mixins that will be needlessly incompatible with other mods.\\
 It is recommended to leverage the [[https://mcdev.io/|Minecraft Development plugin by demonwav on IntelliJ]] (AKA MCDev) for Mixin development to benefit from its autocompletion, error highlighting, and utilities such as the MixinExtras Flow Diagram. It is recommended to leverage the [[https://mcdev.io/|Minecraft Development plugin by demonwav on IntelliJ]] (AKA MCDev) for Mixin development to benefit from its autocompletion, error highlighting, and utilities such as the MixinExtras Flow Diagram.
Line 17: Line 18:
 There are different tools Mixin and MixinExtras There are different tools Mixin and MixinExtras
 ((Since Fabric Loader 0.15, MixinExtras is bundled with Fabric. Since Loader version 0.17.0, MixinExtras major version 0.5.0 is included, and allows access to [[https://github.com/LlamaLad7/MixinExtras/wiki/Expressions|Expressions]] for extremely precise and flexible targeting. MixinExtras is a companion library to Mixin and is essential for precise and compatible manipulation of many Mixins.))  ((Since Fabric Loader 0.15, MixinExtras is bundled with Fabric. Since Loader version 0.17.0, MixinExtras major version 0.5.0 is included, and allows access to [[https://github.com/LlamaLad7/MixinExtras/wiki/Expressions|Expressions]] for extremely precise and flexible targeting. MixinExtras is a companion library to Mixin and is essential for precise and compatible manipulation of many Mixins.)) 
-provide for modifying source code. Most of these tools are provided to the users in the form of Java annotations, those annotations are associated to members of the Mixin class, itself annotated with ''@Mixin'' and [[tutorial:mixin_registration|registered]]. These annotations are used to communicate to Mixin how to treat different elements of the Mixin class during the target's modification process.+provide for modifying bytecode. Most of these tools are provided to the users in the form of Java annotations, those annotations are associated to members of the Mixin class, itself annotated with ''@Mixin'' and [[tutorial:mixin_registration|registered]]. These annotations are used to communicate to Mixin how to treat different elements of the Mixin class during the target's modification process.
  
 As to make reading more precise documentation easier, here is a basic overview of some of Mixin's most important features:\\ As to make reading more precise documentation easier, here is a basic overview of some of Mixin's most important features:\\
Line 32: Line 33:
  
 The Fabric Wiki offers several articles that provide practical examples and explanations of some areas of Mixin and MixinExtras: The Fabric Wiki offers several articles that provide practical examples and explanations of some areas of Mixin and MixinExtras:
 +  * [[tutorial:mixin_glossary|Mixin Glossary]]
   * [[tutorial:mixin_your_first_mixin|Tutorial: Making your first Mixin]]   * [[tutorial:mixin_your_first_mixin|Tutorial: Making your first Mixin]]
 +  * [[https://docs.fabricmc.net/develop/mixins/bytecode|Java Bytecode (Docs)]] 
   * [[tutorial:mixin_registration|Mixin registration]]   * [[tutorial:mixin_registration|Mixin registration]]
-  * [[tutorial:mixin_injects|Injects]]+  * [[tutorial:mixin_injects|@Inject]]
   * [[tutorial:mixin_accessors|Accessors and Invokers]]   * [[tutorial:mixin_accessors|Accessors and Invokers]]
 +  * [[tutorial:mixin_override|Overriding a Mixin Target's parent]]
   * [[tutorial:mixin_redirectors|Redirectors]]   * [[tutorial:mixin_redirectors|Redirectors]]
     * [[tutorial:mixin_redirectors_methods|Method redirectors]]     * [[tutorial:mixin_redirectors_methods|Method redirectors]]
Line 41: Line 45:
   * [[tutorial:mixin_examples|Examples]]   * [[tutorial:mixin_examples|Examples]]
   * [[tutorial:mixin_hotswaps|Hotswapping Mixins]]   * [[tutorial:mixin_hotswaps|Hotswapping Mixins]]
-  * [[tutorial:mixin_export|Exporting Mixin Classes]]+  * [[tutorial:mixin_export|Exporting and Dumping Mixin Targets]]
   * [[tutorial:accesswidening|Access Widening]]   * [[tutorial:accesswidening|Access Widening]]
   * [[tutorial:reflection|Reflection]]   * [[tutorial:reflection|Reflection]]
   * [[tutorial:interface_injection|Interface Injection]]    * [[tutorial:interface_injection|Interface Injection]] 
   * [[tutorial:modding_tips|Modding Tips]]   * [[tutorial:modding_tips|Modding Tips]]
tutorial/mixin_introduction.1763731610.txt.gz · Last modified: 2025/11/21 13:26 by gauntrecluse