-
Notifications
You must be signed in to change notification settings - Fork 753
/
LongBow.java
126 lines (107 loc) · 2.98 KB
/
LongBow.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
126
package tconstruct.weaponry.weapons;
import tconstruct.weaponry.TinkerWeaponry;
import tconstruct.weaponry.ammo.ArrowAmmo;
import tconstruct.library.weaponry.BowBaseAmmo;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import tconstruct.tools.TinkerTools;
public class LongBow extends BowBaseAmmo {
public LongBow() {
super(0, "Longbow");
}
@Override
public float minAccuracy(ItemStack itemStack) {
return 7.5f;
}
@Override
public float maxAccuracy(ItemStack itemStack) {
return 0.5f;
}
@Override
public float getZoom(ItemStack itemStack) {
return 1.7f;
}
@Override
protected float windupModifier(ItemStack itemStack) {
return 1.5f;
}
@Override
protected float projectileSpeedModifier(ItemStack itemStack) {
return 1.5f;
}
@Override
protected Entity createProjectile(ItemStack arrows, World world, EntityPlayer player, float speed, float accuracy) {
if(arrows.getItem() instanceof ArrowAmmo)
{
// modify accuraccy of the arrow depending on its accuraccy and weight
NBTTagCompound tags = arrows.getTagCompound().getCompoundTag("InfiTool");
float matAccuracy = tags.getFloat("Accuracy");
float weight = tags.getFloat("Mass");
// we need heavier arrows because we have POW. therefore we increase the weight penality on accuracy
accuracy += ((100f-matAccuracy)/10f)/(weight-1f);
if(accuracy < 0)
accuracy = 0;
}
return super.createProjectile(arrows, world, player, speed, accuracy);
}
@Override
public String getIconSuffix (int partType)
{
switch (partType)
{
case 0:
return "_bow_top";
case 1:
return "_bowstring_broken";
case 2:
return "_bowstring";
case 3:
return "_bow_bottom";
case 4:
return "_bow_grip";
default:
return "";
}
}
@Override
public String getEffectSuffix ()
{
return "_bow_effect";
}
@Override
public String getDefaultFolder ()
{
return "longbow";
}
@Override
public int getPartAmount() {
return 4;
}
@Override
protected boolean animateLayer(int renderPass) {
return renderPass < 3;
}
@Override
public Item getHeadItem ()
{
return TinkerWeaponry.partBowLimb;
}
@Override
public Item getHandleItem ()
{
return TinkerWeaponry.bowstring;
}
@Override
public Item getAccessoryItem ()
{
return TinkerWeaponry.partBowLimb;
}
@Override
public Item getExtraItem() {
return TinkerTools.largePlate;
}
}