Closed DethRaid closed 3 years ago
From what I am aware of Javac will create a field called this$0
or similar (check with a primitive decompiler that does not attempt to remove synthetics) that contains a reference to it. You can simply do a shadow on that field
Is there a primitive decompiler you'd recommend, or do you know how to tell IntelliJ's decompiler to not remove synthetics?
Recaf's (or most other GUI bytecode viewers) table mode does a good enough job for this, but from my experience procyon is also pretty good at such stuff
Ooh, perfect
Turns out, the field is named field_20839
in this class lol
Thank you for your help!
I can compile successfully, and the mod works well, but an error is reported during the compilation: Cannot find target for @Shadow field in net.minecraft.item.map.MapState$PlayerUpdateTracker
,my shadow field is
@Final
@Shadow()
MapState field_132;
I want to know how to remove this error report, thanks.
@pentyum I don't believe you intended to comment as a reply to this ticket. You may want to check which issue / thread you are in.
@pentyum I don't believe you intended to comment as a reply to this ticket. You may want to check which issue / thread you are in.
I have a same problem. I want to access MapState.this
in the non-static inner class net.minecraft.item.map.MapState$PlayerUpdateTracker
. I find this field has a name field_132
in the bytecode. MapState.this
is indeed accessible through field_132
in my mixin class, but an error will be reported during compilation. I have tried adding the annotation @SuppressWarnings("ShadowTarget")
but it doesn't work.
This is an issue tracker not a support forum. Since your question doesn't relate to a bug or feature with mixin please use discord for support.
I'm making a mixin to replace some code in a non-static inner class. I need to call a method on the outer class - which means I need a reference to the outer class. How can I get a reference to the outer class from within a mixin?