Package net.neoforged.neoforge.coremods
Class ReplaceFieldWithGetterAccess
java.lang.Object
net.neoforged.neoforge.coremods.ReplaceFieldWithGetterAccess
- All Implemented Interfaces:
cpw.mods.modlauncher.api.ITransformer<org.objectweb.asm.tree.ClassNode>
public class ReplaceFieldWithGetterAccess
extends Object
implements cpw.mods.modlauncher.api.ITransformer<org.objectweb.asm.tree.ClassNode>
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 interface cpw.mods.modlauncher.api.ITransformer
cpw.mods.modlauncher.api.ITransformer.Target<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Set<cpw.mods.modlauncher.api.ITransformer.Target<org.objectweb.asm.tree.ClassNode>> Fields inherited from interface cpw.mods.modlauncher.api.ITransformer
DEFAULT_LABEL -
Constructor Summary
ConstructorsConstructorDescriptionReplaceFieldWithGetterAccess(String className, Map<String, String> fieldToMethod) -
Method Summary
Modifier and TypeMethodDescriptioncpw.mods.modlauncher.api.TransformerVoteResultcastVote(cpw.mods.modlauncher.api.ITransformerVotingContext context) cpw.mods.modlauncher.api.TargetType<org.objectweb.asm.tree.ClassNode> private static voidredirectFieldToMethod(org.objectweb.asm.tree.ClassNode classNode, String fieldName, @Nullable String methodName) Set<cpw.mods.modlauncher.api.ITransformer.Target<org.objectweb.asm.tree.ClassNode>> targets()org.objectweb.asm.tree.ClassNodetransform(org.objectweb.asm.tree.ClassNode input, cpw.mods.modlauncher.api.ITransformerVotingContext context) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface cpw.mods.modlauncher.api.ITransformer
labels
-
Field Details
-
fieldToMethod
-
targets
private final Set<cpw.mods.modlauncher.api.ITransformer.Target<org.objectweb.asm.tree.ClassNode>> targets
-
-
Constructor Details
-
ReplaceFieldWithGetterAccess
-
-
Method Details
-
getTargetType
public cpw.mods.modlauncher.api.TargetType<org.objectweb.asm.tree.ClassNode> getTargetType()- Specified by:
getTargetTypein interfacecpw.mods.modlauncher.api.ITransformer<org.objectweb.asm.tree.ClassNode>
-
targets
public Set<cpw.mods.modlauncher.api.ITransformer.Target<org.objectweb.asm.tree.ClassNode>> targets()- Specified by:
targetsin interfacecpw.mods.modlauncher.api.ITransformer<org.objectweb.asm.tree.ClassNode>
-
transform
public org.objectweb.asm.tree.ClassNode transform(org.objectweb.asm.tree.ClassNode input, cpw.mods.modlauncher.api.ITransformerVotingContext context) - Specified by:
transformin interfacecpw.mods.modlauncher.api.ITransformer<org.objectweb.asm.tree.ClassNode>
-
castVote
public cpw.mods.modlauncher.api.TransformerVoteResult castVote(cpw.mods.modlauncher.api.ITransformerVotingContext context) - Specified by:
castVotein interfacecpw.mods.modlauncher.api.ITransformer<org.objectweb.asm.tree.ClassNode>
-
redirectFieldToMethod
-