User Tools

Site Tools


tutorial:mixin_injects

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
tutorial:mixin_injects [2020/02/07 01:45] – clean up example draylartutorial:mixin_injects [2020/02/07 01:46] – final cleanup draylar
Line 24: Line 24:
  
 === Returning & Cancelling from Inject === === Returning & Cancelling from Inject ===
-To cancel or return early inside a method, use ''CallbackInfo#cancel'' or ''CallbackInfoReturnable<T>#setReturnValue(T)''. In both instances, ''cancellable' will have to be set to true in the inject annotation:+To cancel or return early inside a method, use ''CallbackInfo#cancel'' or ''CallbackInfoReturnable<T>#setReturnValue(T)''. In both instances, ''cancellable'' will have to be set to true in the inject annotation:
 <code java> <code java>
 @Inject(method = "...", at = @At("..."), cancellable = true) @Inject(method = "...", at = @At("..."), cancellable = true)
 </code> </code>
 +
 +
  
 ===== Practical Example ===== ===== Practical Example =====
tutorial/mixin_injects.txt · Last modified: 2022/08/05 19:19 by clomclem