-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAIAnkleGrabAttack.java
53 lines (42 loc) · 1.36 KB
/
AIAnkleGrabAttack.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
package freeradicalx.zombies;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import thehippomaster.AnimationAPI.AIAnimation;
import thehippomaster.AnimationAPI.IAnimatedEntity;
public class AIAnkleGrabAttack extends AIAnimation {
private IAnimatedEntity entityCrawler1;
private EntityLivingBase attackTarget;
public AIAnkleGrabAttack(IAnimatedEntity test) {
super(test);
entityCrawler1 = test;
attackTarget = null;
}
public int getAnimID() {
return 3;
}
public boolean isAutomatic() {
return true;
}
public int getDuration() {
return 35;
}
public void startExecuting() {
//remember to super!
super.startExecuting();
attackTarget = ((EntityCreature)entityCrawler1).getAttackTarget();
}
public void updateTask() {
((EntityCrawler1)entityCrawler1).restCounter = 0;
if(entityCrawler1.getAnimTick() == 15 && attackTarget != null)
attackTarget.attackEntityFrom(DamageSource.causeMobDamage(((EntityCreature)entityCrawler1)), 1);
attackTarget.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 1, 3));
attackTarget.motionX = 0;
attackTarget.motionY = 0;
attackTarget.motionZ = 0;
}
}