use of com.oitsjustjose.geolosys.Geolosys in project Geolosys by oitsjustjose.
the class ItemFieldManual method translatePageText.
@SideOnly(Side.CLIENT)
public String translatePageText(int pageNumber) {
String langFile = Minecraft.getMinecraft().gameSettings.language;
langFile = langFile.substring(0, langFile.indexOf("_")) + langFile.substring(langFile.indexOf("_")).toUpperCase();
InputStream in = Geolosys.class.getResourceAsStream("/assets/geolosys/book/" + langFile + ".lang");
if (in == null) {
langFile = "en_US";
in = Geolosys.class.getResourceAsStream("/assets/geolosys/book/" + langFile + ".lang");
}
try {
for (String s : IOUtils.readLines(in, "utf-8")) {
if (s.indexOf("=") == -1) {
continue;
}
if (s.substring(0, s.indexOf("=")).equals("page_" + pageNumber + "_text")) {
return s.substring(s.indexOf("=") + 1);
}
}
} catch (IOException e) {
}
return "ERROR READING PAGE " + pageNumber;
}
use of com.oitsjustjose.geolosys.Geolosys in project Geolosys by oitsjustjose.
the class ItemFieldManual method getNumEntries.
@SideOnly(Side.CLIENT)
public int getNumEntries() {
String langFile = Minecraft.getMinecraft().gameSettings.language;
langFile = langFile.substring(0, langFile.indexOf("_")) + langFile.substring(langFile.indexOf("_")).toUpperCase();
InputStream in = Geolosys.class.getResourceAsStream("/assets/geolosys/book/" + langFile + ".lang");
int numLines = 0;
if (in == null) {
langFile = "en_US";
in = Geolosys.class.getResourceAsStream("/assets/geolosys/lang/" + langFile + ".lang");
}
try {
for (String s : IOUtils.readLines(in, "utf-8")) {
if (s.indexOf("=") == -1) {
continue;
}
if (s.contains("_title")) {
numLines++;
}
}
} catch (IOException e) {
}
return numLines;
}
use of com.oitsjustjose.geolosys.Geolosys in project Geolosys by oitsjustjose.
the class ItemFieldManual method translateTitle.
@SideOnly(Side.CLIENT)
public String translateTitle(int pageNumber) {
String langFile = Minecraft.getMinecraft().gameSettings.language;
langFile = langFile.substring(0, langFile.indexOf("_")) + langFile.substring(langFile.indexOf("_")).toUpperCase();
InputStream in = Geolosys.class.getResourceAsStream("/assets/geolosys/book/" + langFile + ".lang");
if (in == null) {
langFile = "en_US";
in = Geolosys.class.getResourceAsStream("/assets/geolosys/book/" + langFile + ".lang");
}
try {
for (String s : IOUtils.readLines(in, "utf-8")) {
if (s.indexOf("=") == -1) {
continue;
}
if (s.substring(0, s.indexOf("=")).equals("page_" + pageNumber + "_title")) {
return s.substring(s.indexOf("=") + 1);
}
}
} catch (IOException e) {
}
return "ERROR READING PAGE " + pageNumber;
}
use of com.oitsjustjose.geolosys.Geolosys in project Geolosys by oitsjustjose.
the class HelperFunctions method getTranslation.
@SideOnly(Side.CLIENT)
public static String getTranslation(String toTranslate) {
String langFile = Minecraft.getMinecraft().gameSettings.language;
langFile = langFile.substring(0, langFile.indexOf("_")) + langFile.substring(langFile.indexOf("_")).toUpperCase();
InputStream in = Geolosys.class.getResourceAsStream("/assets/geolosys/lang/" + langFile + ".lang");
if (in == null) {
langFile = "en_US";
in = Geolosys.class.getResourceAsStream("/assets/geolosys/lang/" + langFile + ".lang");
}
try {
for (String s : IOUtils.readLines(in, "utf-8")) {
if (s.indexOf("=") == -1) {
continue;
}
if (s.contains(toTranslate)) {
return s.substring(s.indexOf("=") + 1);
}
}
} catch (IOException e) {
}
return toTranslate;
}
Aggregations