net.minecraftforge.fml.relauncher.FMLInjectionData Java Examples

The following examples show how to use net.minecraftforge.fml.relauncher.FMLInjectionData. 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 check out the related API usage on the sidebar.
Example #1
Source File: ObfMapping.java    From CodeChickenLib with GNU Lesser General Public License v2.1 6 votes vote down vote up
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 File: CodeChickenCorePlugin.java    From CodeChickenCore with 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 File: CommonUtils.java    From CodeChickenCore with MIT License 4 votes vote down vote up
public static File getMinecraftDir() {
    return (File) FMLInjectionData.data()[6];
}
 
Example #4
Source File: CCUpdateChecker.java    From CodeChickenCore with MIT License 4 votes vote down vote up
public static String mcVersion() {
    return (String) FMLInjectionData.data()[4];
}