Class ReplaceFieldWithGetterAccess
java.lang.Object
net.neoforged.neoforgespi.transformation.BaseSimpleProcessor
net.neoforged.neoforgespi.transformation.SimpleClassProcessor
net.neoforged.neoforge.coremods.ReplaceFieldWithGetterAccess
- All Implemented Interfaces:
ClassProcessor
Replaces direct field access in a class with access to the getter.
The field specified by fieldName must be private and non-static. The method-call the field-access is redirected to does not take any parameters and returns an object of the same type as the field. If no methodName is passed, any method matching the described signature will be used as callable method.
-
Nested Class Summary
Nested classes/interfaces inherited from class SimpleClassProcessor
SimpleClassProcessor.TargetNested classes/interfaces inherited from interface ClassProcessor
ClassProcessor.AfterProcessingContext, ClassProcessor.ComputeFlags, ClassProcessor.LinkContext, ClassProcessor.OrderingHint, ClassProcessor.SelectionContext, ClassProcessor.TransformationContext -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final Set<SimpleClassProcessor.Target> Fields inherited from interface ClassProcessor
GENERATED_PACKAGE_MODULE -
Constructor Summary
ConstructorsConstructorDescriptionReplaceFieldWithGetterAccess(String className, Map<String, String> fieldToMethod) -
Method Summary
Modifier and TypeMethodDescriptionname()Returns a unique identifier for this processor.private static voidredirectFieldToMethod(org.objectweb.asm.tree.ClassNode classNode, String fieldName, @Nullable String methodName) targets()Returns the classes targeted by this processor.voidtransform(org.objectweb.asm.tree.ClassNode input, SimpleTransformationContext context) Applies transformations to a targeted class.Methods inherited from class SimpleClassProcessor
handlesClass, processClassMethods inherited from class BaseSimpleProcessor
afterProcessing, link, runsAfterMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ClassProcessor
generatesPackages, orderingHint, runsBefore
-
Field Details
-
fieldToMethod
-
targets
-
className
-
-
Constructor Details
-
ReplaceFieldWithGetterAccess
-
-
Method Details
-
name
Description copied from interface:ClassProcessorReturns a unique identifier for this processor.- Returns:
- a unique identifier for this processor
-
targets
Description copied from class:SimpleClassProcessorReturns the classes targeted by this processor.- Specified by:
targetsin classSimpleClassProcessor- Returns:
- the classes targeted by this processor
-
transform
Description copied from class:SimpleClassProcessorApplies transformations to a targeted class.- Specified by:
transformin classSimpleClassProcessor- Parameters:
input- The ASM input node, which can be mutated directly
-
redirectFieldToMethod
-