tutorial:mixin_examples

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorial:mixin_examples [2023/12/18 02:24] – [Capturing locals from multiple locals of a type] solidblocktutorial:mixin_examples [2024/11/18 15:52] (current) – fixed some of the argument names in mixinextra section bemoty
Line 272: Line 272:
  
 ==== Capture locals with MixinExtras ==== ==== Capture locals with MixinExtras ====
 +:!: See the oficial MixinExtra's [[https://github.com/LlamaLad7/MixinExtras/wiki/Local|Wiki]].
 +
 :!: MixinExtras required Fabric Loader 0.15 or above, or you have to manually specify it in ''build.gradle''. :!: MixinExtras required Fabric Loader 0.15 or above, or you have to manually specify it in ''build.gradle''.
  
-:!: If ther are multiple locals with that type, you have to specify ''ordinal'' or it will throw an error.+:!: If there are multiple locals with that type, you have to specify ''ordinal'' or it will throw an error.
  
 Mixin: Mixin:
Line 280: Line 282:
 @Inject(method = "foo()V", at = @At(value = "TAIL")) @Inject(method = "foo()V", at = @At(value = "TAIL"))
 private void injected(CallbackInfo ci, @Local TypeArg2 arg2) { private void injected(CallbackInfo ci, @Local TypeArg2 arg2) {
-  arg1.doSomething4();+  arg2.doSomething4();
 } }
 </code> </code>
Line 301: Line 303:
 @Inject(method = "foo()V", at = @At(value = "TAIL")) @Inject(method = "foo()V", at = @At(value = "TAIL"))
 private void injected(CallbackInfo ci, @Local(ordinal = 2) TypeArg arg) { private void injected(CallbackInfo ci, @Local(ordinal = 2) TypeArg arg) {
-  arg1.doSomething4();+  arg.doSomething4();
 } }
 </code> </code>
tutorial/mixin_examples.1702866271.txt.gz · Last modified: 2023/12/18 02:24 by solidblock