Files
TinkersConstruct/src/main/java/tconstruct/tools/items/ToolPart.java
T

80 lines
2.9 KiB
Java
Raw Normal View History

2014-06-04 21:44:48 -08:00
package tconstruct.tools.items;
import java.util.List;
2013-12-19 10:05:01 -05:00
import mantle.items.abstracts.CraftingItem;
import net.minecraft.creativetab.CreativeTabs;
2014-09-09 18:30:15 +10:00
import net.minecraft.item.*;
2013-08-24 22:36:19 -07:00
import net.minecraft.util.StatCollector;
2013-12-19 10:05:01 -05:00
import tconstruct.library.TConstructRegistry;
2013-11-04 00:33:39 +01:00
import tconstruct.library.util.IToolPart;
2014-06-04 21:44:48 -08:00
import tconstruct.tools.TinkerTools;
2014-09-22 14:36:50 +02:00
@Deprecated
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-12-31 11:26:08 -05:00
public ToolPart(String textureType, String name)
{
super(toolMaterialNames, buildTextureNames(textureType), "parts/", "tinker", TConstructRegistry.partTab);
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
2014-02-06 20:17:52 -05:00
public String getItemStackDisplayName (ItemStack par1ItemStack)
2013-08-24 22:36:19 -07:00
{
String material = toolTextureNames[par1ItemStack.getItemDamage()];
String name = "";
if (StatCollector.canTranslate("toolpart." + partName + "." + material))
{
name = StatCollector.translateToLocal("toolpart." + partName + "." + material);
}
else
{
material = StatCollector.translateToLocal("material." + material);
name = StatCollector.translateToLocal("toolpart." + partName);
name = name.replaceAll("%%material", material);
}
2013-10-16 17:37:33 +11:00
return name;
}
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;
}
2014-09-09 18:30:15 +10:00
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", "Pig Iron", "", "", "", "", "", "", "", "", "", "", "", "", "Thaumium" };
2014-09-09 18:30:15 +10:00
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", "pigiron", "", "", "", "", "", "", "", "", "", "", "", "", "thaumium" };
2013-11-04 00:33:39 +01:00
@Override
2014-02-07 16:50:54 -05:00
public void getSubItems (Item b, CreativeTabs tab, List list)
{
2013-11-19 20:57:52 -08:00
for (int i = 0; i < 19; i++)
2013-12-31 11:26:08 -05:00
list.add(new ItemStack(b, 1, i));
2014-06-04 21:44:48 -08:00
if (TinkerTools.thaumcraftAvailable)
2013-12-31 11:26:08 -05:00
list.add(new ItemStack(b, 1, 31));
}
@Override
public int getMaterialID (ItemStack stack)
{
2014-09-09 18:30:15 +10:00
if (TConstructRegistry.toolMaterials.keySet().contains(stack.getItemDamage()))
return stack.getItemDamage();
return -1;
}
}