-
Notifications
You must be signed in to change notification settings - Fork 754
/
Cleaver.java
189 lines (164 loc) · 3.83 KB
/
Cleaver.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
package tconstruct.items.tools;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import tconstruct.common.TRepo;
import tconstruct.library.tools.AbilityHelper;
import tconstruct.library.tools.Weapon;
import tconstruct.util.config.PHConstruct;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Cleaver extends Weapon
{
public Cleaver()
{
super(6);
this.setUnlocalizedName("InfiTool.Cleaver");
}
@Override
public Item getHeadItem ()
{
return TRepo.largeSwordBlade;
}
@Override
public Item getHandleItem ()
{
return TRepo.toughRod;
}
@Override
public Item getAccessoryItem ()
{
return TRepo.largePlate;
}
@Override
public Item getExtraItem ()
{
return TRepo.toughRod;
}
@Override
public int durabilityTypeAccessory ()
{
return 2;
}
@Override
public int durabilityTypeExtra ()
{
return 1;
}
@Override
public float getRepairCost ()
{
return 4.0f;
}
@Override
public float getDurabilityModifier ()
{
return 2.5f;
}
@Override
public float getDamageModifier ()
{
return 1.4f;
}
@SideOnly(Side.CLIENT)
@Override
public int getRenderPasses (int metadata)
{
return 10;
}
@Override
public int getPartAmount ()
{
return 4;
}
@Override
public String getIconSuffix (int partType)
{
switch (partType)
{
case 0:
return "_cleaver_head";
case 1:
return "_cleaver_head_broken";
case 2:
return "_cleaver_handle";
case 3:
return "_cleaver_shield";
case 4:
return "_cleaver_guard";
default:
return "";
}
}
@Override
public String getEffectSuffix ()
{
return "_cleaver_effect";
}
@Override
public String getDefaultFolder ()
{
return "cleaver";
}
/* Cleaver specific */
@Override
public boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity entity)
{
if (AbilityHelper.onLeftClickEntity(stack, player, entity, this))
{
entity.hurtResistantTime += 7;
/*if (entity instanceof EntityLiving)
{
EntityLiving living = (EntityLiving) entity;
if (living.getHealth() <= 0)
{
}
}*/
//if (entity.getHealth() <= 0)
}
return true;
}
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
{
super.onUpdate(stack, world, entity, par4, par5);
if (entity instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) entity;
ItemStack equipped = player.getCurrentEquippedItem();
if (equipped == stack)
{
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 2));
}
}
}
/*@Override
public boolean onEntitySwing (EntityLiving entity, ItemStack stack)
{
entity.swingProgressInt /= 2;
return false;
}*/
@Override
public boolean willAllowOffhandWeapon ()
{
return false;
}
@Override
public boolean willAllowShield ()
{
return PHConstruct.isCleaverTwoHanded;
}
@Override
public boolean isOffhandHandDualWeapon ()
{
return false;
}
@Override
public boolean sheatheOnBack ()
{
return true;
}
}