aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/modernjava/launch/FCPEntryPoint.java
blob: 3c329314a3edf49224150787a5949c67b76209f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package moe.nea.modernjava.launch;

import moe.nea.modernjava.launch.util.ClassLoaderManipulations;
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;

import java.net.URI;
import java.util.List;
import java.util.Map;


@IFMLLoadingPlugin.Name("ModernJavaRelauncher")
public class FCPEntryPoint implements IFMLLoadingPlugin {
    static URI fileUri;

    static {
        try {
            fileUri = new URI(FCPEntryPoint.class.getProtectionDomain().getCodeSource().getLocation().toString().split("!")[0]);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        if (System.getProperty("modernjava.hasrelaunched") == null) {
            try {
                Class.forName("moe.nea.modernjava.launch.FCPRelauncher").getMethod("relaunch").invoke(null);
            } catch (Throwable t) {
                System.out.println("Failed to relaunch");
                t.printStackTrace();
            }
        } else {
            try {
                ClassLoaderManipulations.addToParentClassLoader(fileUri.toURL());
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            List<String> tweakClasses = WellKnownBlackboard.tweakerNames();
            tweakClasses.add(FCPMixinAwareTweaker.class.getName());
        }
    }


    @Override
    public String[] getASMTransformerClass() {
        return new String[]{
        };
    }

    @Override
    public String getModContainerClass() {
        return null;
    }

    @Override
    public String getSetupClass() {
        return null;
    }

    @Override
    public void injectData(Map<String, Object> map) {

    }

    @Override
    public String getAccessTransformerClass() {
        return null;
    }
}