tutorial:mixin_tips
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tutorial:mixin_tips [2025/09/27 22:52] – [Make abstract classes] Tweak of previous fix gauntrecluse | tutorial:mixin_tips [2025/10/20 00:27] (current) – [Mixing into inner classes] Make example mixin class go from public class -> abstract class gauntrecluse | ||
|---|---|---|---|
| Line 16: | Line 16: | ||
| Should have the following Mixin class: | Should have the following Mixin class: | ||
| < | < | ||
| - | public | + | abstract class SomeMixin extends class_1657 { |
| //... | //... | ||
| } | } | ||
| Line 32: | Line 32: | ||
| <code java> | <code java> | ||
| - | public | + | abstract class SomeMixin implements TargetsInterfaces { |
| //Does not need to implement TargetsInterfaces' | //Does not need to implement TargetsInterfaces' | ||
| } | } | ||
| Line 57: | Line 57: | ||
| :!: This doesn' | :!: This doesn' | ||
| + | |||
| + | If a method requires a return type, it is conventional to throw an '' | ||
| + | <code java> | ||
| + | @Shadow | ||
| + | protected Type hiddenMethod() { | ||
| + | throw new AssertionError(); | ||
| + | } | ||
| + | </ | ||
| ---- | ---- | ||
| Line 94: | Line 102: | ||
| <code java> | <code java> | ||
| @Mixin(targets = " | @Mixin(targets = " | ||
| - | public | + | abstract |
| @Inject(method = " | @Inject(method = " | ||
| private void injected(CallbackInfo ci) { | private void injected(CallbackInfo ci) { | ||
| Line 162: | Line 170: | ||
| <code java> | <code java> | ||
| @Mixin(value = StringReader.class, | @Mixin(value = StringReader.class, | ||
| - | public | + | abstract class StringReaderMixin { ... } |
| </ | </ | ||
| Line 169: | Line 177: | ||
| <code java> | <code java> | ||
| @Mixin(EntitySelectorReader.class) | @Mixin(EntitySelectorReader.class) | ||
| - | public | + | abstract class EntitySelectorReaderMixin { |
| @Inject(method = " | @Inject(method = " | ||
| // your injection method ... | // your injection method ... | ||
| } | } | ||
| </ | </ | ||
| + | |||
| + | :!: Disabling remapping on an annotation causes the internal remapper to skip the annotation entirely, thus, if the '' | ||
| :!: Changing the remap setting may not fix an issue that would apparently seem to be remapping related, however, so it is best to seek direct support for your specific case. | :!: Changing the remap setting may not fix an issue that would apparently seem to be remapping related, however, so it is best to seek direct support for your specific case. | ||
tutorial/mixin_tips.1759013529.txt.gz · Last modified: 2025/09/27 22:52 by gauntrecluse