tutorial:mixin_making_your_first_mixin
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
tutorial:mixin_making_your_first_mixin [2025/09/27 06:04] – [Extending the target class's parents] reworded duck interfacing to duck typing gauntrecluse | tutorial:mixin_making_your_first_mixin [2025/09/27 06:42] (current) – Add horizontal line separations between sections; Amend debug segment to mention MCDev breakpoint support, and warn against using loggers as a primary debug tool. gauntrecluse | ||
---|---|---|---|
Line 40: | Line 40: | ||
And that's all there is to actually creating the Mixin Class. It doesn' | And that's all there is to actually creating the Mixin Class. It doesn' | ||
+ | |||
+ | ---- | ||
==== Creating the injector ==== | ==== Creating the injector ==== | ||
Line 124: | Line 126: | ||
The constructor is irrelevant to actual Mixin work, it's only there for the sake of extension. A perceptive reader might notice that we didn't implement any methods. That is another benefit of making our class abstract. Abstract classes, because they are never instantiated, | The constructor is irrelevant to actual Mixin work, it's only there for the sake of extension. A perceptive reader might notice that we didn't implement any methods. That is another benefit of making our class abstract. Abstract classes, because they are never instantiated, | ||
- | ==== Debugging with Mixins ==== | + | ---- |
- | There are many ways to debug mod code in general, and most apply to code you mixed into aswell, but Mixin also provides a very useful utility for debugging; namely, the '' | + | ==== Debugging Mixins ==== |
+ | |||
+ | === The @Debug export feature === | ||
+ | Mixin provides a very useful utility for debugging; namely, the '' | ||
Adding it to our tutorial class it should look like: | Adding it to our tutorial class it should look like: | ||
Line 147: | Line 152: | ||
:!: //The '' | :!: //The '' | ||
+ | === Breakpoints and MCDev === | ||
+ | |||
+ | Breakpoints don't natively work with Mixin classes as they get merged at runtime. However, MCDev adds breakpoint support in Mixin Classes directly, allowing you to debug with them by directly putting them in your Mixins rather than having to try and anticipate your injector. | ||
+ | |||
+ | === Loggers === | ||
+ | |||
+ | Logger calls can be very handy when trying to debug complex logical flows or just for general warning and error notifications. And whilst that may be useful for debugging, one should be particularly careful when using them anywhere that' | ||
+ | |||
+ | |||
+ | ---- | ||
==== Closing Thoughts and where to go next ==== | ==== Closing Thoughts and where to go next ==== |
tutorial/mixin_making_your_first_mixin.txt · Last modified: 2025/09/27 06:42 by gauntrecluse