mirror of
https://github.com/FalsePattern/FalsePatternLib.git
synced 2026-11-11 18:27:32 +00:00
Weaken NonUpdate fix into warning
This commit is contained in:
3 files changed
+12
-52
No files matched your search
@@ -24,6 +24,8 @@ import lombok.Cleanup;
|
||||
import lombok.val;
|
||||
import lombok.var;
|
||||
|
||||
import net.minecraft.launchwrapper.Launch;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -82,6 +84,15 @@ public class Internet {
|
||||
}
|
||||
connection.disconnect();
|
||||
} catch (Exception e) {
|
||||
//Check if NonUpdate is present
|
||||
try {
|
||||
if (Launch.classLoader.getClassBytes("moe.mickey.forge.nonupdate.NonUpdate") != null) {
|
||||
e.addSuppressed(new Exception("NonUpdate is present, it's possible that it's blocking a library download." +
|
||||
" Please disable it for a single run to allow mod dependencies to download."));
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
e.addSuppressed(ex);
|
||||
}
|
||||
onError.accept(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,6 @@ public class FPTransformer implements SmartTransformer {
|
||||
private final Logger logger = LOG;
|
||||
|
||||
public FPTransformer() {
|
||||
transformers = Arrays.asList(new IMixinPluginTransformer(), new ITypeDiscovererTransformer(), new NonUpdateTransformer(), new GasStationValidatorTransformer());
|
||||
transformers = Arrays.asList(new IMixinPluginTransformer(), new ITypeDiscovererTransformer(), new GasStationValidatorTransformer());
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 FalsePattern
|
||||
* All Rights Reserved
|
||||
*
|
||||
* The above copyright notice, this permission notice and the word "SNEED"
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.falsepattern.lib.internal.asm;
|
||||
|
||||
import com.falsepattern.lib.asm.IClassNodeTransformer;
|
||||
import lombok.val;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
public class NonUpdateTransformer implements IClassNodeTransformer {
|
||||
@Override
|
||||
public String getName() {
|
||||
return "NonUpdateTransformer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldTransform(ClassNode cn, String transformedName, boolean obfuscated) {
|
||||
return "moe.mickey.forge.nonupdate.NonUpdate".equals(transformedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(ClassNode cn, String transformedName, boolean obfuscated) {
|
||||
MethodNode toRemove = null;
|
||||
for (val method: cn.methods) {
|
||||
if (method.name.equals("init")) {
|
||||
toRemove = method;
|
||||
break;
|
||||
}
|
||||
}
|
||||
cn.methods.remove(toRemove);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user