summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/potions/PotionStun.java
blob: a0fca8112c411197262d8d84a876458c42a53bfd (plain)
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
/**
 * 
 */
package darkknight.jewelrycraft.potions;

import darkknight.jewelrycraft.util.Variables;
import net.minecraft.entity.EntityLivingBase;

/**
 * @author Sorin
 */
public class PotionStun extends PotionBase {
	protected PotionStun(int id, boolean isBad, int color) {
		super(id, isBad, color);
		this.setPotionName(Variables.MODID + ".potion.stun");
	}

	@Override
	public void action(EntityLivingBase entity) {
		entity.motionX *= 0D;
		entity.motionZ *= 0D;
		entity.motionY *= 0D;

		entity.isSwingInProgress = false;

		entity.moveForward = 0F;
		entity.moveStrafing = 0F;

		entity.setAIMoveSpeed(0F);

		entity.limbSwing = 0F;
		entity.limbSwingAmount = 0F;
		entity.swingProgressInt = 0;

		entity.rotationPitch = entity.prevRotationPitch;
		entity.rotationYaw = entity.prevRotationYaw;

		entity.worldObj.spawnParticle("spell", entity.posX,
				entity.posY + entity.getEyeHeight(),
				entity.posZ, 0.0D, 0.3D, 0.0D);

		if (entity.getActivePotionEffect(PotionList.stun)
				.getDuration() == 0) {
			entity.removePotionEffect(PotionList.stun.id);
		}
	}
}