Java 类net.minecraftforge.fml.relauncher.FMLInjectionData 实例源码

项目:CustomWorldGen    文件:FMLDeobfTweaker.java   
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader)
{
    // Deobfuscation transformer, always last, and the access transformer tweaker as well
    classLoader.registerTransformer("net.minecraftforge.fml.common.asm.transformers.DeobfuscationTransformer");
    // Add all the access transformers now as well
    for (String transformer : CoreModManager.getAccessTransformers())
    {
        classLoader.registerTransformer(transformer);
    }
    classLoader.registerTransformer("net.minecraftforge.fml.common.asm.transformers.ModAccessTransformer");
    classLoader.registerTransformer("net.minecraftforge.fml.common.asm.transformers.ItemStackTransformer");
    try
    {
        FMLRelaunchLog.fine("Validating minecraft");
        Class<?> loaderClazz = Class.forName("net.minecraftforge.fml.common.Loader", true, classLoader);
        Method m = loaderClazz.getMethod("injectData", Object[].class);
        m.invoke(null, (Object)FMLInjectionData.data());
        m = loaderClazz.getMethod("instance");
        m.invoke(null);
        FMLRelaunchLog.fine("Minecraft validated, launching...");
    }
    catch (Exception e)
    {
        // Load in the Loader, make sure he's ready to roll - this will initialize most of the rest of minecraft here
        System.out.println("A CRITICAL PROBLEM OCCURRED INITIALIZING MINECRAFT - LIKELY YOU HAVE AN INCORRECT VERSION FOR THIS FML");
        throw new RuntimeException(e);
    }
}
项目:CustomWorldGen    文件:Configuration.java   
/**
 * Create a configuration file for the file given in parameter with the provided config version number.
 */
private void runConfiguration(File file, String configVersion)
{
    this.file = file;
    this.definedConfigVersion = configVersion;
    String basePath = ((File)(FMLInjectionData.data()[6])).getAbsolutePath().replace(File.separatorChar, '/').replace("/.", "");
    String path = file.getAbsolutePath().replace(File.separatorChar, '/').replace("/./", "/").replace(basePath, "");
    if (PARENT != null)
    {
        PARENT.setChild(path, this);
        isChild = true;
    }
    else
    {
        fileName = path;
        try
        {
            load();
        }
        catch (Throwable e)
        {
            File fileBak = new File(file.getAbsolutePath() + "_" +
                    new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + ".errored");
            FMLLog.severe("An exception occurred while loading config file %s. This file will be renamed to %s " +
                    "and a new config file will be generated.", file.getName(), fileBak.getName());
            e.printStackTrace();

            file.renameTo(fileBak);
            load();
        }
    }
}
项目:CodeChickenCore    文件:CodeChickenCorePlugin.java   
public CodeChickenCorePlugin() {
    if (minecraftDir != null) {
        return;//get called twice, once for IFMLCallHook
    }

    minecraftDir = (File) FMLInjectionData.data()[6];
    currentMcVersion = (String) FMLInjectionData.data()[4];

    loadConfig();
}
项目:CodeChickenCore    文件:CCUpdateChecker.java   
public static String mcVersion() {
    return (String) FMLInjectionData.data()[4];
}
项目:CCTweaks    文件:CCTweaks.java   
public static void initConfig() {
    if (configFile == null) {
        configFile = new ConfigFile(new File((File) FMLInjectionData.data()[6], "config/CodeChickenTweaks.cfg")).setComment("CodeChickenTweaks configuration file.\n" + "Deleting any element will restore it to it's default value");
    }
}
项目:CodeChickenLib    文件:CommonUtils.java   
public static File getMinecraftDir() {
    return (File) FMLInjectionData.data()[6];
}
项目:Gui_Desiner    文件:GuiLoader.java   
public Importer(GuiLoader screen, String name) {
    this.screen = screen;
    File mcDir = (File) FMLInjectionData.data()[6];
    folder = new File(mcDir, "guis");
    file = new File(folder, name + ".gui");
}
项目:Gui_Desiner    文件:Saver.java   
public Saver(GuiDesigner guiDesigner, String name) {
    this.guiDesigner = guiDesigner;
    File mcDir = (File) FMLInjectionData.data()[6];
    folder = new File(mcDir, "guis");
    file = new File(folder, name + ".gui");
}
项目:Gui_Desiner    文件:Loader.java   
public Loader(String name) {
    File mcDir = (File) FMLInjectionData.data()[6];
    folder = new File(mcDir, "guis");
    file = new File(folder, name + ".gui");
}
项目:Gui_Desiner    文件:GuiLoader.java   
public Importer(GuiLoader screen, String name) {
    this.screen = screen;
    File mcDir = (File) FMLInjectionData.data()[6];
    folder = new File(mcDir, "guis");
    file = new File(folder, name + ".gui");
}
项目:Gui_Desiner    文件:Saver.java   
public Saver(GuiDesigner guiDesigner, String name) {
    this.guiDesigner = guiDesigner;
    File mcDir = (File) FMLInjectionData.data()[6];
    folder = new File(mcDir, "guis");
    file = new File(folder, name + ".gui");
}
项目:Gui_Desiner    文件:Loader.java   
public Loader(String name) {
    File mcDir = (File) FMLInjectionData.data()[6];
    folder = new File(mcDir, "guis");
    file = new File(folder, name + ".gui");
}