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
|
package gtPlusPlus.core.entity.projectile;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class EntityToxinballSmall extends EntityToxinball {
// required for any entity from vanilla code. please don't just randomly delete because intellij says no usages
public EntityToxinballSmall(World p_i1770_1_) {
super(p_i1770_1_);
this.setSize(0.3125F, 0.3125F);
}
public EntityToxinballSmall(World world, EntityLivingBase entity, double x, double y, double z) {
super(world, entity, x, y, z);
this.setSize(0.3125F, 0.3125F);
}
public EntityToxinballSmall(World p_i1772_1_, double p_i1772_2_, double p_i1772_4_, double p_i1772_6_,
double p_i1772_8_, double p_i1772_10_, double p_i1772_12_) {
super(p_i1772_1_, p_i1772_2_, p_i1772_4_, p_i1772_6_, p_i1772_8_, p_i1772_10_, p_i1772_12_);
this.setSize(0.3125F, 0.3125F);
}
/**
* Called when this EntityFireball hits a block or entity.
*/
@Override
protected void onImpact(MovingObjectPosition MoP) {
if (!this.worldObj.isRemote) {
if (MoP.entityHit != null) {
if (!MoP.entityHit.isImmuneToFire() && MoP.entityHit
.attackEntityFrom(DamageSource.causeFireballDamage(this, this.shootingEntity), 5.0F)) {
MoP.entityHit.setFire(5);
}
} else {
int i = MoP.blockX;
int j = MoP.blockY;
int k = MoP.blockZ;
switch (MoP.sideHit) {
case 0 -> --j;
case 1 -> ++j;
case 2 -> --k;
case 3 -> ++k;
case 4 -> --i;
case 5 -> ++i;
}
if (this.worldObj.isAirBlock(i, j, k)) {
this.worldObj.setBlock(i, j, k, Blocks.fire);
}
}
this.setDead();
}
}
/**
* Returns true if other Entities should be prevented from moving through this Entity.
*/
@Override
public boolean canBeCollidedWith() {
return false;
}
/**
* Called when the entity is attacked.
*/
@Override
public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) {
return false;
}
}
|