Skip to content

Commit c0fb393

Browse files
committed
get actual tool tier origin class
1 parent 183cd7b commit c0fb393

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/mixin/java/mcp/mobius/waila/mixin/SimpleTierMixin.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,15 @@ public class SimpleTierMixin {
2323
@Inject(method = "<init>", at = @At("TAIL"))
2424
private void wthit_init(CallbackInfo ci) {
2525
if (wthit_stackWalker == null) wthit_stackWalker = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
26-
IMixinService.INSTANCE.addTierInstance((Tier) this, wthit_stackWalker.getCallerClass());
26+
27+
var caller = wthit_stackWalker.walk(s -> s
28+
.skip(2)
29+
.map(StackWalker.StackFrame::getDeclaringClass)
30+
.findFirst()
31+
.orElse(null));
32+
if (caller == null) caller = wthit_stackWalker.getCallerClass();
33+
34+
IMixinService.INSTANCE.addTierInstance((Tier) this, caller);
2735
}
2836

2937
}

0 commit comments

Comments
 (0)