private static int loadSimsInDir(File dir) {
        File[] files = dir.listFiles();
        int loadedFiles = 0;
        if (files != null && files.length > 0) {
            for (File file : files) {
                if (file.isFile() && file.getName().endsWith(".sim")) {
                    try {
                        Block block = loadSim(new FileInputStream(file));
                        Sim.LOGGER.logDetail("Loaded block from external sim: " + block.getId());
                        loadedFiles++;
                    } catch (IOException e) {
                        Sim.LOGGER.logWarning("Unable to read sim: " + file.getPath());
                        e.printStackTrace();
                    }
                }
            }
        }
        return loadedFiles;
    }