@Override
public Void call() throws Exception {
log("Jarmod2Coremod loading...");
File root, jarmodsDir;
if (coremodLocation != null) {
root = coremodLocation.getParentFile(); // root/coremods/us.jar -> root/coremods
if (root != null) {
root = root.getParentFile(); // root
}
} else {
root = new File(".").getCanonicalFile();
}
String sep = System.getProperty("file.separator");
String side = FMLRelauncher.side();
jarmodsDir = new File(root.getCanonicalPath() + sep + "jarmods" + sep + side);
jarmodsDir.mkdirs();
log("jarmod directory: " + jarmodsDir);
File[] files = jarmodsDir.listFiles();
Arrays.sort(files); // TODO: customizable priority
for (File file : files) {
log("Jarmod found: " + file);
try {
loadJarmod(file);
} catch (Exception ex) {
FMLLog.log(Level.SEVERE, "[Jarmod2Coremod] Failed to load jarmod: "+ file + ": " + ex.getLocalizedMessage());
ex.printStackTrace();
}
}
log("Preloaded "+JarmodTransformer.size()+" classes");
//System.exit(0); // for testing
return null;
}
java类cpw.mods.fml.relauncher.FMLRelauncher的实例源码
Scanner.java 文件源码
项目:Jarmod2Coremod
阅读 36
收藏 0
点赞 0
评论 0
HighlightTips.java 文件源码
项目:HighlightTips
阅读 30
收藏 0
点赞 0
评论 0
@Mod.PreInit
public void preInit(FMLPreInitializationEvent event) {
Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());
try {
cfg.load();
enable = cfg.get(Configuration.CATEGORY_GENERAL, "enable", true).getBoolean(true);
keyToggle = cfg.get(Configuration.CATEGORY_GENERAL, "key.toggle", DEFAULT_KEY_TOGGLE).getInt(DEFAULT_KEY_TOGGLE);
range = cfg.get(Configuration.CATEGORY_GENERAL, "range", DEFAULT_RANGE).getDouble(DEFAULT_RANGE);
x = cfg.get(Configuration.CATEGORY_GENERAL, "x", DEFAULT_X).getInt(DEFAULT_X);
y = cfg.get(Configuration.CATEGORY_GENERAL, "y", DEFAULT_Y).getInt(DEFAULT_Y);
color = cfg.get(Configuration.CATEGORY_GENERAL, "color", DEFAULT_COLOR).getInt(DEFAULT_COLOR);
} catch (Exception e) {
FMLLog.log(Level.SEVERE, e, "HighlightTips had a problem loading it's configuration");
} finally {
cfg.save();
}
if (!FMLRelauncher.side().equals("CLIENT")) {
// gracefully disable on non-client (= server) instead of crashing
enable = false;
}
if (!enable) {
FMLLog.log(Level.INFO, "HighlightTips disabled");
return;
}
TickRegistry.registerTickHandler(this, Side.CLIENT);
KeyBindingRegistry.registerKeyBinding(toggleKeyHandler = new ToggleKeyHandler(keyToggle));
}
Main.java 文件源码
项目:MLIA
阅读 26
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
System.setProperty("fml.core.libraries.mirror", "https://dl.dropboxusercontent.com/u/126404991/fmllibs/%s");
FMLRelauncher.handleClientRelaunch(new ArgsWrapper(args));
}