2013-07-26 21:18:53 -07:00
|
|
|
package tconstruct.items;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import tconstruct.common.TContent;
|
|
|
|
|
import tconstruct.library.util.IToolPart;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
|
|
|
import net.minecraft.item.ItemStack;
|
2013-08-24 22:36:19 -07:00
|
|
|
import net.minecraft.util.StatCollector;
|
2013-07-26 21:18:53 -07:00
|
|
|
|
|
|
|
|
public class ToolPart extends CraftingItem implements IToolPart
|
|
|
|
|
{
|
2013-08-24 22:36:19 -07:00
|
|
|
public String partName;
|
2013-08-31 05:13:31 -07:00
|
|
|
|
2013-08-24 22:36:19 -07:00
|
|
|
public ToolPart(int id, String textureType, String name)
|
2013-07-26 21:18:53 -07:00
|
|
|
{
|
|
|
|
|
super(id, toolMaterialNames, buildTextureNames(textureType), "parts/");
|
|
|
|
|
this.setHasSubtypes(true);
|
|
|
|
|
this.setMaxDamage(0);
|
2013-08-24 22:36:19 -07:00
|
|
|
this.partName = name;
|
|
|
|
|
}
|
2013-08-31 05:13:31 -07:00
|
|
|
|
2013-08-24 22:36:19 -07:00
|
|
|
@Override
|
|
|
|
|
public String getItemDisplayName (ItemStack par1ItemStack)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder builder = new StringBuilder();
|
2013-08-31 05:13:31 -07:00
|
|
|
builder.append(StatCollector.translateToLocal("parttype." + toolTextureNames[par1ItemStack.getItemDamage()])).append(" ").append(StatCollector.translateToLocal("toolpart." + partName));
|
2013-08-24 22:36:19 -07:00
|
|
|
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;*/
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static String[] buildTextureNames (String textureType)
|
|
|
|
|
{
|
|
|
|
|
String[] names = new String[toolMaterialNames.length];
|
|
|
|
|
for (int i = 0; i < toolMaterialNames.length; i++)
|
|
|
|
|
{
|
|
|
|
|
if (toolTextureNames[i].equals(""))
|
|
|
|
|
names[i] = "";
|
|
|
|
|
else
|
|
|
|
|
names[i] = toolTextureNames[i] + textureType;
|
|
|
|
|
}
|
|
|
|
|
return names;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static final String[] toolMaterialNames = new String[] { "Wood", "Stone", "Iron", "Flint", "Cactus", "Bone", "Obsidian", "Netherrack", "Slime", "Paper", "Cobalt", "Ardite", "Manyullyn",
|
|
|
|
|
"Copper", "Bronze", "Alumite", "Steel", "Blue Slime", "", "", "", "", "", "", "", "", "", "", "", "", "", "Thaumium" };
|
|
|
|
|
|
|
|
|
|
public static final String[] toolTextureNames = new String[] { "wood", "stone", "iron", "flint", "cactus", "bone", "obsidian", "netherrack", "slime", "paper", "cobalt", "ardite", "manyullyn",
|
|
|
|
|
"copper", "bronze", "alumite", "steel", "blueslime", "", "", "", "", "", "", "", "", "", "", "", "", "", "thaumium" };
|
|
|
|
|
|
|
|
|
|
public void getSubItems (int id, CreativeTabs tab, List list)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < 17; i++)
|
|
|
|
|
list.add(new ItemStack(id, 1, i));
|
|
|
|
|
|
|
|
|
|
if (TContent.thaumcraftAvailable)
|
|
|
|
|
list.add(new ItemStack(id, 1, 31));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getMaterialID (ItemStack stack)
|
|
|
|
|
{
|
|
|
|
|
return stack.getItemDamage();
|
|
|
|
|
}
|
|
|
|
|
}
|