Line 1:
Line 1:
−
Access Transformers are Forge's native way of allowing you to access (read <code>and </code>write) functions that have a lower-than-ideal visibility, and/or removing finality.
+
Access Transformers are Forge's native way of allowing you to access (read and write) functions that have a lower-than-ideal visibility, and/or removing finality.
== Visibility ==
== Visibility ==
Line 24:
Line 24:
If a valid entry is found on a line, Forge will look into the bytecode of the file where that member is defined, and change its access to whatever you desire it to be.
If a valid entry is found on a line, Forge will look into the bytecode of the file where that member is defined, and change its access to whatever you desire it to be.
−
This startup modification means accessing is O(1) for all accesses after this initial change, which makes it a great option for performance if you're looking at something a lot.
+
This startup modification means accessing is O(1) for all accesses after this initial change, which makes it a great option for performance if you're looking at something a lot
+
+
=== Removing Finality ===
+
Access transformers can also be used to remove the '''final''' keyword on code elements. To do this, append <code>-f</code> to the access specifier.
+
+
An example of this in place:
+
+
<code ->public-f net.minecraft.util.palette.IResizeCallback # makes IResizeCallback public</code>
+
+
Note: You can also use this to ''add'' a final keyword via <code>+f</code>. This is never recommended however, and should be avoided at all costs unless absolutely necessary.
== Using Access Transformers in your mod ==
== Using Access Transformers in your mod ==