The access transformer file format allows for targetting classes and their members for transformation of the access_flags element of the member. This allows for transforming private methods into public methods, for example.
Java Language Specification for class files
public
transforms the member to be publicprotected
transforms the member to be protectedprivate
transforms the member to be privatedefault
transforms the member to be package private ('default')
Any access transform can have +f
or -f
appended to add or remove the ACC_FINAL flag.
Targets can be classes, methods or fields. The *
wildcard can replace a method or field name.
Methods are identified by parentheses after the member name.
Comments are delimited by a #
sign. All content until end of line is ignored.
An access transformation pre-processor is required to allow compilation against access-transformed compiled code.
ForgeGradle has such a tool. Other tools are available to do the same thing.
<access modifier> <classname>
Example. Transforms the class net.minecraft.world.gen.structure.StructureVillagePieces$Village
to public.
public net.minecraft.world.gen.structure.StructureVillagePieces$Village
<access modifier> <classname> <methodname><methodsignature>
Example. Transforms the method boolean net.minecraft.world.World.isValid(BlockPos p)
to public.
public net.minecraft.world.World isValid(Lnet/minecraft/util/math/BlockPos;)Z
Example. Transforms all methods in class net.minecraft.world.biome.Biome
to public.
public net.minecraft.world.biome.Biome *()
<access modifier> <classname> <fieldname>
Example. Transforms the field net.minecraft.world.WorldType.worldTypes
to public with the final flag removed.
public-f net.minecraft.world.WorldType worldTypes
Example. Transforms all fields in class net.minecraft.client.gui.GuiIngame
to protected.
protected net.minecraft.client.gui.GuiIngame *