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<>();
|
Set<String> skippedModCompats = new HashSet<>();
|
||||||
Logger logger;
|
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
|
@Override
|
||||||
public void onLoad(String mixinPackage) {
|
public void onLoad(String mixinPackage) {
|
||||||
String[] split = mixinPackage.split("\\.");
|
String[] split = mixinPackage.split("\\.");
|
||||||
int x = split.length;
|
int x;
|
||||||
String s = split[--x];
|
String s = null;
|
||||||
while (s.isBlank() && x > 0) s = split[--x];
|
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");
|
logger = LoggerFactory.getLogger(s+"/MixinCompat");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user