1818import org .mcphackers .mcp .tasks .mode .TaskParameter ;
1919import org .mcphackers .mcp .tools .FileUtil ;
2020import org .mcphackers .mcp .tools .mappings .MappingUtil ;
21- import org .mcphackers .rdi .injector .RDInjector ;
2221import org .mcphackers .rdi .injector .data .ClassStorage ;
2322import org .mcphackers .rdi .injector .data .Mappings ;
23+ import org .mcphackers .rdi .nio .MappingsIO ;
24+ import org .mcphackers .rdi .nio .RDInjector ;
2425import org .mcphackers .rdi .util .ClassStorageWriter ;
2526import org .objectweb .asm .ClassReader ;
2627import org .objectweb .asm .ClassWriter ;
@@ -119,7 +120,7 @@ private Mappings getMappings(ClassStorage storage, Side side) throws IOException
119120 }
120121 final boolean enableObfuscation = mcp .getOptions ().getBooleanParameter (TaskParameter .OBFUSCATION );
121122 boolean joined = MappingUtil .readNamespaces (mappingsPath ).contains ("official" );
122- Mappings mappings = Mappings .read (mappingsPath , "named" , joined ? "official" : side .name );
123+ Mappings mappings = MappingsIO .read (mappingsPath , "named" , joined ? "official" : side .name );
123124 modifyClassMappings (mappings , storage .getAllClasses (), enableObfuscation );
124125 return mappings ;
125126 }
@@ -130,7 +131,7 @@ private void modifyClassMappings(Mappings mappings, List<String> classNames, boo
130131 for (String className : classNames ) {
131132 String reobfName = mappings .classes .get (className );
132133 if (reobfName == null /*&& !hashes.containsKey(className)*/ ) {
133- int i1 = className .indexOf ('/' );
134+ int i1 = className .lastIndexOf ('/' );
134135 String packageName = i1 == -1 ? "" : className .substring (0 , i1 + 1 );
135136 String obfPackage = packageMappings .get (packageName );
136137 String clsName = i1 == -1 ? className : className .substring (i1 + 1 );
@@ -161,8 +162,8 @@ private void modifyClassMappings(Mappings mappings, List<String> classNames, boo
161162 private static Map <String , String > getPackageMappings (Map <String , String > classMappings ) {
162163 Map <String , String > packageMappings = new HashMap <>();
163164 for (Entry <String , String > entry : classMappings .entrySet ()) {
164- int i1 = entry .getKey ().indexOf ('/' );
165- int i2 = entry .getValue ().indexOf ('/' );
165+ int i1 = entry .getKey ().lastIndexOf ('/' );
166+ int i2 = entry .getValue ().lastIndexOf ('/' );
166167 String name1 = i1 == -1 ? "" : entry .getKey ().substring (0 , i1 + 1 );
167168 String name2 = i2 == -1 ? "" : entry .getKey ().substring (0 , i2 + 1 );
168169 packageMappings .put (name1 , name2 );
0 commit comments