Fix mixin compat plugin logger name resolution
This commit is contained in:
1 file changed
+21
-3
@@ -17,12 +17,30 @@ public class CompatMixinPlugin implements IMixinConfigPlugin {
|
||||
Set<String> skippedModCompats = new HashSet<>();
|
||||
Logger logger;
|
||||
|
||||
private static int lastIndexOf(String target, String[] array) {
|
||||
int x = array.length - 1;
|
||||
while (x >= 0) {
|
||||
String s = array[x--];
|
||||
if (Objects.equals(s, target)) break;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad(String mixinPackage) {
|
||||
String[] split = mixinPackage.split("\\.");
|
||||
int x = split.length;
|
||||
String s = split[--x];
|
||||
while (s.isBlank() && x > 0) s = split[--x];
|
||||
int x;
|
||||
String s = null;
|
||||
if ((x = lastIndexOf("mixin", split)) == -1) {
|
||||
if ((x = lastIndexOf("mixins", split)) == -1) {
|
||||
x = split.length;
|
||||
s = split[--x];
|
||||
while ((s.isBlank()) && x > 0) s = split[--x];
|
||||
}
|
||||
}
|
||||
if (s == null) {
|
||||
s = split[x];
|
||||
}
|
||||
logger = LoggerFactory.getLogger(s+"/MixinCompat");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user