mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-26 06:43:05 +00:00
Added StringUtil.canTranslate
This commit is contained in:
1 parent
cfd60a9610
commit
548823813f
6 files changed
+9
-5
No files matched your search
@@ -74,7 +74,7 @@ public class ItemBeeGE extends ItemGE {
|
||||
|
||||
IBee individual = new Bee(itemstack.getTagCompound());
|
||||
String customBeeKey = "bees.custom." + type.getName() + "." + individual.getGenome().getPrimary().getUnlocalizedName().replace("bees.species.","");
|
||||
if(StatCollector.canTranslate("for." + customBeeKey)){
|
||||
if(StringUtil.canTranslate("for." + customBeeKey)){
|
||||
return StringUtil.localize(customBeeKey);
|
||||
}
|
||||
String beeGrammar = StringUtil.localize("bees.grammar." + type.getName());
|
||||
|
||||
@@ -81,7 +81,7 @@ public class ItemGermlingGE extends ItemGE implements IVariableFermentable {
|
||||
return "Unknown";
|
||||
IIndividual individual = getIndividual(itemstack);
|
||||
String customTreeKey = "trees.custom." + type.getName() + "." + individual.getGenome().getPrimary().getUnlocalizedName().replace("trees.species.","");
|
||||
if(StatCollector.canTranslate("for." + customTreeKey)){
|
||||
if(StringUtil.canTranslate("for." + customTreeKey)){
|
||||
return StringUtil.localize(customTreeKey);
|
||||
}
|
||||
return StringUtil.localize("trees.grammar." + type.getName()).replaceAll("%SPECIES", individual.getDisplayName()).replaceAll("%TYPE", StringUtil.localize("trees.grammar." + type.getName() + ".type"));
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ItemLeavesBlock extends ItemForestryBlock {
|
||||
return type;
|
||||
ITree tree = getTree(itemstack);
|
||||
String customTreeKey = "trees.custom.leaves." + tree.getGenome().getPrimary().getUnlocalizedName().replace("trees.species.","");
|
||||
if(StatCollector.canTranslate("for." + customTreeKey)){
|
||||
if(StringUtil.canTranslate("for." + customTreeKey)){
|
||||
return StringUtil.localize(customTreeKey);
|
||||
}
|
||||
String grammar = StringUtil.localize("trees.grammar.leaves");
|
||||
|
||||
@@ -123,7 +123,7 @@ public abstract class GuiAlyzer extends GuiForestry<TileForestry> {
|
||||
}
|
||||
|
||||
protected final String checkCustomName(String key){
|
||||
if(StatCollector.canTranslate("for." + key)){
|
||||
if(StringUtil.canTranslate("for." + key)){
|
||||
return StringUtil.localize(key);
|
||||
} else {
|
||||
return null;
|
||||
|
||||
@@ -18,6 +18,10 @@ import net.minecraft.util.StatCollector;
|
||||
|
||||
public class StringUtil {
|
||||
|
||||
public static boolean canTranslate(String key) {
|
||||
return StatCollector.canTranslate(key);
|
||||
}
|
||||
|
||||
public static String localize(String key) {
|
||||
return StatCollector.translateToLocal("for." + key).replace("\\n", "\n").replace("@", "%").replace("\\%", "@");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user