User Tools

Site Tools


tutorial:mixin_tips

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
Next revisionBoth sides next revision
tutorial:mixin_tips [2022/08/17 22:22] – Added page description clomclemtutorial:mixin_tips [2023/08/18 09:19] – Removed apostrophe treeway7
Line 11: Line 11:
 It's fair to say that you should never instantiate a mixin class, mainly because the class doesn't make sense to java if it isn't used in a mixin environment, and there are other ways to access methods declared in a mixin. It's fair to say that you should never instantiate a mixin class, mainly because the class doesn't make sense to java if it isn't used in a mixin environment, and there are other ways to access methods declared in a mixin.
  
-Declaring a mixin class abstract doesn't affect it'function, and it becomes protected against accidental instantiation.+Declaring a mixin class abstract doesn't affect its function, and it becomes protected against accidental instantiation.
  
 <code java> <code java>
Line 26: Line 26:
 <code java> <code java>
 @Shadow @Shadow
-private void hiddenMethod() {/*dummy body*/}+protected void hiddenMethod() {/*dummy body*/}
 </code> </code>
  
Line 32: Line 32:
 <code java> <code java>
 @Shadow @Shadow
-private abstract void hiddenMethod(); // no dummy body necessary+protected abstract void hiddenMethod(); // no dummy body necessary
 </code> </code>
 +
 +Note: this doesn't work with private methods, since you can't have private abstract methods, and hence you need to use the normal one.
  
  
tutorial/mixin_tips.txt · Last modified: 2023/12/18 02:06 by solidblock