Java Code Examples for net.minecraftforge.fml.relauncher.FMLInjectionData#data()

The following examples show how to use net.minecraftforge.fml.relauncher.FMLInjectionData#data() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
public static File confDirectoryGuess(int i, ConfigTag tag) {
    File mcDir = (File) FMLInjectionData.data()[6];
    switch (i) {
        case 0:
            return tag.value != null ? new File(tag.getValue()) : null;
        case 1:
            return new File(mcDir, "../conf");
        case 2:
            return new File(mcDir, "../build/unpacked/conf");
        case 3:
            return new File(System.getProperty("user.home"), ".gradle/caches/minecraft/net/minecraftforge/forge/"+
                FMLInjectionData.data()[4]+"-"+ ForgeVersion.getVersion()+"/unpacked/conf");
        default:
            JFileChooser fc = new JFileChooser(mcDir);
            fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            fc.setDialogTitle("Select an mcp conf dir for the deobfuscator.");
            int ret = fc.showDialog(null, "Select");
            return ret == JFileChooser.APPROVE_OPTION ? fc.getSelectedFile() : null;
    }
}
 
Example 2
Source Project: CodeChickenCore   File: CodeChickenCorePlugin.java    License: MIT License 5 votes vote down vote up
public static void versionCheck(String reqVersion, String mod) {
    String mcVersion = (String) FMLInjectionData.data()[4];
    if (!VersionParser.parseRange(reqVersion).containsVersion(new DefaultArtifactVersion(mcVersion))) {
        String err = "This version of " + mod + " does not support minecraft version " + mcVersion;
        logger.error(err);

        JEditorPane ep = new JEditorPane("text/html",
                "<html>" +
                        err +
                        "<br>Remove it from your coremods folder and check <a href=\"http://www.minecraftforum.net/topic/909223-\">here</a> for updates" +
                        "</html>");

        ep.setEditable(false);
        ep.setOpaque(false);
        ep.addHyperlinkListener(new HyperlinkListener()
        {
            @Override
            public void hyperlinkUpdate(HyperlinkEvent event) {
                try {
                    if (event.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED))
                        Desktop.getDesktop().browse(event.getURL().toURI());
                } catch (Exception ignored) {}
            }
        });

        JOptionPane.showMessageDialog(null, ep, "Fatal error", JOptionPane.ERROR_MESSAGE);
        System.exit(1);
    }
}
 
Example 3
Source Project: CodeChickenCore   File: CommonUtils.java    License: MIT License 4 votes vote down vote up
public static File getMinecraftDir() {
    return (File) FMLInjectionData.data()[6];
}
 
Example 4
Source Project: CodeChickenCore   File: CCUpdateChecker.java    License: MIT License 4 votes vote down vote up
public static String mcVersion() {
    return (String) FMLInjectionData.data()[4];
}