tutorial:accesswideners
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tutorial:accesswideners [2020/06/12 11:34] – Update to briefer version of access widener in build.gradle earthcomputer | tutorial:accesswideners [2021/07/29 20:07] – modmuss50 | ||
---|---|---|---|
Line 3: | Line 3: | ||
Access wideners provide a way to loosen the access limits of classes, methods or fields. Access wideners are similar to the commonly known Access Transformers. | Access wideners provide a way to loosen the access limits of classes, methods or fields. Access wideners are similar to the commonly known Access Transformers. | ||
- | Access wideners should only be used where mixin does not currently provide a means to do so. | + | Access wideners should |
+ | There are currently only 2 cases where mixins are not sufficient: | ||
+ | * Needing to access a (package) private class, especially for the purpose of shadowing or accessing a field or method in a mixin. | ||
+ | * Being able to override final methods or subclass final classes. | ||
+ | * Before you consider overriding final methods, try mixin injecting in final methods first! | ||
+ | * If you want to subclass a class with only (package) private constructors, | ||
+ | |||
+ | In order for access widener changes to show up in the decompiled source, run the '' | ||
===== Requirements ===== | ===== Requirements ===== | ||
* Fabric-loader 0.8.0 or higher | * Fabric-loader 0.8.0 or higher | ||
* Loom 0.2.7 or higher | * Loom 0.2.7 or higher | ||
- | |||
===== File format ===== | ===== File format ===== | ||
- | A specific file format is used to define the access changes included in your mod. To aid IDE's you should use the `.accesswidener` file extension. | + | A specific file format is used to define the access changes included in your mod. To aid IDE's you should use the '' |
- | The file must start with the following header, | + | The file must start with the following header, |
<code [enable_line_numbers=" | <code [enable_line_numbers=" | ||
accessWidener v1 < | accessWidener v1 < | ||
</ | </ | ||
+ | |||
+ | **Once again, the namespace should match '' | ||
Access widener files can have blank lines and comments starting with # | Access widener files can have blank lines and comments starting with # | ||
<code [enable_line_numbers=" | <code [enable_line_numbers=" | ||
- | # Comments like this are supported, as well at the end of the line | + | # Comments like this are supported, as well as at the end of the line |
</ | </ | ||
Line 100: | Line 108: | ||
<code groovy [enable_line_numbers=" | <code groovy [enable_line_numbers=" | ||
- | minecraft | + | loom { |
- | accessWidener | + | accessWidenerPath = file(" |
} | } | ||
</ | </ | ||
Line 108: | Line 116: | ||
... | ... | ||
- | " | + | " |
... | ... | ||
</ | </ |
tutorial/accesswideners.txt · Last modified: 2024/06/09 05:33 by haykam