Localize material names and move the display-prefix to language files

This commit is contained in:
Bernhard Bonigl committed 2014-09-01 22:40:00 +02:00
1 parent 6e9dea9bd8
commit 4c410e6de6
6 files changed
+25 -24

No files matched your search

@@ -11,7 +11,6 @@ public class ToolMaterial
// Reinforced level, shoddy/spiny level, color/style on name
public final String materialName;
public final String displayName;
public final int harvestLevel;
public final int durability;
public final int miningspeed; // <-- divided by 100
@@ -23,14 +22,8 @@ public class ToolMaterial
public final String ability;
public ToolMaterial(String name, int level, int durability, int speed, int damage, float handle, int reinforced, float stonebound, String style, String ability)
{
this(name, name + " ", level, durability, speed, damage, handle, reinforced, stonebound, style, ability);
}
public ToolMaterial(String name, String displayName, int level, int durability, int speed, int damage, float handle, int reinforced, float stonebound, String style, String ability)
{
this.materialName = name;
this.displayName = displayName;
this.harvestLevel = level;
this.durability = durability;
this.miningspeed = speed;
@@ -47,6 +40,16 @@ public class ToolMaterial
return materialName;
}
public String localizedName() { return StatCollector.translateToLocal("material." + materialName.toLowerCase()); }
public String prefixName()
{
// check if there's a special name, otherwise use the regular one
if(StatCollector.canTranslate(String.format("material.%s.display", materialName.toLowerCase())))
return StatCollector.translateToLocal(String.format("material.%s.display", materialName.toLowerCase()));
return localizedName();
}
public int durability ()
{
return this.durability;