diff --git a/src/main/java/catserver/server/remapper/RemapUtils.java b/src/main/java/catserver/server/remapper/RemapUtils.java index 0d5694e16..101c33663 100644 --- a/src/main/java/catserver/server/remapper/RemapUtils.java +++ b/src/main/java/catserver/server/remapper/RemapUtils.java @@ -158,4 +158,21 @@ public static boolean isNeedRemapClass(Class clazz, boolean checkSuperClass) classNeedRemap.put(className, false); return false; } + + public static String fixSimpleName(String originSimpleName, String remappedSimpleName) { + if (remappedSimpleName.contains("$")) { + String[] originSplit = originSimpleName.split("\\$"); + String[] remappedSplit = remappedSimpleName.split("\\$"); + int length = remappedSplit.length - originSplit.length; + if (length > 0) { + StringBuilder sb = new StringBuilder(); + while (length > 0) { + sb.append(remappedSplit[length - 1]); + if (--length > 0) sb.append("$"); + } + return sb.toString(); + } + } + return remappedSimpleName; + } } diff --git a/src/main/java/catserver/server/remapper/target/ReflectionMethods.java b/src/main/java/catserver/server/remapper/target/ReflectionMethods.java index ec1d80ddc..cc3041764 100644 --- a/src/main/java/catserver/server/remapper/target/ReflectionMethods.java +++ b/src/main/java/catserver/server/remapper/target/ReflectionMethods.java @@ -43,7 +43,7 @@ public static String getSimpleName(Class inst) { String cache = simpleNameGetNameCache.get(inst); if (cache != null) return cache; String[] name = RemapUtils.reverseMapExternal(inst).split("\\."); - String retn = name[name.length - 1]; + String retn = RemapUtils.fixSimpleName(name[name.length - 1], inst.getSimpleName()); simpleNameGetNameCache.put(inst, retn); return retn; }