Skip to content

Commit

Permalink
Fix material abilities not getting localized for display
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Aug 20, 2014
1 parent 608de3a commit fc0420d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/main/java/tconstruct/client/pages/MaterialPage.java
Expand Up @@ -156,9 +156,9 @@ public void renderContentLayer (int localWidth, int localHeight, boolean isTrans
String ability = material.ability();
if (!ability.equals(""))
{
manual.fonts.drawString(materialTrait + ": " + material.ability(), localWidth, localHeight + 120 + 10 * offset, 0);
manual.fonts.drawString(materialTrait + ": " + material.localizedAbility(), localWidth, localHeight + 120 + 10 * offset, 0);
offset++;
if (ability.equals("Writable"))
if (ability.equals("materialtraits.writable"))
manual.fonts.drawString(extraMod, localWidth, localHeight + 120 + 10 * offset, 0);
}

Expand Down
5 changes: 4 additions & 1 deletion src/main/java/tconstruct/library/tools/ToolCore.java
Expand Up @@ -433,9 +433,12 @@ public static String getStyleForType (int type)
return TConstructRegistry.getMaterial(type).style();
}

/**
* Returns the localized name of the materials ability. Only use this for display purposes, not for logic.
*/
public String getAbilityNameForType (int type)
{
return TConstructRegistry.getMaterial(type).ability();
return TConstructRegistry.getMaterial(type).localizedAbility();
}

public String getReinforcedName (int head, int handle, int accessory, int extra, int unbreaking)
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/tconstruct/library/tools/ToolMaterial.java
@@ -1,5 +1,7 @@
package tconstruct.library.tools;

import net.minecraft.util.StatCollector;

/*
* Dynamic substitute for an enum. It carries a lot of information
*/
Expand Down Expand Up @@ -89,4 +91,6 @@ public String ability ()
{
return this.ability;
}

public String localizedAbility () { return StatCollector.translateToLocal(this.ability); }
}

0 comments on commit fc0420d

Please sign in to comment.