public void step(String message) { if (step >= steps) throw new IllegalStateException("too much steps for ProgressBar " + title); if (timeEachStep && step != 0) { long newTime = System.nanoTime(); FMLLog.fine( "Bar Step: %s - %s took %.3fs", getTitle(), getMessage(), ((float) (newTime - lastTime) / 1000000 / 1000)); lastTime = newTime; } step++; this.message = FMLCommonHandler.instance().stripSpecialChars(message); FMLCommonHandler.instance().processWindowMessages(); }
/** * Not a fully fleshed out API, may change in future MC versions. However feel free to use and * suggest additions. */ public static ProgressBar push(String title, int steps, boolean timeEachStep) { ProgressBar bar = new ProgressBar(title, steps); bars.add(bar); if (timeEachStep) { bar.timeEachStep(); } FMLCommonHandler.instance().processWindowMessages(); return bar; }
public String getCrashInformation() { // Handle being called before we've begun setup if (modController == null) { return ""; } StringBuilder ret = new StringBuilder(); List<String> branding = FMLCommonHandler.instance().getBrandings(false); Joiner.on(' ').skipNulls().appendTo(ret, branding); if (modController != null) { modController.printModStates(ret); } return ret.toString(); }
/** * Not a fully fleshed out API, may change in future MC versions. However feel free to use and * suggest additions. */ public static void pop(ProgressBar bar) { if (bar.getSteps() != bar.getStep()) throw new IllegalStateException("can't pop unfinished ProgressBar " + bar.getTitle()); bars.remove(bar); if (bar.getSteps() != 0) { long newTime = System.nanoTime(); if (bar.timeEachStep) FMLLog.fine( "Bar Step: %s - %s took %.3fs", bar.getTitle(), bar.getMessage(), ((float) (newTime - bar.lastTime) / 1000000 / 1000)); if (bar.getSteps() == 1) FMLLog.fine( "Bar Finished: %s - %s took %.3fs", bar.getTitle(), bar.getMessage(), ((float) (newTime - bar.startTime) / 1000000 / 1000)); else FMLLog.fine( "Bar Finished: %s took %.3fs", bar.getTitle(), ((float) (newTime - bar.startTime) / 1000000 / 1000)); } FMLCommonHandler.instance().processWindowMessages(); }