/** @throws IOException ShrinkWrap errors */ @Override protected void setupPathManager() throws IOException { final JavaArchive homeArchive = ShrinkWrap.create(JavaArchive.class); final FileSystem vfs = ShrinkWrapFileSystems.newFileSystem(homeArchive); PathManager.getInstance().useOverrideHomePath(vfs.getPath("")); PathManager.getInstance().setCurrentSaveTitle("world1"); }
/** Logs software, environment and hardware information. */ private void logEnvironmentInfo() { logger.info(TerasologyVersion.getInstance().toString()); logger.info("Home path: {}", PathManager.getInstance().getHomePath()); logger.info("Install path: {}", PathManager.getInstance().getInstallPath()); logger.info( "Java: {} in {}", System.getProperty("java.version"), System.getProperty("java.home")); logger.info( "Java VM: {}, version: {}", System.getProperty("java.vm.name"), System.getProperty("java.vm.version")); logger.info( "OS: {}, arch: {}, version: {}", System.getProperty("os.name"), System.getProperty("os.arch"), System.getProperty("os.version")); logger.info("Max. Memory: {} MiB", Runtime.getRuntime().maxMemory() / ONE_MEBIBYTE); logger.info("Processors: {}", Runtime.getRuntime().availableProcessors()); }
public void run() { JPopupMenu.setDefaultLightWeightPopupEnabled(false); try { for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { // If Nimbus is not available, you can set the GUI to another look and feel. logger.warn("Failed to set look and feel to Nimbus", e); } LwjglCustomViewPort lwjglCustomViewPort = new LwjglCustomViewPort(); Collection<EngineSubsystem> subsystemList = Lists.<EngineSubsystem>newArrayList( new LwjglGraphics(), new LwjglTimer(), new LwjglAudio(), new LwjglInput(), lwjglCustomViewPort); engine = new TerasologyEngine(subsystemList); mainWindow = new MainWindow(this); lwjglCustomViewPort.setCustomViewport(mainWindow.getViewport()); try { PathManager.getInstance().useDefaultHomePath(); engine.setHibernationAllowed(false); engine.subscribeToStateChange(mainWindow); engine.init(); engine.run(new StateMainMenu()); engine.dispose(); } catch (Throwable t) { logger.error("Uncaught Exception", t); } System.exit(0); }
public ModuleManagerImpl() { metadataReader = new ModuleMetadataReader(); for (ModuleExtension ext : StandardModuleExtension.values()) { metadataReader.registerExtension(ext.getKey(), ext.getValueType()); } Module engineModule; try (Reader reader = new InputStreamReader( getClass().getResourceAsStream("/engine-module.txt"), TerasologyConstants.CHARSET)) { ModuleMetadata metadata = metadataReader.read(reader); engineModule = ClasspathModule.create(metadata, getClass(), Module.class); } catch (IOException e) { throw new RuntimeException("Failed to read engine metadata", e); } catch (URISyntaxException e) { throw new RuntimeException("Failed to convert engine library location to path", e); } registry = new TableModuleRegistry(); registry.add(engineModule); ModulePathScanner scanner = new ModulePathScanner(new ModuleLoader(metadataReader)); scanner.getModuleLoader().setModuleInfoPath(TerasologyConstants.MODULE_INFO_FILENAME); scanner.scan(registry, PathManager.getInstance().getModulePaths()); DependencyInfo engineDep = new DependencyInfo(); engineDep.setId(engineModule.getId()); engineDep.setMinVersion(engineModule.getVersion()); engineDep.setMaxVersion(engineModule.getVersion().getNextPatchVersion()); for (Module mod : registry) { if (mod != engineModule) { mod.getMetadata().getDependencies().add(engineDep); } } setupSandbox(); loadEnvironment(Sets.newHashSet(engineModule), true); }