-
Notifications
You must be signed in to change notification settings - Fork 753
/
ArrowAmmo.java
125 lines (106 loc) · 3.35 KB
/
ArrowAmmo.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
package tconstruct.weaponry.ammo;
import tconstruct.TConstruct;
import tconstruct.weaponry.TinkerWeaponry;
import tconstruct.weaponry.library.weaponry.AmmoItem;
import tconstruct.weaponry.util.Reference;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import tconstruct.library.crafting.ToolBuilder;
import tconstruct.tools.TinkerTools;
import java.util.List;
public class ArrowAmmo extends AmmoItem {
public static ItemStack vanillaArrow;
public ArrowAmmo() {
super(0, "Arrows");
}
@Override
public String getIconSuffix (int partType)
{
switch (partType)
{
case 0:
return "_arrow_head";
case 1:
return ""; // Doesn't break
case 2:
return "_arrow_shaft";
case 3:
return "_arrow_fletching";
default:
return "";
}
}
@Override
public String getEffectSuffix ()
{
return "_arrow_effect";
}
@Override
public String getDefaultFolder ()
{
return "arrow";
}
@Override
public String getDefaultTexturePath() {
return Reference.RESOURCE + ":" + getDefaultFolder();
}
@Override
public void registerPartPaths (int index, String[] location)
{
headStrings.put(index, location[0]);
}
@Override
public void registerAlternatePartPaths (int index, String[] location)
{
handleStrings.put(index, location[2]);
accessoryStrings.put(index, location[3]);
}
@Override
public Item getHeadItem ()
{
return TinkerTools.arrowhead;
}
@Override
public Item getHandleItem() {
return TinkerWeaponry.partArrowShaft;
}
@Override
public Item getAccessoryItem ()
{
return TinkerTools.fletching;
}
@Override
public String[] getTraits ()
{
return new String[] { "ammo" };
}
@Override
public void buildTool (int id, String name, List list)
{
ItemStack handleStack = new ItemStack(getHandleItem(), 1, 0); // wooden shaft
ItemStack accessoryStack = new ItemStack(getAccessoryItem(), 1, 0); // feather fletchling
ItemStack tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, id), handleStack, accessoryStack, null, "");
if (tool != null)
{
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
list.add(tool);
}
}
@Override
public void getSubItems(Item id, CreativeTabs tab, List list) {
super.getSubItems(id, tab, list);
// vanilla arrow
ItemStack headStack = new ItemStack(getHeadItem(), 1, TinkerTools.MaterialID.Flint); // flint arrow head
ItemStack handleStack = new ItemStack(getHandleItem(), 1, 0); // wooden shaft
ItemStack accessoryStack = new ItemStack(getAccessoryItem(), 1, 0); // feather fletchling
ItemStack tool = ToolBuilder.instance.buildTool(headStack, handleStack, accessoryStack, null, "");
if (tool != null)
{
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
vanillaArrow = tool;
}
else
TConstruct.logger.error("Couldn't build vanilla equivalent of Tinker Arrow");
}
}