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
|
package jp.plusplus.fbs.entity;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
/**
* Createdby pluslus_Fon 2015/06/14.
*/
public class EntityMagicFireBolt extends EntityMagicProjectileBase {
public EntityMagicFireBolt(World p_i1582_1_) {
super(p_i1582_1_);
}
public EntityMagicFireBolt(World par1World, EntityLivingBase par2EntityLivingBase, float speed, float speed2, float damage) {
super(par1World, par2EntityLivingBase, speed, speed2, 0, 0, 0);
setDamage(damage);
}
@Override
public boolean canExist() {
return worldObj.isRemote || ticksExisted < 20 * 1.5;
}
@Override
public void onCollideWithPlayer(MovingObjectPosition pos, EntityPlayer entity) {
if (!worldObj.isRemote && !shootingEntity.isEntityEqual(entity)) {
entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, entity), getDamage());
entity.setFire(20 * 3);
setDead();
}
}
@Override
public void onCollideWithMob(MovingObjectPosition pos, EntityMob entity) {
if (!worldObj.isRemote) {
entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, entity), getDamage());
entity.setFire(20 * 3);
setDead();
}
}
@Override
public void onCollideWithLiving(MovingObjectPosition pos, EntityLiving entity) {
if (!worldObj.isRemote) {
entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, entity), getDamage());
entity.setFire(20 * 3);
setDead();
}
}
@Override
public void onCollideWithBlock(MovingObjectPosition pos, Block block) {
if (!worldObj.isRemote) {
int i = pos.blockX;
int j = pos.blockY;
int k = pos.blockZ;
switch (pos.sideHit) {
case 0:
--j;
break;
case 1:
++j;
break;
case 2:
--k;
break;
case 3:
++k;
break;
case 4:
--i;
break;
case 5:
++i;
}
if (this.worldObj.isAirBlock(i, j, k)) {
this.worldObj.setBlock(i, j, k, Blocks.fire);
}
setDead();
}
}
@Override
protected void setParticleColor(){
particleRed=0.8f+0.2f*rand.nextFloat();
particleGreen=0.5f*rand.nextFloat();
particleBlue=0;
}
}
|