public void unpackNatives(CompleteVersion version, File targetDir) throws IOException {
        OperatingSystem os = OperatingSystem.getCurrentPlatform();
        Collection<Library> libraries = version.getRelevantLibraries();

        for (Library library : libraries) {
            Map nativesPerOs = library.getNatives();

            if ((nativesPerOs != null) && (nativesPerOs.get(os) != null)) {
                File file = new File(mcPath, "launcher/" + library.getArtifactPath((String)nativesPerOs.get(os)));
                ZipFile zip = new ZipFile(file);
                ExtractRules extractRules = library.getExtractRules();
                try {
                    Enumeration entries = zip.entries();

                    while (entries.hasMoreElements()) {
                        ZipEntry entry = (ZipEntry)entries.nextElement();

                        if ((extractRules == null) || (extractRules.shouldExtract(entry.getName()))) {
                            File targetFile = new File(targetDir, entry.getName());
                            if (targetFile.getParentFile() != null) targetFile.getParentFile().mkdirs();

                            if (!entry.isDirectory()) {
                                BufferedInputStream inputStream = new BufferedInputStream(zip.getInputStream(entry));

                                byte[] buffer = new byte[2048];
                                FileOutputStream outputStream = new FileOutputStream(targetFile);
                                BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(outputStream);
                                try {
                                    int length;
                                    while ((length = inputStream.read(buffer, 0, buffer.length)) != -1)
                                        bufferedOutputStream.write(buffer, 0, length);
                                } finally {
                                    Downloadable.closeSilently(bufferedOutputStream);
                                    Downloadable.closeSilently(outputStream);
                                    Downloadable.closeSilently(inputStream);
                                }
                            }
                        }
                    }
                } finally { zip.close(); }
            }
        }
    }