summaryrefslogtreecommitdiff
path: root/src/main/java/cc
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-06-18 15:26:40 +0700
committerGitHub <noreply@github.com>2022-06-18 10:26:40 +0200
commit56771dd0f87b9a3d6ce689b5185222635158f64f (patch)
tree654931a2b9115eee9338ebcbad59997586200ae4 /src/main/java/cc
parent02cdadd63ec46c42689deadd29eb4779d2b191c1 (diff)
downloadOneConfigLoader-56771dd0f87b9a3d6ce689b5185222635158f64f.tar.gz
OneConfigLoader-56771dd0f87b9a3d6ce689b5185222635158f64f.tar.bz2
OneConfigLoader-56771dd0f87b9a3d6ce689b5185222635158f64f.zip
migrate to tweaker (#4)
Diffstat (limited to 'src/main/java/cc')
-rw-r--r--src/main/java/cc/polyfrost/oneconfigloader/OneConfigLoader.java36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfigloader/OneConfigLoader.java b/src/main/java/cc/polyfrost/oneconfigloader/OneConfigLoader.java
index 4acb163..4d1f988 100644
--- a/src/main/java/cc/polyfrost/oneconfigloader/OneConfigLoader.java
+++ b/src/main/java/cc/polyfrost/oneconfigloader/OneConfigLoader.java
@@ -3,8 +3,9 @@ package cc.polyfrost.oneconfigloader;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
+import net.minecraft.launchwrapper.ITweaker;
import net.minecraft.launchwrapper.Launch;
-import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
+import net.minecraft.launchwrapper.LaunchClassLoader;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -22,11 +23,10 @@ import java.nio.file.StandardCopyOption;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
-import java.util.Map;
+import java.util.List;
import java.util.Objects;
-@IFMLLoadingPlugin.MCVersion("1.8.9")
-public class OneConfigLoader implements IFMLLoadingPlugin {
+public class OneConfigLoader implements ITweaker {
public static final Color GRAY_900 = new Color(13, 14, 15, 255);
public static final Color GRAY_700 = new Color(34, 35, 38);
public static final Color PRIMARY_500 = new Color(26, 103, 255);
@@ -36,7 +36,7 @@ public class OneConfigLoader implements IFMLLoadingPlugin {
private long timeLast = System.currentTimeMillis();
private float downloadPercent = 0f;
- private IFMLLoadingPlugin transformer = null;
+ private ITweaker transformer = null;
private static final Logger logger = LogManager.getLogger("OneConfigLoader");
public OneConfigLoader() {
@@ -89,7 +89,7 @@ public class OneConfigLoader implements IFMLLoadingPlugin {
addToClasspath(oneConfigFile);
}
try {
- transformer = ((IFMLLoadingPlugin) Launch.classLoader.findClass("cc.polyfrost.oneconfig.internal.plugin.LoadingPlugin").newInstance());
+ transformer = ((ITweaker) Launch.classLoader.findClass("cc.polyfrost.oneconfig.internal.plugin.OneConfigTweaker").newInstance());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
e.printStackTrace();
showErrorScreen();
@@ -199,29 +199,29 @@ public class OneConfigLoader implements IFMLLoadingPlugin {
return "";
}
- @Override
- public String[] getASMTransformerClass() {
- return transformer == null ? new String[]{} : transformer.getASMTransformerClass();
- }
@Override
- public String getModContainerClass() {
- return transformer == null ? null : transformer.getModContainerClass();
+ public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) {
+ if (transformer != null) {
+ transformer.acceptOptions(args, gameDir, assetsDir, profile);
+ }
}
@Override
- public String getSetupClass() {
- return transformer == null ? null : transformer.getSetupClass();
+ public void injectIntoClassLoader(LaunchClassLoader classLoader) {
+ if (transformer != null) {
+ transformer.injectIntoClassLoader(classLoader);
+ }
}
@Override
- public void injectData(Map<String, Object> data) {
- if (transformer != null) transformer.injectData(data);
+ public String getLaunchTarget() {
+ return transformer != null ? transformer.getLaunchTarget() : null;
}
@Override
- public String getAccessTransformerClass() {
- return transformer == null ? null : transformer.getAccessTransformerClass();
+ public String[] getLaunchArguments() {
+ return transformer != null ? transformer.getLaunchArguments() : new String[0];
}
private static class DownloadUI extends JPanel {