-
Notifications
You must be signed in to change notification settings - Fork 755
/
ToolPart.java
81 lines (66 loc) · 2.93 KB
/
ToolPart.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package tconstruct.items;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import tconstruct.common.TContent;
import tconstruct.library.util.IToolPart;
public class ToolPart extends CraftingItem implements IToolPart
{
public String partName;
public ToolPart(int id, String textureType, String name)
{
super(id, toolMaterialNames, buildTextureNames(textureType), "parts/");
this.setHasSubtypes(true);
this.setMaxDamage(0);
this.partName = name;
}
@Override
public String getItemDisplayName (ItemStack par1ItemStack)
{
String material = StatCollector.translateToLocal("parttype." + toolTextureNames[par1ItemStack.getItemDamage()]);
String 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)
{
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", "Pig Iron", "", "", "", "", "", "", "", "", "", "", "", "", "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", "pigiron", "", "", "", "", "", "", "", "", "", "", "", "", "thaumium" };
@Override
public void getSubItems (int id, CreativeTabs tab, List list)
{
for (int i = 0; i < 19; 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();
}
}