Skip to content

Commit a0233c0

Browse files
committed
stop NonUpdate from breaking the update checker
1 parent ab18b45 commit a0233c0

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

src/main/java/com/falsepattern/lib/internal/asm/FPTransformer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ public class FPTransformer implements SmartTransformer {
4545
private final Logger logger = LOG;
4646

4747
public FPTransformer() {
48-
transformers = Arrays.asList(new IMixinPluginTransformer(), new ITypeDiscovererTransformer());
48+
transformers = Arrays.asList(new IMixinPluginTransformer(), new ITypeDiscovererTransformer(), new NonUpdateTransformer());
4949
}
5050
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright (C) 2022 FalsePattern
3+
* All Rights Reserved
4+
*
5+
* The above copyright notice, this permission notice and the word "SNEED"
6+
* shall be included in all copies or substantial portions of the Software.
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Lesser General Public License as published by
10+
* the Free Software Foundation, either version 3 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU Lesser General Public License
19+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
*/
21+
22+
package com.falsepattern.lib.internal.asm;
23+
24+
import com.falsepattern.lib.asm.IClassNodeTransformer;
25+
import lombok.val;
26+
import org.objectweb.asm.tree.ClassNode;
27+
import org.objectweb.asm.tree.MethodNode;
28+
29+
public class NonUpdateTransformer implements IClassNodeTransformer {
30+
@Override
31+
public String getName() {
32+
return "NonUpdateTransformer";
33+
}
34+
35+
@Override
36+
public boolean shouldTransform(ClassNode cn, String transformedName, boolean obfuscated) {
37+
return "moe.mickey.forge.nonupdate.NonUpdate".equals(transformedName);
38+
}
39+
40+
@Override
41+
public void transform(ClassNode cn, String transformedName, boolean obfuscated) {
42+
MethodNode toRemove = null;
43+
for (val method: cn.methods) {
44+
if (method.name.equals("init")) {
45+
toRemove = method;
46+
break;
47+
}
48+
}
49+
cn.methods.remove(toRemove);
50+
}
51+
}

0 commit comments

Comments
 (0)