This is an old revision of the document!
Table of Contents
Access Wideners
Access wideners provide a way to loosen the access limits of classes, methods or fields. Access wideners similar to the commonly known Access Transformers.
Access wideners should only be used where mixin does not currenly provide a means to do so.
Requirements
- Fabric-loader 0.8.0 or higher
- Loom 0.7.0 or higher
File format
A specific file format is used to define the access changes included in your mod. To aid IDE's a you should use the `.accesswidener` file extension.
The file must start with the following header, `namespace` should match the mappings namespace of your mod's source code, this is usually `named` loom will remap the access widener file for you into `intermediary` along with your mod.
accessWidener v1 <namespace>
Access widener files can have blank lines and comments starting with #
# Comments like this are supported, as well at the end of the line
Any whitespace can be used to sperate in the access widner file, tab is recommended.
Classes
Class access can be changed by specifying the access and the class name as named the mappings namespace defined in the header.
<access> class <className>
- access can be accessible or extendable
Methods
Method access can be changed by specifying the access, class name, method name and method descriptior as named the mappings namespace defined in the header.
<access> method <className> <methodName> <methodDesc>
- access can be accessible or extendable
- classname is the owner class
- methodName is the method name
- methodDesc is the method descriptior
Fields
Field access can be changed by specifying the access, class name, field name and field descriptior as named the mappings namespace defined in the header.
<access> method <className> <fieldName> <fieldDesc>
- access can be accessible or mutable
- classname is the owner class
- fieldNameis the field name
- fieldDescis the field descriptior
Access Changes
Extendable
Extendable should be used where you want to extend a class or override a method.
- Classes are made public and final is removed
- Methods are made protected and final is removed
Making a method extendable also makes the class extendable.
Accessible
Accessible should be used when you want to access a class, field or method from another class.
- Classes are made public
- Methods are made public and final if private
- Fields are made public
Making a method or field accessible also makes the class accessible.
Mutable
Mutable should be used when you want to mutate a final field
- Fields have final removed
Specifying file location
The access widener file location must be specified in your build.gradle and in your fabric.mod.json file. It should be stored in the resources as it needs to be included in the exported jar file.
minecraft { accessWidener = file("src/main/resources/modid.accesswidener") }
... "accessWidener" : "modid.accesswidener"," ...