l10n improve

This commit is contained in:
Antifluxfield 2017-10-19 10:30:37 +08:00
parent 2d8df8d145
commit 32cea58782
14 changed files with 204 additions and 76 deletions

View file

@ -316,6 +316,10 @@ public class GT_Mod implements IGT_Mod {
GT_Log.out.println("GT_Mod: Generating Lang-File"); GT_Log.out.println("GT_Mod: Generating Lang-File");
GT_LanguageManager.sEnglishFile = new Configuration(new File(aEvent.getModConfigurationDirectory().getParentFile(), "GregTech.lang")); GT_LanguageManager.sEnglishFile = new Configuration(new File(aEvent.getModConfigurationDirectory().getParentFile(), "GregTech.lang"));
GT_LanguageManager.sEnglishFile.load(); GT_LanguageManager.sEnglishFile.load();
for (Materials aMaterial : Materials.values()) {
if (aMaterial != null)
aMaterial.mLocalizedName = GT_LanguageManager.addStringLocalization("Material." + aMaterial.mName.toLowerCase(), aMaterial.mDefaultLocalName);
}
GT_Log.out.println("GT_Mod: Removing all original Scrapbox Drops."); GT_Log.out.println("GT_Mod: Removing all original Scrapbox Drops.");
try { try {

View file

@ -818,7 +818,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer {
public byte mEnchantmentToolsLevel = 0, mEnchantmentArmorsLevel = 0; public byte mEnchantmentToolsLevel = 0, mEnchantmentArmorsLevel = 0;
public boolean mBlastFurnaceRequired = false, mTransparent = false; public boolean mBlastFurnaceRequired = false, mTransparent = false;
public float mToolSpeed = 1.0F, mHeatDamage = 0.0F; public float mToolSpeed = 1.0F, mHeatDamage = 0.0F;
public String mChemicalFormula = "?", mName = "null", mDefaultLocalName = "null", mCustomID = "null", mConfigSection = "null"; public String mChemicalFormula = "?", mName = "null", mDefaultLocalName = "null", mCustomID = "null", mConfigSection = "null", mLocalizedName = "null";
public Dyes mColor = Dyes._NULL; public Dyes mColor = Dyes._NULL;
public short mMeltingPoint = 0, mBlastFurnaceTemp = 0, mGasTemp = 0; public short mMeltingPoint = 0, mBlastFurnaceTemp = 0, mGasTemp = 0;
public int mTypes = 0; public int mTypes = 0;
@ -1984,6 +1984,19 @@ public class Materials implements IColorModulationContainer, ISubTagContainer {
return new GT_FluidStack(mStandardMoltenFluid, (int) aAmount); return new GT_FluidStack(mStandardMoltenFluid, (int) aAmount);
} }
public String getLocalizedNameForItem(String aFormat) {
return String.format(aFormat.replace("%s", "%temp").replace("%material", "%s"), this.mLocalizedName).replace("%temp", "%s");
}
public static String getLocalizedNameForItem(String aFormat, int aMaterialID) {
if (aMaterialID >= 0 && aMaterialID < 1000) {
Materials aMaterial = GregTech_API.sGeneratedMaterials[aMaterialID];
if (aMaterial != null)
return aMaterial.getLocalizedNameForItem(aFormat);
}
return aFormat;
}
@Override @Override
public short[] getRGBA() { public short[] getRGBA() {
return mRGBa; return mRGBa;

View file

@ -898,26 +898,31 @@ public enum OrePrefixes {
return name() + aMaterial; return name() + aMaterial;
} }
@SuppressWarnings("incomplete-switch") @Deprecated
public String getDefaultLocalNameForItem(Materials aMaterial) { public String getDefaultLocalNameForItem(Materials aMaterial) {
return aMaterial.getLocalizedNameForItem(getDefaultLocalNameFormatForItem(aMaterial));
}
@SuppressWarnings("incomplete-switch")
public String getDefaultLocalNameFormatForItem(Materials aMaterial) {
// Certain Materials have slightly different Localizations. // Certain Materials have slightly different Localizations.
switch (this) { switch (this) {
case crateGtDust: case crateGtDust:
return mLocalizedMaterialPre + OrePrefixes.dust.getDefaultLocalNameForItem(aMaterial); return mLocalizedMaterialPre + OrePrefixes.dust.getDefaultLocalNameFormatForItem(aMaterial);
case crateGtIngot: case crateGtIngot:
return mLocalizedMaterialPre + OrePrefixes.ingot.getDefaultLocalNameForItem(aMaterial); return mLocalizedMaterialPre + OrePrefixes.ingot.getDefaultLocalNameFormatForItem(aMaterial);
case crateGtGem: case crateGtGem:
return mLocalizedMaterialPre + OrePrefixes.gem.getDefaultLocalNameForItem(aMaterial); return mLocalizedMaterialPre + OrePrefixes.gem.getDefaultLocalNameFormatForItem(aMaterial);
case crateGtPlate: case crateGtPlate:
return mLocalizedMaterialPre + OrePrefixes.plate.getDefaultLocalNameForItem(aMaterial); return mLocalizedMaterialPre + OrePrefixes.plate.getDefaultLocalNameFormatForItem(aMaterial);
} }
switch (aMaterial.mName) { switch (aMaterial.mName) {
case "Glass": case "Glass":
case "BorosilicateGlass": case "BorosilicateGlass":
if (name().startsWith("gem")) return mLocalizedMaterialPre + aMaterial.mDefaultLocalName + " Crystal"; if (name().startsWith("gem")) return mLocalizedMaterialPre + "%material" + " Crystal";
if (name().startsWith("plate")) return mLocalizedMaterialPre + aMaterial.mDefaultLocalName + " Pane"; if (name().startsWith("plate")) return mLocalizedMaterialPre + "%material" + " Pane";
if (name().startsWith("ingot")) return mLocalizedMaterialPre + aMaterial.mDefaultLocalName + " Bar"; if (name().startsWith("ingot")) return mLocalizedMaterialPre + "%material" + " Bar";
if (name().startsWith("nugget")) return mLocalizedMaterialPre + aMaterial.mDefaultLocalName + " Chip"; if (name().startsWith("nugget")) return mLocalizedMaterialPre + "%material" + " Chip";
break; break;
case "Wheat": case "Wheat":
if (name().startsWith("dust")) return mLocalizedMaterialPre + "Flour"; if (name().startsWith("dust")) return mLocalizedMaterialPre + "Flour";
@ -927,11 +932,11 @@ public enum OrePrefixes {
break; break;
case "Wood": case "Wood":
case "WoodSealed": case "WoodSealed":
if (name().startsWith("bolt")) return "Short " + aMaterial.mDefaultLocalName + " Stick"; if (name().startsWith("bolt")) return "Short " + "%material" + " Stick";
if (name().startsWith("stick")) return mLocalizedMaterialPre + aMaterial.mDefaultLocalName + " Stick"; if (name().startsWith("stick")) return mLocalizedMaterialPre + "%material" + " Stick";
if (name().startsWith("dust")) return mLocalizedMaterialPre + aMaterial.mDefaultLocalName + " Pulp"; if (name().startsWith("dust")) return mLocalizedMaterialPre + "%material" + " Pulp";
if (name().startsWith("nugget")) return mLocalizedMaterialPre + aMaterial.mDefaultLocalName + " Chip"; if (name().startsWith("nugget")) return mLocalizedMaterialPre + "%material" + " Chip";
if (name().startsWith("plate")) return mLocalizedMaterialPre + aMaterial.mDefaultLocalName + " Plank"; if (name().startsWith("plate")) return mLocalizedMaterialPre + "%material" + " Plank";
break; break;
case "Plastic": case "Plastic":
case "Rubber": case "Rubber":
@ -946,17 +951,17 @@ public enum OrePrefixes {
case "PolyvinylChloride": case "PolyvinylChloride":
case "Polystyrene": case "Polystyrene":
case "StyreneButadieneRubber": case "StyreneButadieneRubber":
if (name().startsWith("dust")) return mLocalizedMaterialPre + aMaterial.mDefaultLocalName + " Pulp"; if (name().startsWith("dust")) return mLocalizedMaterialPre + "%material" + " Pulp";
if (name().startsWith("plate")) return mLocalizedMaterialPre + aMaterial.mDefaultLocalName + " Sheet"; if (name().startsWith("plate")) return mLocalizedMaterialPre + "%material" + " Sheet";
if (name().startsWith("ingot")) return mLocalizedMaterialPre + aMaterial.mDefaultLocalName + " Bar"; if (name().startsWith("ingot")) return mLocalizedMaterialPre + "%material" + " Bar";
if (name().startsWith("nugget")) return mLocalizedMaterialPre + aMaterial.mDefaultLocalName + " Chip"; if (name().startsWith("nugget")) return mLocalizedMaterialPre + "%material" + " Chip";
if (name().startsWith("foil")) return "Thin " + aMaterial.mDefaultLocalName + " Sheet"; if (name().startsWith("foil")) return "Thin " + "%material" + " Sheet";
break; break;
case "FierySteel": case "FierySteel":
if (mIsContainer) return mLocalizedMaterialPre + "Fiery Blood" + mLocalizedMaterialPost; if (mIsContainer) return mLocalizedMaterialPre + "Fiery Blood" + mLocalizedMaterialPost;
break; break;
case "Steeleaf": case "Steeleaf":
if (name().startsWith("ingot")) return mLocalizedMaterialPre + aMaterial.mDefaultLocalName; if (name().startsWith("ingot")) return mLocalizedMaterialPre + "%material";
break; break;
case "Bone": case "Bone":
if (name().startsWith("dust")) return mLocalizedMaterialPre + "Bone Meal"; if (name().startsWith("dust")) return mLocalizedMaterialPre + "Bone Meal";
@ -969,7 +974,7 @@ public enum OrePrefixes {
case "Chili": case "Chili":
case "Cheese": case "Cheese":
case "Snow": case "Snow":
if (name().startsWith("dust")) return mLocalizedMaterialPre + aMaterial.mDefaultLocalName + " Powder"; if (name().startsWith("dust")) return mLocalizedMaterialPre + "%material" + " Powder";
break; break;
case "Paper": case "Paper":
if (name().startsWith("dust")) return mLocalizedMaterialPre + "Chad"; if (name().startsWith("dust")) return mLocalizedMaterialPre + "Chad";
@ -996,7 +1001,7 @@ public enum OrePrefixes {
case "RockSalt": case "RockSalt":
case "VolcanicAsh": case "VolcanicAsh":
case "RareEarth": case "RareEarth":
if (name().startsWith("dust")) return mLocalizedMaterialPre + aMaterial.mDefaultLocalName; if (name().startsWith("dust")) return mLocalizedMaterialPre + "%material";
break; break;
case "Vermiculite": case "Vermiculite":
case "Bentonite": case "Bentonite":
@ -1010,13 +1015,13 @@ public enum OrePrefixes {
case "QuartzSand": case "QuartzSand":
case "Pitchblende": case "Pitchblende":
case "FullersEarth": case "FullersEarth":
if (name().startsWith("dust")) return mLocalizedMaterialPre + aMaterial.mDefaultLocalName; if (name().startsWith("dust")) return mLocalizedMaterialPre + "%material";
switch (this) { switch (this) {
case crushedCentrifuged: case crushedCentrifuged:
case crushedPurified: case crushedPurified:
return mLocalizedMaterialPre + aMaterial.mDefaultLocalName; return mLocalizedMaterialPre + "%material";
case crushed: case crushed:
return "Ground " + aMaterial.mDefaultLocalName; return "Ground " + "%material";
} }
break; break;
} }
@ -1030,22 +1035,22 @@ public enum OrePrefixes {
case "InfusedOrder": case "InfusedOrder":
case "InfusedVis": case "InfusedVis":
case "InfusedWater": case "InfusedWater":
if (name().startsWith("gem")) return mLocalizedMaterialPre + "Shard of " + aMaterial.mDefaultLocalName; if (name().startsWith("gem")) return mLocalizedMaterialPre + "Shard of " + "%material";
if (name().startsWith("crystal")) return mLocalizedMaterialPre + "Shard of " + aMaterial.mDefaultLocalName; if (name().startsWith("crystal")) return mLocalizedMaterialPre + "Shard of " + "%material";
if (name().startsWith("plate")) if (name().startsWith("plate"))
return mLocalizedMaterialPre + aMaterial.mDefaultLocalName + " Crystal Plate"; return mLocalizedMaterialPre + "%material" + " Crystal Plate";
if (name().startsWith("dust")) if (name().startsWith("dust"))
return mLocalizedMaterialPre + aMaterial.mDefaultLocalName + " Crystal Powder"; return mLocalizedMaterialPre + "%material" + " Crystal Powder";
switch (this) { switch (this) {
case crushedCentrifuged: case crushedCentrifuged:
case crushedPurified: case crushedPurified:
case crushed: case crushed:
return mLocalizedMaterialPre + aMaterial.mDefaultLocalName + " Crystals"; return mLocalizedMaterialPre + "%material" + " Crystals";
} }
break; break;
} }
} }
// Use Standard Localization // Use Standard Localization
return mLocalizedMaterialPre + aMaterial.mDefaultLocalName + mLocalizedMaterialPost; return mLocalizedMaterialPre + "%material" + mLocalizedMaterialPost;
} }
} }

View file

@ -5,6 +5,7 @@ import ic2.core.util.StackUtil;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import java.util.List; import java.util.List;
@ -50,7 +51,21 @@ public class GT_CoolantCell_Item
public void addAdditionalToolTips(List aList, ItemStack aStack, EntityPlayer aPlayer) { public void addAdditionalToolTips(List aList, ItemStack aStack, EntityPlayer aPlayer) {
super.addAdditionalToolTips(aList, aStack, aPlayer); super.addAdditionalToolTips(aList, aStack, aPlayer);
aList.add("Stored Heat: " + getHeatOfStack(aStack)); int rHeat = getHeatOfStack(aStack) * 10 / this.heatStorage;
EnumChatFormatting color;
switch (rHeat) {
case 0: color = EnumChatFormatting.BLUE; break;
case 1:
case 2: color = EnumChatFormatting.GREEN; break;
case 3:
case 4:
case 5:
case 6: color = EnumChatFormatting.YELLOW; break;
case 7:
case 8: color = EnumChatFormatting.RED; break;
default: color = EnumChatFormatting.DARK_RED; break;
}
aList.add(EnumChatFormatting.WHITE + String.format(trans("000", "Stored Heat: %s"), "" + color + getHeatOfStack(aStack)));
switch (getControlTagOfStack(aStack)) { switch (getControlTagOfStack(aStack)) {
case 1: case 1:
aList.add(StatCollector.translateToLocal("ic2.reactoritem.heatwarning.line1")); aList.add(StatCollector.translateToLocal("ic2.reactoritem.heatwarning.line1"));

View file

@ -155,4 +155,8 @@ public class GT_Generic_Item extends Item implements IProjectileItem {
return null; return null;
} }
} }
public String trans(String aKey, String aEnglish){
return GT_LanguageManager.addStringLocalization("Item_DESCRIPTION_Index_"+aKey, aEnglish, false);
}
} }

View file

@ -54,7 +54,7 @@ public abstract class GT_MetaGenerated_Item_X01 extends GT_MetaGenerated_Item {
if (tMaterial == null) continue; if (tMaterial == null) continue;
if (mPrefix.doGenerateItem(tMaterial)) { if (mPrefix.doGenerateItem(tMaterial)) {
ItemStack tStack = new ItemStack(this, 1, i); ItemStack tStack = new ItemStack(this, 1, i);
GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".name", getDefaultLocalization(tPrefix, tMaterial, i)); GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".name", getDefaultLocalizationFormat(tPrefix, tMaterial, i));
GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".tooltip", tMaterial.getToolTip(tPrefix.mMaterialAmount / M)); GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".tooltip", tMaterial.getToolTip(tPrefix.mMaterialAmount / M));
String tOreName = getOreDictString(tPrefix, tMaterial); String tOreName = getOreDictString(tPrefix, tMaterial);
tPrefix = OrePrefixes.getOrePrefix(tOreName); tPrefix = OrePrefixes.getOrePrefix(tOreName);
@ -75,10 +75,21 @@ public abstract class GT_MetaGenerated_Item_X01 extends GT_MetaGenerated_Item {
* @param aMetaData a Index from [0 - 31999] * @param aMetaData a Index from [0 - 31999]
* @return the Localized Name when default LangFiles are used. * @return the Localized Name when default LangFiles are used.
*/ */
@Deprecated
public String getDefaultLocalization(OrePrefixes aPrefix, Materials aMaterial, int aMetaData) { public String getDefaultLocalization(OrePrefixes aPrefix, Materials aMaterial, int aMetaData) {
return aPrefix.getDefaultLocalNameForItem(aMaterial); return aPrefix.getDefaultLocalNameForItem(aMaterial);
} }
/**
* @param aPrefix the OreDict Prefix
* @param aMaterial the Material
* @param aMetaData a Index from [0 - 31999]
* @return the Localized Name Format when default LangFiles are used.
*/
public String getDefaultLocalizationFormat(OrePrefixes aPrefix, Materials aMaterial, int aMetaData) {
return aPrefix.getDefaultLocalNameFormatForItem(aMaterial);
}
/** /**
* @param aPrefix always != null * @param aPrefix always != null
* @param aMaterial always != null * @param aMaterial always != null
@ -102,6 +113,15 @@ public abstract class GT_MetaGenerated_Item_X01 extends GT_MetaGenerated_Item {
/* ---------- INTERNAL OVERRIDES ---------- */ /* ---------- INTERNAL OVERRIDES ---------- */
@Override
public String getItemStackDisplayName(ItemStack aStack) {
String aName = super.getItemStackDisplayName(aStack);
int aDamage = aStack.getItemDamage();
if (aDamage < 32000 && aDamage >= 0)
return Materials.getLocalizedNameForItem(aName, aDamage % 1000);
return aName;
}
@Override @Override
public ItemStack getContainerItem(ItemStack aStack) { public ItemStack getContainerItem(ItemStack aStack) {
int aMetaData = aStack.getItemDamage(); int aMetaData = aStack.getItemDamage();

View file

@ -52,7 +52,7 @@ public abstract class GT_MetaGenerated_Item_X32 extends GT_MetaGenerated_Item {
if (tMaterial == null) continue; if (tMaterial == null) continue;
if (doesMaterialAllowGeneration(tPrefix, tMaterial)) { if (doesMaterialAllowGeneration(tPrefix, tMaterial)) {
ItemStack tStack = new ItemStack(this, 1, i); ItemStack tStack = new ItemStack(this, 1, i);
GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".name", getDefaultLocalization(tPrefix, tMaterial, i)); GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".name", getDefaultLocalizationFormat(tPrefix, tMaterial, i));
GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".tooltip", tMaterial.getToolTip(tPrefix.mMaterialAmount / M)); GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".tooltip", tMaterial.getToolTip(tPrefix.mMaterialAmount / M));
if (tPrefix.mIsUnificatable) { if (tPrefix.mIsUnificatable) {
GT_OreDictUnificator.set(tPrefix, tMaterial, tStack); GT_OreDictUnificator.set(tPrefix, tMaterial, tStack);
@ -96,10 +96,21 @@ public abstract class GT_MetaGenerated_Item_X32 extends GT_MetaGenerated_Item {
* @param aMetaData a Index from [0 - 31999] * @param aMetaData a Index from [0 - 31999]
* @return the Localized Name when default LangFiles are used. * @return the Localized Name when default LangFiles are used.
*/ */
@Deprecated
public String getDefaultLocalization(OrePrefixes aPrefix, Materials aMaterial, int aMetaData) { public String getDefaultLocalization(OrePrefixes aPrefix, Materials aMaterial, int aMetaData) {
return aPrefix.getDefaultLocalNameForItem(aMaterial); return aPrefix.getDefaultLocalNameForItem(aMaterial);
} }
/**
* @param aPrefix the OreDict Prefix
* @param aMaterial the Material
* @param aMetaData a Index from [0 - 31999]
* @return the Localized Name Format when default LangFiles are used.
*/
public String getDefaultLocalizationFormat(OrePrefixes aPrefix, Materials aMaterial, int aMetaData) {
return aPrefix.getDefaultLocalNameFormatForItem(aMaterial);
}
/** /**
* @param aMetaData a Index from [0 - 31999] * @param aMetaData a Index from [0 - 31999]
* @param aMaterial the Material * @param aMaterial the Material
@ -121,6 +132,15 @@ public abstract class GT_MetaGenerated_Item_X32 extends GT_MetaGenerated_Item {
/* ---------- INTERNAL OVERRIDES ---------- */ /* ---------- INTERNAL OVERRIDES ---------- */
@Override
public String getItemStackDisplayName(ItemStack aStack) {
String aName = super.getItemStackDisplayName(aStack);
int aDamage = aStack.getItemDamage();
if (aDamage < 32000 && aDamage >= 0)
return Materials.getLocalizedNameForItem(aName, aDamage % 1000);
return aName;
}
@Override @Override
public ItemStack getContainerItem(ItemStack aStack) { public ItemStack getContainerItem(ItemStack aStack) {
int aDamage = aStack.getItemDamage(); int aDamage = aStack.getItemDamage();

View file

@ -346,18 +346,18 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements
if (tStats != null) { if (tStats != null) {
String name = aStack.getUnlocalizedName(); String name = aStack.getUnlocalizedName();
if (name.equals("gt.metatool.01.170") || name.equals("gt.metatool.01.172") || name.equals("gt.metatool.01.174") || name.equals("gt.metatool.01.176")) { if (name.equals("gt.metatool.01.170") || name.equals("gt.metatool.01.172") || name.equals("gt.metatool.01.174") || name.equals("gt.metatool.01.176")) {
aList.add(tOffset + 0, EnumChatFormatting.WHITE + "Durability: " + EnumChatFormatting.GREEN + (tMaxDamage - getToolDamage(aStack)) + " / " + tMaxDamage + EnumChatFormatting.GRAY); aList.add(tOffset + 0, EnumChatFormatting.WHITE + String.format(trans("001", "Durability: %s/%s"), "" + EnumChatFormatting.GREEN + (tMaxDamage - getToolDamage(aStack)) + " ", " " + tMaxDamage) + EnumChatFormatting.GRAY);
aList.add(tOffset + 1, EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + EnumChatFormatting.YELLOW + " lvl " + getHarvestLevel(aStack, "") + EnumChatFormatting.GRAY); aList.add(tOffset + 1, EnumChatFormatting.WHITE + String.format(trans("002", "%s lvl %s"), tMaterial.mLocalizedName + EnumChatFormatting.YELLOW, "" + getHarvestLevel(aStack, "")) + EnumChatFormatting.GRAY);
aList.add(tOffset + 2, EnumChatFormatting.WHITE + "Turbine Efficiency: " + EnumChatFormatting.BLUE + (50.0F + (10.0F * getToolCombatDamage(aStack))) + EnumChatFormatting.GRAY); aList.add(tOffset + 2, EnumChatFormatting.WHITE + String.format(trans("005", "Turbine Efficiency: %s"), "" + EnumChatFormatting.BLUE + (50.0F + (10.0F * getToolCombatDamage(aStack)))) + EnumChatFormatting.GRAY);
aList.add(tOffset + 3, EnumChatFormatting.WHITE + "Optimal Steam flow: " + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000) + EnumChatFormatting.GRAY + "L/sec"); aList.add(tOffset + 3, EnumChatFormatting.WHITE + String.format(trans("006", "Optimal Steam flow: %sL/sec"), "" + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000) + EnumChatFormatting.GRAY));
aList.add(tOffset + 3, EnumChatFormatting.WHITE + "Optimal Gas flow(EU burnvalue per tick): " + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 50) + EnumChatFormatting.GRAY + "EU/t"); aList.add(tOffset + 3, EnumChatFormatting.WHITE + String.format(trans("007", "Optimal Gas flow(EU burnvalue per tick): %sEU/t"), "" + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 50) + EnumChatFormatting.GRAY));
aList.add(tOffset + 3, EnumChatFormatting.WHITE + "Optimal Plasma flow(Plasma energyvalue per tick): " + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 2000) + EnumChatFormatting.GRAY + "EU/t"); aList.add(tOffset + 3, EnumChatFormatting.WHITE + String.format(trans("008", "Optimal Plasma flow(Plasma energyvalue per tick): %sEU/t"), "" + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 2000) + EnumChatFormatting.GRAY));
} else { } else {
aList.add(tOffset + 0, EnumChatFormatting.WHITE + "Durability: " + EnumChatFormatting.GREEN + (tMaxDamage - getToolDamage(aStack)) + " / " + tMaxDamage + EnumChatFormatting.GRAY); aList.add(tOffset + 0, EnumChatFormatting.WHITE + String.format(trans("001", "Durability: %s/%s"), "" + EnumChatFormatting.GREEN + (tMaxDamage - getToolDamage(aStack)) + " ", " " + tMaxDamage) + EnumChatFormatting.GRAY);
aList.add(tOffset + 1, EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + EnumChatFormatting.YELLOW + " lvl " + getHarvestLevel(aStack, "") + EnumChatFormatting.GRAY); aList.add(tOffset + 1, EnumChatFormatting.WHITE + String.format(trans("002", "%s lvl %s"), tMaterial.mLocalizedName + EnumChatFormatting.YELLOW, "" + getHarvestLevel(aStack, "")) + EnumChatFormatting.GRAY);
aList.add(tOffset + 2, EnumChatFormatting.WHITE + "Attack Damage: " + EnumChatFormatting.BLUE + getToolCombatDamage(aStack) + EnumChatFormatting.GRAY); aList.add(tOffset + 2, EnumChatFormatting.WHITE + String.format(trans("003", "Attack Damage: %s"), "" + EnumChatFormatting.BLUE + getToolCombatDamage(aStack)) + EnumChatFormatting.GRAY);
aList.add(tOffset + 3, EnumChatFormatting.WHITE + "Mining Speed: " + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed) + EnumChatFormatting.GRAY); aList.add(tOffset + 3, EnumChatFormatting.WHITE + String.format(trans("004", "Mining Speed: %s"), "" + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed)) + EnumChatFormatting.GRAY);
NBTTagCompound aNBT = aStack.getTagCompound(); NBTTagCompound aNBT = aStack.getTagCompound();
if (aNBT != null) { if (aNBT != null) {
aNBT = aNBT.getCompoundTag("GT.ToolStats"); aNBT = aNBT.getCompoundTag("GT.ToolStats");

View file

@ -5,9 +5,12 @@ import ic2.core.util.StackUtil;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import java.util.List; import java.util.List;
import gregtech.common.items.GT_DepletetCell_Item;
public class GT_RadioactiveCell_Item public class GT_RadioactiveCell_Item
extends GT_Generic_Item implements IBoxable{ extends GT_Generic_Item implements IBoxable{
protected int cellCount; protected int cellCount;
@ -139,7 +142,18 @@ public class GT_RadioactiveCell_Item
public void addAdditionalToolTips(List aList, ItemStack aStack, EntityPlayer aPlayer) { public void addAdditionalToolTips(List aList, ItemStack aStack, EntityPlayer aPlayer) {
super.addAdditionalToolTips(aList, aStack, aPlayer); super.addAdditionalToolTips(aList, aStack, aPlayer);
//aList.add("Time left: " + (this.maxDelay - getDurabilityOfStack(aStack)) + " secs"); //aList.add("Time left: " + (this.maxDelay - getDurabilityOfStack(aStack)) + " secs");
aList.add("Durability: " + (this.maxDmg - getDurabilityOfStack(aStack)) + "/" + this.maxDmg); int rDmg = getDurabilityOfStack(aStack) * 6 / this.maxDmg;
EnumChatFormatting color2;
switch (rDmg) {
case 0:
case 1: color2 = EnumChatFormatting.WHITE; break;
case 2:
case 3:
case 4: color2 = EnumChatFormatting.GRAY; break;
default: color2 = EnumChatFormatting.DARK_GRAY; break;
}
EnumChatFormatting color1 = this instanceof GT_DepletetCell_Item ? color2 = EnumChatFormatting.DARK_GRAY : EnumChatFormatting.WHITE;
aList.add(color1 + String.format(trans("001", "Durability: %s/%s"), "" + color2 + (this.maxDmg - getDurabilityOfStack(aStack)) + color1, "" + this.maxDmg));
} }
@Override @Override

View file

@ -317,7 +317,16 @@ public class GT_LanguageManager {
// addStringLocalization("Interaction_DESCRIPTION_Index_209", "Grab"); // addStringLocalization("Interaction_DESCRIPTION_Index_209", "Grab");
// addStringLocalization("Interaction_DESCRIPTION_Index_210", "Grab"); // addStringLocalization("Interaction_DESCRIPTION_Index_210", "Grab");
addStringLocalization("Interaction_DESCRIPTION_Index_211", "Items per side: "); addStringLocalization("Interaction_DESCRIPTION_Index_211", "Items per side: ");
addStringLocalization("Item_DESCRIPTION_Index_000", "Stored Heat: %s");
addStringLocalization("Item_DESCRIPTION_Index_001", "Durability: %s/%s");
addStringLocalization("Item_DESCRIPTION_Index_002", "%s lvl %s");
addStringLocalization("Item_DESCRIPTION_Index_003", "Attack Damage: %s");
addStringLocalization("Item_DESCRIPTION_Index_004", "Mining Speed: %s");
addStringLocalization("Item_DESCRIPTION_Index_005", "Turbine Efficiency: %s");
addStringLocalization("Item_DESCRIPTION_Index_006", "Optimal Steam flow: %sL/sec");
addStringLocalization("Item_DESCRIPTION_Index_007", "Optimal Gas flow(EU burnvalue per tick): %sEU/t");
addStringLocalization("Item_DESCRIPTION_Index_008", "Optimal Plasma flow(Plasma energyvalue per tick): %sEU/t");
} }
} }

View file

@ -25,7 +25,7 @@ public class GT_Block_Metal extends GT_Block_Storage {
for (int i = 0; i < aMats.length; i++) { for (int i = 0; i < aMats.length; i++) {
if (aMats[i].mMetaItemSubID > 0 && aMats[i].mHasParentMod) { if (aMats[i].mMetaItemSubID > 0 && aMats[i].mHasParentMod) {
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + i + ".name", "Block of " + aMats[i].mDefaultLocalName); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + i + ".name", "Block of %material");
GT_OreDictUnificator.registerOre(aPrefix, aMats[i], new ItemStack(this, 1, i)); GT_OreDictUnificator.registerOre(aPrefix, aMats[i], new ItemStack(this, 1, i));
} }
} }

View file

@ -57,8 +57,8 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements
if (GregTech_API.sGeneratedMaterials[i] != null) { if (GregTech_API.sGeneratedMaterials[i] != null) {
for (int j = 0; j < aOreMetaCount; j++) { for (int j = 0; j < aOreMetaCount; j++) {
if (!this.getEnabledMetas()[j]) continue; if (!this.getEnabledMetas()[j]) continue;
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + (j * 1000)) + aTextName, getLocalizedName(GregTech_API.sGeneratedMaterials[i])); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + (j * 1000)) + aTextName, getLocalizedNameFormat(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + ((i + 16000) + (j * 1000)) + aTextName, aTextSmall + getLocalizedName(GregTech_API.sGeneratedMaterials[i])); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + ((i + 16000) + (j * 1000)) + aTextName, aTextSmall + getLocalizedNameFormat(GregTech_API.sGeneratedMaterials[i]));
if ((GregTech_API.sGeneratedMaterials[i].mTypes & 0x8) != 0 && !aBlockedOres.contains(GregTech_API.sGeneratedMaterials[i])) { if ((GregTech_API.sGeneratedMaterials[i].mTypes & 0x8) != 0 && !aBlockedOres.contains(GregTech_API.sGeneratedMaterials[i])) {
GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[j] != null ? this.getProcessingPrefix()[j].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + (j * 1000))); GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[j] != null ? this.getProcessingPrefix()[j].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + (j * 1000)));
if (tHideOres) { if (tHideOres) {
@ -99,33 +99,38 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements
FUCKING_LOCK = false; FUCKING_LOCK = false;
} }
public String getLocalizedNameFormat(Materials aMaterial) {
switch (aMaterial.mName) {
case "InfusedAir":
case "InfusedDull":
case "InfusedEarth":
case "InfusedEntropy":
case "InfusedFire":
case "InfusedOrder":
case "InfusedVis":
case "InfusedWater":
return "%material Infused Stone";
case "Vermiculite":
case "Bentonite":
case "Kaolinite":
case "Talc":
case "BasalticMineralSand":
case "GraniticMineralSand":
case "GlauconiteSand":
case "CassiteriteSand":
case "GarnetSand":
case "QuartzSand":
case "Pitchblende":
case "FullersEarth":
return "%material";
default:
return "%material" + OrePrefixes.ore.mLocalizedMaterialPost;
}
}
@Deprecated
public String getLocalizedName(Materials aMaterial) { public String getLocalizedName(Materials aMaterial) {
switch (aMaterial.mName) { return aMaterial.getLocalizedNameForItem(getLocalizedNameFormat(aMaterial));
case "InfusedAir":
case "InfusedDull":
case "InfusedEarth":
case "InfusedEntropy":
case "InfusedFire":
case "InfusedOrder":
case "InfusedVis":
case "InfusedWater":
return aMaterial.mDefaultLocalName + " Infused Stone";
case "Vermiculite":
case "Bentonite":
case "Kaolinite":
case "Talc":
case "BasalticMineralSand":
case "GraniticMineralSand":
case "GlauconiteSand":
case "CassiteriteSand":
case "GarnetSand":
case "QuartzSand":
case "Pitchblende":
case "FullersEarth":
return aMaterial.mDefaultLocalName;
default:
return aMaterial.mDefaultLocalName + OrePrefixes.ore.mLocalizedMaterialPost;
}
} }
public boolean onBlockEventReceived(World p_149696_1_, int p_149696_2_, int p_149696_3_, int p_149696_4_, int p_149696_5_, int p_149696_6_) { public boolean onBlockEventReceived(World p_149696_1_, int p_149696_2_, int p_149696_3_, int p_149696_4_, int p_149696_5_, int p_149696_6_) {

View file

@ -1,6 +1,7 @@
package gregtech.common.blocks; package gregtech.common.blocks;
import gregtech.api.GregTech_API; import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
@ -24,6 +25,10 @@ public class GT_Item_Ores
return this.field_150939_a.getUnlocalizedName() + "." + getDamage(aStack); return this.field_150939_a.getUnlocalizedName() + "." + getDamage(aStack);
} }
public String getItemStackDisplayName(ItemStack aStack) {
return Materials.getLocalizedNameForItem(super.getItemStackDisplayName(aStack), aStack.getItemDamage() % 1000);
}
public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int side, float hitX, float hitY, float hitZ, int aMeta) { public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int side, float hitX, float hitY, float hitZ, int aMeta) {
short tDamage = (short) getDamage(aStack); short tDamage = (short) getDamage(aStack);
if (tDamage > 0) { if (tDamage > 0) {

View file

@ -1,6 +1,7 @@
package gregtech.common.blocks; package gregtech.common.blocks;
import gregtech.api.GregTech_API; import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
@ -20,6 +21,19 @@ public class GT_Item_Storage extends ItemBlock {
return this.field_150939_a.getUnlocalizedName() + "." + getDamage(aStack); return this.field_150939_a.getUnlocalizedName() + "." + getDamage(aStack);
} }
public String getItemStackDisplayName(ItemStack aStack) {
String aName = super.getItemStackDisplayName(aStack);
if (this.field_150939_a instanceof GT_Block_Metal) {
int aDamage = aStack.getItemDamage();
if (aDamage >= 0 && aDamage < ((GT_Block_Metal) this.field_150939_a).mMats.length){
Materials aMaterial = ((GT_Block_Metal) this.field_150939_a).mMats[aDamage];
if (aMaterial != null)
return aMaterial.getLocalizedNameForItem(aName);
}
}
return aName;
}
public int getMetadata(int aMeta) { public int getMetadata(int aMeta) {
return aMeta; return aMeta;
} }