mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-21 05:42:15 +00:00
Fix <clinit> not being appended if target class does not have it
This commit is contained in:
1 parent
db4db98b31
commit
db3fc70cce
1 file changed
+7
@@ -561,8 +561,11 @@ public class MixinTransformer extends TreeTransformer {
|
||||
targetMethodName = sourceMethod.name;
|
||||
}
|
||||
|
||||
boolean found = false;
|
||||
|
||||
for (MethodNode method : targetClass.methods) {
|
||||
if ((targetMethodName.equals(method.name)) && sourceMethod.desc.equals(method.desc)) {
|
||||
found = true;
|
||||
AbstractInsnNode returnNode = null;
|
||||
Iterator<AbstractInsnNode> findReturnIter = method.instructions.iterator();
|
||||
while (findReturnIter.hasNext()) {
|
||||
@@ -582,6 +585,10 @@ public class MixinTransformer extends TreeTransformer {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
sourceMethod.name = targetMethodName;
|
||||
targetClass.methods.add(sourceMethod);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user