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

85 lines
3.1 KiB
Java
Raw Normal View History

package tconstruct.items;
import java.util.List;
2013-12-19 10:05:01 -05:00
import mantle.items.abstracts.CraftingItem;
2013-12-31 11:26:08 -05:00
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
2013-08-24 22:36:19 -07:00
import net.minecraft.util.StatCollector;
2013-11-04 00:33:39 +01:00
import tconstruct.common.TContent;
2013-11-30 09:48:30 -05:00
import tconstruct.common.TRepo;
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;
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)
{
2013-12-31 11:26:08 -05:00
super(toolMaterialNames, buildTextureNames(textureType), "parts/", "tinker", TConstructRegistry.materialTab);
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-01 15:43:24 -05:00
public String func_150896_i (ItemStack par1ItemStack)
2013-08-24 22:36:19 -07:00
{
2013-10-16 17:37:33 +11:00
String material = StatCollector.translateToLocal("parttype." + toolTextureNames[par1ItemStack.getItemDamage()]);
String name = StatCollector.translateToLocal("toolpart." + partName);
name = name.replaceAll("%%material", material);
return name;
2013-11-04 00:33:39 +01:00
2013-10-16 17:37:33 +11:00
/*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();
2013-10-16 17:37:33 +11:00
--
String s = ("" + StatCollector.translateToLocal("toolpart."+partName)).trim();
2013-08-24 22:36:19 -07:00
String s1 = toolMaterialNames[par1ItemStack.getItemDamage()];
if (s1 != null)
{
s = s + " " + StatCollector.translateToLocal(s1);
}
return s;*/
}
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",
2013-11-19 20:57:52 -08:00
"Copper", "Bronze", "Alumite", "Steel", "Blue Slime", "Pig Iron", "", "", "", "", "", "", "", "", "", "", "", "", "Thaumium" };
public static final String[] toolTextureNames = new String[] { "wood", "stone", "iron", "flint", "cactus", "bone", "obsidian", "netherrack", "slime", "paper", "cobalt", "ardite", "manyullyn",
2013-11-19 20:57:52 -08:00
"copper", "bronze", "alumite", "steel", "blueslime", "pigiron", "", "", "", "", "", "", "", "", "", "", "", "", "thaumium" };
2013-11-04 00:33:39 +01:00
@Override
2013-12-31 11:26:08 -05:00
public void getSubItems (Block 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));
2013-11-30 09:48:30 -05:00
if (TRepo.thaumcraftAvailable)
2013-12-31 11:26:08 -05:00
list.add(new ItemStack(b, 1, 31));
}
@Override
public int getMaterialID (ItemStack stack)
{
return stack.getItemDamage();
}
}