Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public Void call() {
- if (FMLLaunchHandler.side().isClient()) {
- // Configuration
- File file = new File("config");
- file.mkdirs();
- config = new ModConfig(file.getAbsolutePath(), "memcheck.cfg");
- if (!config.hasKey("utils", "recommended_memory"))
- config.writeConfig("utils", "recommended_memory", 2048);
- if (!config.hasKey("utils", "memory_check_enabled"))
- config.writeConfig("utils", "memory_check_enabled", false);
- long maxMemory = Runtime.getRuntime().maxMemory() / 1024 / 1024;
- System.out.println("Memory allocated in MB: " + maxMemory);
- System.out.println("Recommended modpack memory: " + getConfig().getInt("utils", "recommended_memory"));
- if (maxMemory < getConfig().getInt("utils", "recommended_memory") && getConfig().getBoolean("utils", "memory_check_enabled")) {
- // Make sure it is the client so that the gui can be called without crashing the server.
- /* MemoryCheckWorker thread = new MemoryCheckWorker(Thread.currentThread(), maxMemory);
- thread.start();*/
- Thread previousThread = Thread.currentThread();
- Checker downloadMonitor = new Checker();
- downloadMonitor.makeDialog("The modpack developer recommends " + getConfig().
- getInt("utils", "recommended_memory") + " memory, but you are using " + maxMemory + " MB.").setVisible(true);
- downloadMonitor.setVisible(true);
- downloadMonitor.confirmButton.addActionListener(b -> {
- downloadMonitor.requestClose();
- });
- }
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement