mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-21 04:22:22 +00:00
[Books] Added checks for language manager presence in light of most recent issues
This commit is contained in:
1 parent
7bcd1043ba
commit
242ffd9f5e
1 file changed
+14
-4
@@ -36,12 +36,22 @@ public class FileRepository extends BookRepository {
|
||||
return safe ? new ResourceLocation("") : null;
|
||||
}
|
||||
if(!path.contains(":")) {
|
||||
String langPath = Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode();
|
||||
String langPath = null;
|
||||
|
||||
if(Minecraft.getMinecraft().getLanguageManager() != null && Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage() != null)
|
||||
{
|
||||
langPath = Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode();
|
||||
}
|
||||
|
||||
String defaultLangPath = "en_US";
|
||||
|
||||
ResourceLocation res = new ResourceLocation(location + "/" + langPath + "/" + path);
|
||||
if(resourceExists(res)) {
|
||||
return res;
|
||||
ResourceLocation res;
|
||||
|
||||
if(langPath != null) {
|
||||
res = new ResourceLocation(location + "/" + langPath + "/" + path);
|
||||
if (resourceExists(res)) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
res = new ResourceLocation(location + "/" + defaultLangPath + "/" + path);
|
||||
if(resourceExists(res)) {
|
||||
|
||||
Reference in new issue
Block a user