-
Notifications
You must be signed in to change notification settings - Fork 88
Private Field Captures
Kiooeht edited this page Nov 2, 2020
·
1 revision
Private Field Captures allow you to receive private field values as parameters to your patch.
To receive a Private Field Capture, add a parameter to your patch method with the same name as the field you want to capture, but prepended with three underscores (e.g. fieldName
becomes ___fieldName
).
- Private Field Captures works on Prefix, Insert, and Postfix patches.
- Private Field Captures come after the formal parameters of the method you are patching.
- @ByRef works with Private Capture Fields.
// This will pass you the private field 'renderTip' of AbstractCard
public static void Prefix(AbstractCard __instance, SpriteBatch sb, boolean ___renderTip)
{
// ...
}
Private Capture Fields must appear in the parameter list before any localvars. This means the order of the parameters is:
- Instance (if applicable)
- Formal parameters of the method you are patching
- Private Field Captures
- localvars
Example:
@SpireInsertPatch(
locator=/*Locator*/,
localvars={"word", "sbuilder2"}
)
public static void Insert(AbstractCard __instance, String description, GlyphLayout ___gl, String word, StringBuilder sbuilder2)
{
// description is a formal parameter of the method being patched
// ___gl is a Private Field Capture
// word and sbuilder2 are localvars
}