tutorial:mixin_injects
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tutorial:mixin_injects [2020/09/05 10:55] – Reorganize tutorials siglong | tutorial:mixin_injects [2022/08/05 14:11] – Renamed output type and input type to return type and parameter type, and fixed a typo clomclem | ||
---|---|---|---|
Line 2: | Line 2: | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | Injects allows you to place custom code at a specified position inside an existing method. For a working example, view the [[https:// | + | Injects allows you to place custom code at a specified position inside an existing method. For a working example, view the [[tutorial: |
<code java> | <code java> | ||
- | @Inject(method = "", | + | @Inject(method = "METHODNAME", at = @At(" |
private void injectMethod(METHOD ARGS, CallbackInfo info) { | private void injectMethod(METHOD ARGS, CallbackInfo info) { | ||
Line 35: | Line 35: | ||
| [ | reference | one array dimension | | | [ | reference | one array dimension | | ||
- | A method descriptor is comprised of the method name, followed by a set of parentheses containing the input types, followed by the output | + | A method descriptor is comprised of the method name, followed by a set of parentheses containing the parameter |
- | //@Inject// methods always have a void return type. The method name does not matter; using something that describes what the inject does is best. The target method' | + | In the case that the return type is void, you need to use V (Void Descriptor Type) as the type (for example, '' |
+ | |||
+ | Generics' | ||
+ | |||
+ | //@Inject// methods always have a void return type. The method name does not matter | ||
=== Returning & Cancelling from Inject === | === Returning & Cancelling from Inject === |
tutorial/mixin_injects.txt · Last modified: 2022/08/05 19:19 by clomclem