aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/gtPlusPlus/core/block/base/BlockBaseModular.java29
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java13
2 files changed, 31 insertions, 11 deletions
diff --git a/src/main/java/gtPlusPlus/core/block/base/BlockBaseModular.java b/src/main/java/gtPlusPlus/core/block/base/BlockBaseModular.java
index 14e4fb6067..4a9b81a1d9 100644
--- a/src/main/java/gtPlusPlus/core/block/base/BlockBaseModular.java
+++ b/src/main/java/gtPlusPlus/core/block/base/BlockBaseModular.java
@@ -28,6 +28,7 @@ public class BlockBaseModular extends BasicBlock {
protected int blockColour;
public BlockTypes thisBlock;
protected String thisBlockMaterial;
+ protected String thisBlockMaterialTranslatedName;
protected final String thisBlockType;
private static HashMap<String, Block> sBlockCache = new HashMap<String, Block>();
@@ -52,6 +53,8 @@ public class BlockBaseModular extends BasicBlock {
registerComponent();
if (material != null) {
sBlockCache.put(material.getUnlocalizedName() + "." + blockType.name(), this);
+ thisBlockMaterialTranslatedName = material.getTranslatedName();
+ GT_LanguageManager.addStringLocalization("gtplusplus." + getUnlocalizedName() + ".name", getProperName());
}
}
@@ -69,7 +72,7 @@ public class BlockBaseModular extends BasicBlock {
this.thisBlock = blockType;
this.thisBlockMaterial = blockMaterialString;
this.thisBlockType = blockType.name().toUpperCase();
- this.setBlockName(this.GetProperName());
+ this.setBlockName(this.getUnlocalizedProperName());
int fx = getBlockTypeMeta();
// ItemBlockGtBlock.sNameCache.put("block."+blockMaterial.getUnlocalizedName()+"."+this.thisBlock.name().toLowerCase(), GetProperName());
GameRegistry.registerBlock(
@@ -142,25 +145,31 @@ public class BlockBaseModular extends BasicBlock {
return 0;
}
- public String GetProperName() {
+ public String getProperName() {
String tempIngot = null;
if (this.thisBlock == BlockTypes.STANDARD) {
- tempIngot = "Block of " + this.thisBlockMaterial;
+ tempIngot = "Block of %material";
} else if (this.thisBlock == BlockTypes.FRAME) {
- tempIngot = this.thisBlockMaterial + " Frame Box";
+ tempIngot = "%material Frame Box";
} else if (this.thisBlock == BlockTypes.ORE) {
- tempIngot = this.thisBlockMaterial + " Ore [Old]";
+ tempIngot = "%material Ore [Old]";
}
return tempIngot;
}
+ public String getUnlocalizedProperName() {
+ return getProperName()
+ .replace("%s", "%temp")
+ .replace("%material", this.thisBlockMaterial)
+ .replace("%temp", "%s");
+ }
+
@Override
public String getLocalizedName() {
- String aFormattedLangName = GetProperName();
- return GT_LanguageManager.addStringLocalization(
- "block." + blockMaterial.getUnlocalizedName() + "."
- + this.thisBlock.name().toLowerCase() + ".name",
- aFormattedLangName);
+ return GT_LanguageManager.getTranslation("gtplusplus." + getUnlocalizedName() + ".name")
+ .replace("%s", "%temp")
+ .replace("%material", this.thisBlockMaterialTranslatedName)
+ .replace("%temp", "%s");
}
@Override
diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java
index 36f53640aa..361d1bb066 100644
--- a/src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java
+++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java
@@ -108,7 +108,7 @@ public class BaseItemComponent extends Item {
this.unlocalName = "itemCell" + aFormattedNameForFluids;
this.materialName = localName;
this.translatedMaterialName =
- GT_LanguageManager.addStringLocalization("gtplusplus.fluid." + this.unlocalName, this.materialName);
+ getFluidName("fluid." + this.materialName.toLowerCase().replace(" ", ""));
this.componentType = ComponentTypes.CELL;
this.setCreativeTab(AddToCreativeTab.tabMisc);
this.setUnlocalizedName(aFormattedNameForFluids);
@@ -207,6 +207,17 @@ public class BaseItemComponent extends Item {
return this.materialName;
}
+ public String getFluidName(String aKey) {
+ String trans;
+ trans = GT_LanguageManager.getTranslation(aKey);
+ if (!trans.equals(aKey)) return trans;
+ aKey = "fluid." + aKey;
+ trans = GT_LanguageManager.getTranslation(aKey);
+ if (!trans.equals(aKey)) return trans;
+ return GT_LanguageManager.addStringLocalization(
+ "gtplusplus.fluid." + this.materialName.toLowerCase().replace(" ", ""), this.materialName);
+ }
+
@Override
public String getItemStackDisplayName(ItemStack stack) {
return GT_LanguageManager.getTranslation("gtplusplus.item." + unlocalName + ".name")