SHOW:
|
|
- or go back to the newest paste.
| 1 | private void generateTranslationDefaults() {
| |
| 2 | File dir = new File(ModLoader.getMinecraftInstance().getMinecraftDir(), "/resources/newsound/"); | |
| 3 | for (String fileName : getFinalFile(dir)) {
| |
| 4 | if (fileName.startsWith("."))
| |
| 5 | fileName = fileName.replaceFirst(".", "");
| |
| 6 | fileName = fileName.substring(fileName.indexOf("newsound") + 9, fileName.indexOf(".", fileName.indexOf("newsound") + 9));
| |
| 7 | fileName = fileName.replace("/", ".");
| |
| 8 | fileName = fileName.replace("\\", ".");
| |
| 9 | fileName = fileName.replaceAll("[0-9]", "");
| |
| 10 | if (!fileName.isEmpty()) | |
| 11 | // add yo shizzle | |
| 12 | GenuineCaptionsContainer.instance.addTranslation(fileName, "default"); | |
| 13 | } | |
| 14 | } | |
| 15 | ||
| 16 | private List<String> getFinalFile(File file) {
| |
| 17 | List<String> list = new ArrayList<String>(); | |
| 18 | if (file.isFile()) {
| |
| 19 | list.add(file.getPath()); | |
| 20 | return list; | |
| 21 | } | |
| 22 | for (File file1 : file.listFiles()) {
| |
| 23 | if (file1.isFile()) | |
| 24 | list.add(file1.getPath()); | |
| 25 | else | |
| 26 | list.addAll(getFinalFile(file1)); | |
| 27 | } | |
| 28 | return list; | |
| 29 | } |