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
|
package gtPlusPlus.core.entity.projectile;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityWitherSkull;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EntityLightningAttack extends EntityWitherSkull {
public EntityLightningAttack(World p_i1794_1_, EntityLivingBase p_i1794_2_, double p_i1794_3_, double p_i1794_5_,
double p_i1794_7_) {
super(p_i1794_1_, p_i1794_2_, p_i1794_3_, p_i1794_5_, p_i1794_7_);
this.setSize(0.3125F, 0.3125F);
}
@SideOnly(Side.CLIENT)
public EntityLightningAttack(World p_i1795_1_, double p_i1795_2_, double p_i1795_4_, double p_i1795_6_,
double p_i1795_8_, double p_i1795_10_, double p_i1795_12_) {
super(p_i1795_1_, p_i1795_2_, p_i1795_4_, p_i1795_6_, p_i1795_8_, p_i1795_10_, p_i1795_12_);
this.setSize(0.3125F, 0.3125F);
}
/**
* Called when this EntityFireball hits a block or entity.
*/
@Override
protected void onImpact(MovingObjectPosition p_70227_1_) {
if (!this.worldObj.isRemote) {
if (p_70227_1_.entityHit != null) {
if (this.shootingEntity != null) {
if (p_70227_1_.entityHit.attackEntityFrom(DamageSource.causeMobDamage(this.shootingEntity), 8.0F)
&& !p_70227_1_.entityHit.isEntityAlive()) {
this.shootingEntity.heal(0.5F);
}
} else {
p_70227_1_.entityHit.attackEntityFrom(DamageSource.lava, 10.0F);
}
if (p_70227_1_.entityHit instanceof EntityLivingBase) {
byte b0 = 0;
if (this.worldObj.difficultySetting == EnumDifficulty.NORMAL) {
b0 = 10;
} else if (this.worldObj.difficultySetting == EnumDifficulty.HARD) {
b0 = 40;
}
if (b0 > 0) {
((EntityLivingBase) p_70227_1_.entityHit)
.addPotionEffect(new PotionEffect(Potion.poison.id, 20 * b0, 1));
((EntityLivingBase) p_70227_1_.entityHit)
.addPotionEffect(new PotionEffect(Potion.confusion.id, 20 * b0, 1));
((EntityLivingBase) p_70227_1_.entityHit)
.addPotionEffect(new PotionEffect(Potion.weakness.id, 20 * b0, 1));
}
}
}
this.worldObj.newExplosion(
this,
this.posX,
this.posY,
this.posZ,
1.0F,
false,
this.worldObj.getGameRules()
.getGameRuleBooleanValue("mobGriefing"));
this.setDead();
}
}
}
|