From e3914f02eef881faf9dbeb37a06c80a3ea590376 Mon Sep 17 00:00:00 2001 From: oitsjustjose Date: Thu, 16 Aug 2018 16:06:56 -0400 Subject: [PATCH] Fix Mojang's fuck ups --- changelog.md | 3 +++ gradle.properties | 2 +- .../geolosys/client/TranslationManager.java | 11 ++++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 5219eb1b..913a3e06 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +### 2.1.1: +* Fix Mojang's fuck ups + ### 2.1.0: * NEW: Vanilla Mode (configurable) disguises vanilla samples added by Geolosys to look like Vanilla (good for Vanilla+ packs or newcomers), and generates ores with their respective Vanilla variants. * NEW: Silk Touching a mod-based material now drops the first entry in the ore dictionary not from Geolosys (i.e.: silk-touching Geolosys Uranium with other mods offering uranium will drop one of those mods' uranium ore instead) diff --git a/gradle.properties b/gradle.properties index 44b23e31..2c0efa89 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -mod_version=2.1.0 +mod_version=2.1.1 minecraft_version=1.12.2 forge_version=14.23.3.2678 mappings_version=snapshot_20180420 diff --git a/src/main/java/com/oitsjustjose/geolosys/client/TranslationManager.java b/src/main/java/com/oitsjustjose/geolosys/client/TranslationManager.java index d1afe614..782a64b4 100644 --- a/src/main/java/com/oitsjustjose/geolosys/client/TranslationManager.java +++ b/src/main/java/com/oitsjustjose/geolosys/client/TranslationManager.java @@ -28,7 +28,16 @@ private void loadLanguages() for (Language lang : Minecraft.getMinecraft().getLanguageManager().getLanguages()) { translations.put(lang.getLanguageCode(), new HashMap<>()); - InputStream in = Geolosys.class.getResourceAsStream("/assets/geolosys/lang/" + lang.getLanguageCode().substring(0, lang.getLanguageCode().indexOf("_")) + lang.getLanguageCode().substring(lang.getLanguageCode().indexOf("_")).toUpperCase() + ".lang"); + InputStream in; + try + { + in = Geolosys.class.getResourceAsStream("/assets/geolosys/lang/" + lang.getLanguageCode().substring(0, lang.getLanguageCode().indexOf("_")) + lang.getLanguageCode().substring(lang.getLanguageCode().indexOf("_")).toUpperCase() + ".lang"); + } + catch (StringIndexOutOfBoundsException e) + { + in = Geolosys.class.getResourceAsStream("/assets/geolosys/lang/en_US.lang"); + Geolosys.getInstance().LOGGER.info("Couldn't find langfile " + (lang.getLanguageCode().substring(0, lang.getLanguageCode().indexOf("_")) + lang.getLanguageCode().substring(lang.getLanguageCode().indexOf("_")).toUpperCase()) + ", defaulting to en_US"); + } if (in == null) { continue;