File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
src/mixin/java/mcp/mobius/waila/mixin Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,15 @@ public class ToolMaterialMixin {
1818 @ Inject (method = "<init>" , at = @ At ("TAIL" ))
1919 private void wthit_init (CallbackInfo ci ) {
2020 if (wthit_stackWalker == null ) wthit_stackWalker = StackWalker .getInstance (StackWalker .Option .RETAIN_CLASS_REFERENCE );
21- IMixinService .INSTANCE .addToolMaterialInstance ((ToolMaterial ) (Object ) this , wthit_stackWalker .getCallerClass ());
21+
22+ var caller = wthit_stackWalker .walk (s -> s
23+ .skip (2 )
24+ .map (StackWalker .StackFrame ::getDeclaringClass )
25+ .findFirst ()
26+ .orElse (null ));
27+ if (caller == null ) caller = wthit_stackWalker .getCallerClass ();
28+
29+ IMixinService .INSTANCE .addToolMaterialInstance ((ToolMaterial ) (Object ) this , caller );
2230 }
2331
2432}
You can’t perform that action at this time.
0 commit comments