Merge pull request #973 from Qowyn/loc-patch

Loc patch
This commit is contained in:
boni committed 2014-09-14 20:16:10 +02:00
commit 72fdecbfd2
4 files changed
+33 -22

No files matched your search

@@ -2,9 +2,12 @@ package tconstruct.library.crafting;
/** Once upon a time, too many tools to count. Let's put them together automatically */
import cpw.mods.fml.common.eventhandler.Event.Result;
import java.util.*;
import net.minecraft.item.*;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.MinecraftForge;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.event.*;
@@ -428,6 +431,14 @@ public class ToolBuilder
public static String defaultToolName (ToolMaterial headMat, ToolCore tool)
{
String toolName = tool.getToolName().toLowerCase();
String matName = headMat.materialName.toLowerCase().replaceAll(" ", "");
if (StatCollector.canTranslate("tool." + toolName + "." + matName))
{
return StatCollector.translateToLocal("tool." + toolName + "." + matName);
}
return String.format("%s %s", headMat.prefixName(), tool.getLocalizedToolName());
}
@@ -536,7 +536,7 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IMo
{
Map.Entry pairs = (Map.Entry) iter.next();
tconstruct.library.tools.ToolMaterial material = (tconstruct.library.tools.ToolMaterial) pairs.getValue();
buildTool((Integer) pairs.getKey(), material.prefixName(), list);
buildTool((Integer) pairs.getKey(), ToolBuilder.defaultToolName(material, this), list);
}
}
@@ -546,8 +546,7 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IMo
ItemStack accessoryStack = accessory != null ? new ItemStack(getAccessoryItem(), 1, id) : null;
Item extra = getExtraItem();
ItemStack extraStack = extra != null ? new ItemStack(extra, 1, id) : null;
String completeName = String.format("%s %s", name, getLocalizedToolName());
ItemStack tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, id), new ItemStack(getHandleItem(), 1, id), accessoryStack, extraStack, completeName);
ItemStack tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, id), new ItemStack(getHandleItem(), 1, id), accessoryStack, extraStack, name);
if (tool != null)
{
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
@@ -25,26 +25,21 @@ public class ToolPart extends CraftingItem implements IToolPart
@Override
public String getItemStackDisplayName (ItemStack par1ItemStack)
{
String material = StatCollector.translateToLocal("parttype." + toolTextureNames[par1ItemStack.getItemDamage()]);
String name = StatCollector.translateToLocal("toolpart." + partName);
name = name.replaceAll("%%material", material);
String material = toolTextureNames[par1ItemStack.getItemDamage()];
String name = "";
if (StatCollector.canTranslate("toolpart." + partName + "." + material))
{
name = StatCollector.translateToLocal("toolpart." + partName + "." + material);
}
else
{
material = StatCollector.translateToLocal("parttype." + material);
name = StatCollector.translateToLocal("toolpart." + partName);
name = name.replaceAll("%%material", material);
}
return name;
/*
* StringBuilder builder = new StringBuilder();
* builder.append(StatCollector.translateToLocal("parttype." +
* toolTextureNames
* [par1ItemStack.getItemDamage()])).append(" ").append(StatCollector
* .translateToLocal("toolpart." + partName)); return
* builder.toString(); -- String s = ("" +
* StatCollector.translateToLocal("toolpart."+partName)).trim(); String
* s1 = toolMaterialNames[par1ItemStack.getItemDamage()];
*
* if (s1 != null) { s = s + " " + StatCollector.translateToLocal(s1); }
*
* return s;
*/
}
private static String[] buildTextureNames (String textureType)