mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-22 20:09:46 +00:00
Get Ready for Forge 1.13
This commit is contained in:
1 parent
bfd1b41ecc
commit
d789119c8f
9 files changed
+111
-10
No files matched your search
@@ -0,0 +1,25 @@
|
||||
package customskinloader.forge.remapper;
|
||||
|
||||
import org.objectweb.asm.commons.ClassRemapper;
|
||||
import org.objectweb.asm.commons.Remapper;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
// https://github.com/NekoCaffeine/Alchemy/blob/rebirth/src/main/java/index/alchemy/util/ASMHelper.java#L652-L672
|
||||
public class ClassNameRemapper extends Remapper {
|
||||
|
||||
private final String srcName, newName;
|
||||
|
||||
public ClassNameRemapper(String srcName, String newName) {
|
||||
this.srcName = srcName;
|
||||
this.newName = newName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String map(String typeName) {
|
||||
return srcName.equals(typeName) ? newName : super.map(typeName);
|
||||
}
|
||||
|
||||
public static void remapClassName(ClassNode cn, String srcName, String newName) {
|
||||
cn.accept(new ClassRemapper(null, new ClassNameRemapper(srcName, newName)));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user