Draft
Conversation
✅ Deploy Preview for nimble-elf-d9d491 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
IThundxr
previously requested changes
Jul 10, 2024
✅ Deploy Preview for nimble-elf-d9d491 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
its-miroma
requested changes
Mar 24, 2026
Member
its-miroma
left a comment
There was a problem hiding this comment.
Should we get the Person and PersonMixin classes in reference, even though they wouldn't be used at all?
| } | ||
|
|
||
| public int getAge() { | ||
| mixinMerged_logAgeAccess(); // <- Injected call to mixinMerged_logAccess |
Member
There was a problem hiding this comment.
Suggested change
| mixinMerged_logAgeAccess(); // <- Injected call to mixinMerged_logAccess | |
| mixinMerged_logAgeAccess(); // ![code highlight] |
|
|
||
| There are many different types of annotations, many of them can do more than inject simple calls to method, and they each have their purpose and use cases. Later we will learn how to choose the right one for the goal and how to use them appropriately. | ||
|
|
||
| ## Wait, What Do You Mean By "At Runtime"? {#wait-what-do-you-mean-by-at-runtime} |
Member
There was a problem hiding this comment.
Suggested change
| ## Wait, What Do You Mean By "At Runtime"? {#wait-what-do-you-mean-by-at-runtime} | |
| ## Wait, What Do You Mean by "At Runtime"? {#wait-what-do-you-mean-by-at-runtime} |
|
|
||
| But here's the thing, we _know_ that the `age` field will be available to the injected method when the game runs, as the method will be merged with the `Person` class. If only there was a way to tell the compiler that `age` will exist and to let us access it. | ||
|
|
||
| Let's consider an annotation that does that, called `@Shadow`. What we do now is that we add the `age` field to our mixin class like any other regular field, but we annotate it with `@Shadow` to let the compiler know that this field will refer to the `age` field of the mixin's target class. |
Member
There was a problem hiding this comment.
Suggested change
| Let's consider an annotation that does that, called `@Shadow`. What we do now is that we add the `age` field to our mixin class like any other regular field, but we annotate it with `@Shadow` to let the compiler know that this field will refer to the `age` field of the mixin's target class. | |
| There is an annotation that does just that, called `@Shadow`. What we need to do is to add the `age` field to our mixin class, like any other regular field, but we annotate it with `@Shadow` to let the compiler know that this field will refer to the `age` field of the mixin's target class. |
Comment on lines
+226
to
+227
| Then, we can modify our mixin like so: | ||
|
|
Member
There was a problem hiding this comment.
Suggested change
| Then, we can modify our mixin like so: |
Comment on lines
+250
to
+251
| On the topic of abstract mixin classes, let's finally discuss why mixin classes should be abstract. | ||
|
|
Member
There was a problem hiding this comment.
Suggested change
| On the topic of abstract mixin classes, let's finally discuss why mixin classes should be abstract. |
|
|
||
| ## Abstract Mixin Classes {#abstract-mixin-classes} | ||
|
|
||
| There are a few advantages of making your mixin classes abstract. Apart from making semantic sense (a mixin class should never be instantiated directly), it allows you to access the `this` instance. |
Member
There was a problem hiding this comment.
Suggested change
| There are a few advantages of making your mixin classes abstract. Apart from making semantic sense (a mixin class should never be instantiated directly), it allows you to access the `this` instance. | |
| Let's finally discuss why mixin classes should be abstract. There are a few advantages of making your mixin classes abstract. Apart from making sense semantically (a mixin class should never be instantiated directly), it allows you to access the `this` instance. |
Comment on lines
+275
to
+276
|
|
||
| We are now ready to get started with creating our first mixin in our Fabric mod! |
Member
There was a problem hiding this comment.
Suggested change
| We are now ready to get started with creating our first mixin in our Fabric mod! |
Member
There was a problem hiding this comment.
File name should be index.md
| items: [ | ||
| { | ||
| text: "develop.mixins.introduction", | ||
| link: "/develop/mixins/introduction", |
Member
There was a problem hiding this comment.
Suggested change
| link: "/develop/mixins/introduction", | |
| link: "/develop/mixins/", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This Mixin will create an emphasis on building an intuitive understanding of mixins, as well as how to properly write them using modern mixin features, as well as teaching the proper foundations so that one can learn the decision making involved when choosing the type of mixin to use.
This is still a work in progress.